That's exactly what I need: an example to follow. I'll check it

Thanks, Alan

Grr

El vie, 8 ene 2021 a las 13:10, Alan Carvalho de Assis (<acas...@gmail.com>)
escribió:

> On 1/8/21, Abdelatif Guettouche <abdelatif.guettou...@gmail.com> wrote:
> >> The biggest issue I see is that drivers are hard coding the CS reference
> >> like the MCP2515 which always uses SPIDEV_CANBUS(0), this should be
> >> passed
> >> in to the initialization of all SPI devices and owned by the private
> >> device
> >> structure not hard coded. I could even see the argument for this being
> >> part
> >> of the generic SPI interface structure.
> >
> >
> > Some drivers do do that.  They accept a "devno" argument in their init
> > function and then pass it with the SPI calls.
> >
>
> Yes, an example is this one: nuttx/drivers/sensors/max31855.c
>
> When I created the mcp2515 driver I wasn't considering to use more
> than one CAN module by board. Sorry, my fault!
>
> BTW, the modification is simples. Grr, just look how it is done in the
> max31855 and do the same for mcp2515.
>
> The board initialization for max31855 is here:
> nuttx/boards/arm/stm32/common/src/stm32_max31855.c
>
> BR,
>
> Alan
>

Reply via email to