[riot-notifications] [RIOT] drivers/spi: updated SPI driver interface (#3216)
notifications at github.com
Fri Jun 26 11:07:47 CEST 2015
I think I had one idea more: How about we define a new type for the additional spi transfer function parameter, maybe `spi_cs_t` or something. This type MUST be defined in a way, that `gpio_t` can be cast onto it, but it further allows for additional values. So say the GPIO's are identified by positive integers (`GPIO_0 := 0; GPIO_1 :=1, ..., GPIO_UNDEF := -1`), you could add values as `SPI_CS_HW0 := -2, SPI_CS_HW1 := -3`, ..., SPI_CS_NOCS := INT_MIN` and so on. These values should be of course defined on a CPU basis with whatever values that are the most efficient on a platform. So in a driver device descriptor, you'd have:
which you can initialize by either
dev_init(..., (spi_cs_t)GPIO(x,y), ...);
dev_init(..., SPI_CS_HW(x), ...);
What do you think?
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications