3 #include "common/utils.h"
5 // return ioTag_t for given pinid
6 // tag for NONE must be false
7 #define DEFIO_TAG(pinid) CONCAT(DEFIO_TAG__, pinid)
8 #define DEFIO_TAG__NONE 0
9 #define DEFIO_TAG_E(pinid) CONCAT(DEFIO_TAG_E__, pinid)
10 #define DEFIO_TAG_E__NONE 0
13 // return ioRec_t or NULL for given pinid
14 // tags should be preferred, possibly removing it in future
15 // io_impl.h must be included when this macro is used
16 #define DEFIO_REC(pinid) CONCAT(DEFIO_REC__, pinid)
17 #define DEFIO_REC__NONE NULL
19 #define DEFIO_IO(pinid) (IO_t)DEFIO_REC(pinid)
20 // TODO - macro to check for pinid NONE (fully in preprocessor)
23 #define DEFIO_REC_INDEXED(idx) (ioRecs + (idx))
25 // ioTag_t accessor macros
26 #define DEFIO_TAG_MAKE(gpioid, pin) ((((gpioid) + 1) << 4) | (pin))
27 #define DEFIO_TAG_ISEMPTY(tag) (!(tag))
28 #define DEFIO_TAG_GPIOID(tag) (((tag) >> 4) - 1)
29 #define DEFIO_TAG_PIN(tag) ((tag) & 0x0f)
31 // TARGET must define used pins
33 // include template-generated macros for IO pins
34 #include "io_def_generated.h"