Remove BIT macro
This commit is contained in:
@@ -21,7 +21,6 @@ struct gpio {
|
|||||||
#define GPIO_PORT_OFFSET (0x400U)
|
#define GPIO_PORT_OFFSET (0x400U)
|
||||||
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
|
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
|
||||||
|
|
||||||
#define BIT(x) (1 << x)
|
|
||||||
// Create a 16bit number from a port and pin
|
// Create a 16bit number from a port and pin
|
||||||
#define PIN(port, num) ((((port) - 'A') << 8) | num)
|
#define PIN(port, num) ((((port) - 'A') << 8) | num)
|
||||||
// get the lower byte from a PIN
|
// get the lower byte from a PIN
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ int main(void) {
|
|||||||
(void) tim4_start();
|
(void) tim4_start();
|
||||||
|
|
||||||
uint16_t led = PIN('C', 13); // Blue LED
|
uint16_t led = PIN('C', 13); // Blue LED
|
||||||
RCC->AHB1ENR |= BIT(PINPORT(led)); // Enable GPIO clock for LED
|
RCC->AHB1ENR |= (1 << PINPORT(led)); // Enable GPIO clock for LED
|
||||||
gpio_set_mode(led, GPIO_MODE_OUTPUT); // Set blue LED to output mode
|
gpio_set_mode(led, GPIO_MODE_OUTPUT); // Set blue LED to output mode
|
||||||
|
|
||||||
uint16_t counter = TIM4->CNT;
|
uint16_t counter = TIM4->CNT;
|
||||||
|
|||||||
Reference in New Issue
Block a user