Cool. So Ill let the bsp do the init.

I am having one issue. For lis2dh, I need to know the current accel_mode to
know if the data read back is 8, 10, or 12 bits.  From lis2dh.c:sensor_read
we get a sensor object and can lookup the config with SENSOR_GET_DEVICE and
pass to lis2dh_get_vector_data. However when lis2dh_shell.c attemps to
reuse that function it doesnt get passed a device, sensor, or a config ...

I attempted (with my half ass c) to just grab the struct from the bsp, but
its not currently in the header or global so Im getting a new instance and
breaking my code. I could make the lis2dh device global in the bsp, but
thats probably not preferred anyway. Is there an api Im missing, or one
that fits here?

relevant code in github
https://github.com/jacobrosenthal/mynewt-unofficial/blob/c83248e4eb063abbd4486401c6d2023b681ba5c6/hw/drivers/sensors/lis2dh/src/lis2dh.c#L372
https://github.com/jacobrosenthal/mynewt-unofficial/blob/c83248e4eb063abbd4486401c6d2023b681ba5c6/hw/drivers/sensors/lis2dh/src/lis2dh_shell.c#L98


On Fri, May 5, 2017 at 11:42 AM, Kevin Townsend <[email protected]> wrote:

> This is my fault most likely ... the goal at the driver level was indeed
> to init with a known default config, but obviously if people think a
> different solution is better there's no reason not to change it!
>
> K.
>
>
>
> On 05/05/17 20:39, Vipul Rahane wrote:
>
>> I do not know the reason why it is done the way it is but I think you are
>> right, the reason might have been to initialize with a default config.
>>
>>
>> On May 4, 2017, at 3:45 PM, Jacob Rosenthal <[email protected]>
>>> wrote:
>>>
>>> On Thu, May 4, 2017 at 3:39 PM, Vipul Rahane <[email protected]> wrote:
>>>
>>> I have been thinking about calling the driver initialization function
>>>> directly from the bsp
>>>>
>>>
>>> Can you comment on why you're not yet init in the BSP? Im thinking power
>>> issues, which is another conversation I started in another thread. Maybe
>>> if
>>> the goal was to init with a config that was as low power as possible
>>> maybe
>>> its ok to do so in the BSP?
>>>
>>> May I know what do you mean by the following ? Isn’t it currently that
>> way.
>>
>> Shouldnt these BSPs have dependencies on the drivers either way, if only
>>> when the _PRESENT flag is on
>>>
>> Regards,
>> Vipul Rahane
>>
>
>

Reply via email to