Hello Jacob, There are two things you are mentioning:
1. For the initialization of the sensor chip: I have been thinking about calling the driver initialization function directly from the bsp. Right now there is a function which doesn’t to do anything and is just a placeholder cause there needs to be an initialization function for each driver. It is quite counter-intuitive I agree. Although, I think this has to do something w.r.t. sysinit and the priority level at which the devices and peripherals actually come up. Also, why device creation is so deep is because we want the BSP to be the one source file where all the devices get created. They can be opened anywhere in the app to do further config. 2. "Why not generalize to create maybe spi0 os_dev instead of accel os_dev then since.. theres nothing accel specific being done in the bsp?” the SensorAPI is a generic mechanism we are using to talk to sensors over different interfaces, these could be UART/I2C/SPI, etc. SPI0 is the actual interface which has a driver associated with it, every device on SPI0 cannot be named spi0. Hence, the unique identification string. Having said that, you could name your device anything which can ride SPI0. With I2C, there could be multiple sensors that are connected to the same SDA, SCL. Hope I answered your questions. Regards, Vipul Rahane > On May 4, 2017, at 2:59 PM, Jacob Rosenthal <[email protected]> wrote: > > Hey Vipul et al, > > Ive been plugging away at a few sensors (bma250, lis2dh) and so taking a > much closer look at this now. > > It seems odd to me that sensors are getting pushed all way down to the BSP, > only to be created, but not inited. Also why dont BSP then pickup a > dependency on all those sensors? I presume Im missing something about the > os bringup? > > Why not generalize to create maybe spi0 os_dev instead of accel os_dev then > since.. theres nothing accel specific being done in the bsp? > > Thanks for any clarification. > > > On Fri, Mar 31, 2017 at 6:19 PM, Vipul Rahane <[email protected]> wrote: > >> Yes, that’s what I mean’t. Thanks Will. >> >> -Vipul >> >>> On Mar 31, 2017, at 5:37 PM, will sanfilippo <[email protected]> wrote: >>> >>> I presume you mean “was getting too crowded” :-) >>> >>> Yeah, I copied that bsp to create this other bsp and noticed alot of >> sensor dev creates in there. Not a big deal but I think this will make the >> code a bit less crowded. >>> >>> +1 >>> >>> >>>> On Mar 31, 2017, at 5:30 PM, Vipul Rahane <[email protected]> wrote: >>>> >>>> Hello, >>>> >>>> I am changing nrf52dk hal_bsp_init() so that it calls >> sensor_device_create() instead of creating sensors separately. this is >> because hal_bsp_init() was not getting too crowded. >>>> >>>> Regards, >>>> Vipul Rahane >>> >> >>
