Hello,

Since past few weeks I have been working on improving the sensor framework to 
take care of couple of issues. Some of them are mentioned below:

- Change data structure to SLIST instead of TAILQ so that it can get 
initialized statically. This is needed so that sysinit could be used for 
initializing the sensors.
- Remove dummy functions in the bsp and add the sensor device initialization 
functions instead.
- Adding syscfg based configuration for onboard Vs offboard sensors
- Adding sensor creator package for creating external sensor devices if they 
are not on the board itself. This is just for convenience sake. The right way 
to do this would be from the bsp. As a result, removed sensor device creation 
from nrf52dk and nrf52840pdk bsps.
- Add sensor interface struct so that it can get used by the individual drivers 
so that we can talk to multiple sensors using the same driver using same or 
different interfaces.
- For TSL2561, apart from the above changes, various fixes were made:
    1. Making a few changes to this driver along with sensor_itf changes
    2. Gain, integration time and enabled flag was a global instead of reading 
every time gain is set or integration time is set. Changing it so that we read 
the timing register before setting either gain or integration time.
    3. Also changing a few functions in the driver to handle errors more 
gracefully. Changing shell to work with new functions.
    4. Making changes so that it goes in synch with the drivers.
    5. Removing delays from the read function. the poller should be set 
according to the other config values being set so that the sensor is read at 
the correct interval.
- Add a mask field to the sensor structure so that differentiating between 
supported Vs configured sensors is possible
- Change the sensor_mgr_match_bytype() function to check w.r.t mask and make it 
a public API.
- Adding config variable for mask for different drivers in their respective 
structures.
- Adding an API to set the sensor types based on the mask.
- Moving config_sensor() out of the app into the creator package and the bsp. 
Objective is to show how a developer would initialize and configure the sensor 
in the bsp which is normally the practice.
- Changing sensor_shell command "list" to show only configured types.
- sensor_shell cmd "type" shows supported types set by the driver.
- In the sensor_oic source file changing code to check type only while 
allocating resources.
- Changing device name in the sensors_test app to be "sensy" instead of "pi"
- For the LSM303DLHC driver the address field in the "sensor_itf" structure is 
not enough since it talks to the sensor using two addresses: one for 
accelerometer and one for magnetometer. The best way to deal with this is to 
make the addresses config variables in the sensor driver structure. For any 
such sensor devices which have multiple addresses, a similar approach should be 
followed.
- Have changes the drivers to work with all the fixes mentioned above.

Hope this gives more context on the changes. 

The PR for the same is https://github.com/apache/incubator-mynewt-core/pull/258 
<https://github.com/apache/incubator-mynewt-core/pull/258>. 

Please feel free to try it out, read through the code and comment/give 
feedback. 

Regards,
Vipul Rahane

Reply via email to