arch: add PIN_{INPUT,OUTPUT}_* macros These can be used to construct the PORT and DDR register values in more semantically readable way. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 11 insertions(+), 0 deletions(-) M arch.h
M arch.h +11 -0
@@ 39,6 39,17 @@ #define STATIC_ASSERT(c) _Static_assert(c, #c) #define mmregs ((volatile struct mmregs_layout * volatile) (void *) 0x0) + +/* + * Macros to construct PORT and DDR register values + */ +#define PIN_INPUT_PORT_Z(bit) 0 +#define PIN_INPUT_PORT_H(bit) (1 << (bit)) +#define PIN_INPUT_DDR(bit) 0 +#define PIN_OUTPUT_PORT_H(bit) (1 << (bit)) +#define PIN_OUTPUT_PORT_L(bit) 0 +#define PIN_OUTPUT_DDR(bit) (1 << (bit)) + #endif #endif