[riot-users] How to use SAUL?

Ken Bannister kb2ma at runbox.com
Thu Mar 21 10:34:50 CET 2019


Excellent! I defer to others on config location, as I have no expertise 
at that level.

On 3/21/19 1:24 AM, Philipp Blum wrote:
>
> Thanks, works fine. I changed the PIN config in the driver. I am not 
> really happy with it. So, where to place the pin config instead? 
> Should I place it in my boards configuration?
>
> Am 2019-03-20 15:23, schrieb Ken Bannister:
>
>> Hi Philipp,
>>
>> I created a similar simple data collection app [1]. It uses SAUL with 
>> an MCP9808 temp sensor (JC 42.4 compliant), and of course CoAP. ;-) 
>> Start with the README. Then look for 'saul' in Makefile and in main.c 
>> main() and _run_sensor_loop().
>>
>> Ken
>>
>> [1] https://github.com/kb2ma/riot-data-collector
>>
>> On 3/20/19 1:04 PM, Philipp Blum wrote:
>>>
>>> Hi,
>>>
>>> I just want to use the DHT11 sensor. I know that RIOT has an 
>>> abstraction layer for sensors, which is really nice. My problem is 
>>> just: How to use it? I have a server on my device which accepts UDP 
>>> packets. The server should read the sensor data on a regular base, 
>>> caches them and sends them back when asked. So, simple as that. 
>>> Probably I have add the modules for my driver and saul, right? So my 
>>> Makefile should look like this
>>>
>>> |USEMDOULE += saul |
>>>
>>> |USEMODULE += dht |
>>>
>>> The dht driver already has confgurations, which I need to override, 
>>> since the pins are not correct. Should I just do the following in my 
>>> application?
>>>
>>> |#undef DHT_PARAM_PIN |
>>>
>>> |#define DHT_PARAM_PIN (GPIO_PIN(0, 12)) |
>>>
>>> or should I define the DHT_PARAMS? When the setup is done, I 
>>> probably just need to use saul itself with:
>>>
>>> |const char temp_sensor_name[] = "dht"; phydat_t temp_data; 
>>> saul_reg_t * temp_sensor_reg = saul_reg_find_name(temp_sensor_name); 
>>> saul_reg_read(temp_sensor_reg, &temp_data); |
>>>
>>> right? thanks for the help :)
>>>
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at riot-os.org
>>> https://lists.riot-os.org/mailman/listinfo/users
>>
>> _______________________________________________
>> users mailing list
>> users at riot-os.org <mailto:users at riot-os.org>
>> https://lists.riot-os.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20190321/e03410e1/attachment-0001.html>


More information about the users mailing list