[En-Nut-Discussion] Where to export NUTDEVICEs?
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Thu Dec 10 16:11:37 CET 2015
Hello,
at the moment, different UART devices are declared in different include
files. E.g.:
./include/dev/usartat91.h:extern NUTDEVICE devDbguAt91;
./include/dev/unix_devs.h: extern NUTDEVICE devUsartAvr2;
./include/dev/uartgba.h:extern NUTDEVICE devUartGba;
/include/dev/usartstm32.h:extern NUTDEVICE devUsartStm32_1;
./include/dev/usartavr32.h:extern NUTDEVICE devUsartAvr320;
Any usart with the right hardware connection can do one-wire transfers. I
am reworking dev/owibus_uart.c and would like to be able to select the usart
device with the configurator with something like
#if defined(OWI0_UART)
static NUTOWIINFO_UART owcb0 = {
OWI0_UART, /*!< \brief Uart to use, e.g, set by configurator */
in dev/owibus_uart.c
The configuration has:
OWI0_UART = "devUsartStm32_1"
and generates in include/cfg/owi.h
#ifndef OWI0_UART
#define OWI0_UART devUsartStm32_1
#endif
However to compile dev/owibus_uart.c, OWI0_UART ("devUsartStm32_1") or what
else the user has given will need to be resolved. This would need
dev/owibus_uart.c to include _all_ of the include files mentioned
above. This doesn't sound right.
My solution would be either to declare all uart NUTDEVICEs in
include/dev/uart.h or to include all above include files in
include/dev/uart.h.
Is there someting fundamantal wrong with that approach?
Any other generic way to have the user set OWI0_UART with the configurator?
Thanks
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------
More information about the En-Nut-Discussion
mailing list