You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Jacob Rosenthal <ja...@gmail.com> on 2018/03/01 16:18:17 UTC

Move driver _shell_init into driver pkg.init instead of app main

shell_init in the app feels odd.
https://github.com/apache/mynewt-core/blob/master/apps/sensors_test/src/main.c#L411

It feels like they should be down in the drivers pkg.init, especially
theyre defined down in the driver's syscfg
https://github.com/apache/mynewt-core/blob/master/hw/drivers/drv2605/syscfg.yml#L21

My ideal world would probably be something conditional like
pkg.init.DRV2605_CLI:
   drv2605_shell_init 501

but that would need newt tool changes I presume.

Uglier, but we could make some new second init function which does #ifdef
and calls drv2605_shell_init

pkg.init:
 drv2605_init_thesecond

Thoughts (especially from vipul)

Re: Move driver _shell_init into driver pkg.init instead of app main

Posted by Jacob Rosenthal <ja...@gmail.com>.
Though I guess we still have the issue of wanting to 'own' the allocated
structures outside of the driver..

On Thu, Mar 1, 2018 at 10:36 AM, Jacob Rosenthal <ja...@gmail.com>
wrote:

> Frankly something like
> pkg.init.DRV2605_OFB
>    drv2605_init 500
>
>  here would allow us to remove sensor creator entirely
>
> ideally supporting multiple pkg.init conditionals
>
> pkg.init.DRV2605_CLI:
>    drv2605_shell_init 501
>
>
> On Thu, Mar 1, 2018 at 9:23 AM, marko kiiskila <ma...@runtime.io> wrote:
>
>> +1 on using sysinit
>>
>> > On Mar 1, 2018, at 6:18 PM, Jacob Rosenthal <ja...@gmail.com>
>> wrote:
>> >
>> > shell_init in the app feels odd.
>> > https://github.com/apache/mynewt-core/blob/master/apps/senso
>> rs_test/src/main.c#L411
>> >
>> > It feels like they should be down in the drivers pkg.init, especially
>> > theyre defined down in the driver's syscfg
>> > https://github.com/apache/mynewt-core/blob/master/hw/drivers
>> /drv2605/syscfg.yml#L21
>> >
>> > My ideal world would probably be something conditional like
>> > pkg.init.DRV2605_CLI:
>> >   drv2605_shell_init 501
>> >
>> > but that would need newt tool changes I presume.
>> >
>> > Uglier, but we could make some new second init function which does
>> #ifdef
>> > and calls drv2605_shell_init
>> >
>> > pkg.init:
>> > drv2605_init_thesecond
>> >
>> > Thoughts (especially from vipul)
>>
>>
>

Re: Move driver _shell_init into driver pkg.init instead of app main

Posted by Jacob Rosenthal <ja...@gmail.com>.
Frankly something like
pkg.init.DRV2605_OFB
   drv2605_init 500

 here would allow us to remove sensor creator entirely

ideally supporting multiple pkg.init conditionals

pkg.init.DRV2605_CLI:
   drv2605_shell_init 501


On Thu, Mar 1, 2018 at 9:23 AM, marko kiiskila <ma...@runtime.io> wrote:

> +1 on using sysinit
>
> > On Mar 1, 2018, at 6:18 PM, Jacob Rosenthal <ja...@gmail.com>
> wrote:
> >
> > shell_init in the app feels odd.
> > https://github.com/apache/mynewt-core/blob/master/apps/
> sensors_test/src/main.c#L411
> >
> > It feels like they should be down in the drivers pkg.init, especially
> > theyre defined down in the driver's syscfg
> > https://github.com/apache/mynewt-core/blob/master/hw/
> drivers/drv2605/syscfg.yml#L21
> >
> > My ideal world would probably be something conditional like
> > pkg.init.DRV2605_CLI:
> >   drv2605_shell_init 501
> >
> > but that would need newt tool changes I presume.
> >
> > Uglier, but we could make some new second init function which does #ifdef
> > and calls drv2605_shell_init
> >
> > pkg.init:
> > drv2605_init_thesecond
> >
> > Thoughts (especially from vipul)
>
>

Re: Move driver _shell_init into driver pkg.init instead of app main

Posted by marko kiiskila <ma...@runtime.io>.
+1 on using sysinit

> On Mar 1, 2018, at 6:18 PM, Jacob Rosenthal <ja...@gmail.com> wrote:
> 
> shell_init in the app feels odd.
> https://github.com/apache/mynewt-core/blob/master/apps/sensors_test/src/main.c#L411
> 
> It feels like they should be down in the drivers pkg.init, especially
> theyre defined down in the driver's syscfg
> https://github.com/apache/mynewt-core/blob/master/hw/drivers/drv2605/syscfg.yml#L21
> 
> My ideal world would probably be something conditional like
> pkg.init.DRV2605_CLI:
>   drv2605_shell_init 501
> 
> but that would need newt tool changes I presume.
> 
> Uglier, but we could make some new second init function which does #ifdef
> and calls drv2605_shell_init
> 
> pkg.init:
> drv2605_init_thesecond
> 
> Thoughts (especially from vipul)