[riot-notifications] [RIOT] drivers/spi: updated SPI driver interface (#3216)
notifications at github.com
Tue Jun 30 11:43:45 CEST 2015
@gebart: The problem I see, is that by making the CS line implicit by adding it as paramter to the transfer functions, we decoupled it from the init function...
I also notices a second problem we just run into: How to we handle the initialization of the CS line? As we now made internal CS lines possible, we can not really call `init_gpio()` inside a device driver initialization section anymore - as we might be using internal CS lines, which have a different init sequence. Now thinking out loud: how about we expand the SPI interface with CS handling funcions:
int spi_cs_init(spi_t dev, spi_cs_t cs, spi_cs_pol_t pol);
static void spi_cs_on(spi_t dev, spi_cs_t);
static void spi_cs_off(spi_t dev, cpi_cs_t);
In the simplest case, init would call `gpio_init`, and `on/off` would call `gpio_clear/set`. In the case the first parameter would not be needed. But I think in cases for HW CS we might need it?! Furthermore the on/off functions should probably just be internal functions for the SPI driver implementation, as they are only used internal...
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications