Add PORT macro
And use it in the `PIN` macro
This commit is contained in:
@@ -2004,7 +2004,9 @@ struct gpio {
|
||||
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
|
||||
|
||||
|
||||
#define PIN(port,num) ((((port) - 'A') << 8) | num)
|
||||
#define PORT(port) (((port) - 'A') << 8)
|
||||
|
||||
#define PIN(port,num) (PORT(port) | num)
|
||||
|
||||
#define PINNUM(pin) (pin & 0b1111)
|
||||
|
||||
@@ -2019,9 +2021,9 @@ typedef enum {
|
||||
|
||||
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
|
||||
void gpio_write(uint16_t pin,
|
||||
# 39 "src/gpio.h" 3 4
|
||||
# 41 "src/gpio.h" 3 4
|
||||
_Bool
|
||||
# 39 "src/gpio.h"
|
||||
# 41 "src/gpio.h"
|
||||
val);
|
||||
# 5 "src/gpio.c" 2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user