From d815c93010653c1d61c5d6b2ed795705f47abd99 Mon Sep 17 00:00:00 2001 From: Maksym Shutiak Date: Thu, 5 Sep 2024 12:43:24 +0300 Subject: [PATCH 1/2] bugfix: naming in variables for builtin buttons and leds --- templates/blinky/nRF52840dk/hal.h | 16 ++++++++-------- templates/blinky/nRF52840dk/main.c | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/templates/blinky/nRF52840dk/hal.h b/templates/blinky/nRF52840dk/hal.h index be84040..252009f 100644 --- a/templates/blinky/nRF52840dk/hal.h +++ b/templates/blinky/nRF52840dk/hal.h @@ -1,14 +1,14 @@ #define P0 ((struct gpio *) 0x50000000) #define P1 ((struct gpio *) 0x50000300) -#define BUILD_IN_BUTTON_4_PIN 25 -#define BUILD_IN_BUTTON_3_PIN 24 -#define BUILD_IN_BUTTON_2_PIN 12 -#define BUILD_IN_BUTTON_1_PIN 11 -#define BUILD_IN_LED_1_PIN 13 -#define BUILD_IN_LED_2_PIN 14 -#define BUILD_IN_LED_3_PIN 15 -#define BUILD_IN_LED_4_PIN 16 +#define BUILT_IN_BUTTON_4_PIN 25 +#define BUILT_IN_BUTTON_3_PIN 24 +#define BUILT_IN_BUTTON_2_PIN 12 +#define BUILT_IN_BUTTON_1_PIN 11 +#define BUILT_IN_LED_1_PIN 13 +#define BUILT_IN_LED_2_PIN 14 +#define BUILT_IN_LED_3_PIN 15 +#define BUILT_IN_LED_4_PIN 16 enum { GPIO_MODE_INPUT, GPIO_MODE_OUTPUT }; enum { LOW, HIGH }; diff --git a/templates/blinky/nRF52840dk/main.c b/templates/blinky/nRF52840dk/main.c index 135763f..773c902 100644 --- a/templates/blinky/nRF52840dk/main.c +++ b/templates/blinky/nRF52840dk/main.c @@ -2,21 +2,21 @@ #include "hal.h" int main(void) { - set_gpio_mode(P0, BUILD_IN_LED_1_PIN, GPIO_MODE_OUTPUT, 0); - set_gpio_mode(P0, BUILD_IN_LED_2_PIN, GPIO_MODE_OUTPUT, 0); - set_gpio_mode(P0, BUILD_IN_LED_3_PIN, GPIO_MODE_OUTPUT, 0); - set_gpio_mode(P0, BUILD_IN_LED_4_PIN, GPIO_MODE_OUTPUT, 0); + set_gpio_mode(P0, BUILT_IN_LED_1_PIN, GPIO_MODE_OUTPUT, 0); + set_gpio_mode(P0, BUILT_IN_LED_2_PIN, GPIO_MODE_OUTPUT, 0); + set_gpio_mode(P0, BUILT_IN_LED_3_PIN, GPIO_MODE_OUTPUT, 0); + set_gpio_mode(P0, BUILT_IN_LED_4_PIN, GPIO_MODE_OUTPUT, 0); while (1) { - gpio_write(P0, BUILD_IN_LED_1_PIN, HIGH); - gpio_write(P0, BUILD_IN_LED_2_PIN, HIGH); - gpio_write(P0, BUILD_IN_LED_3_PIN, HIGH); - gpio_write(P0, BUILD_IN_LED_4_PIN, HIGH); + gpio_write(P0, BUILT_IN_LED_1_PIN, HIGH); + gpio_write(P0, BUILT_IN_LED_2_PIN, HIGH); + gpio_write(P0, BUILT_IN_LED_3_PIN, HIGH); + gpio_write(P0, BUILT_IN_LED_4_PIN, HIGH); spin(9999999); - gpio_write(P0, BUILD_IN_LED_4_PIN, LOW); - gpio_write(P0, BUILD_IN_LED_3_PIN, LOW); - gpio_write(P0, BUILD_IN_LED_2_PIN, LOW); - gpio_write(P0, BUILD_IN_LED_1_PIN, LOW); + gpio_write(P0, BUILT_IN_LED_4_PIN, LOW); + gpio_write(P0, BUILT_IN_LED_3_PIN, LOW); + gpio_write(P0, BUILT_IN_LED_2_PIN, LOW); + gpio_write(P0, BUILT_IN_LED_1_PIN, LOW); spin(9999999); } } @@ -34,7 +34,7 @@ __attribute__((naked, noreturn)) void _reset(void) { extern void _estack(void); // Defined in link.ld -// 16 standard and 42 nRF52-specific handlers +// 16 standard and 91 STM32-specific handlers __attribute__((section(".vectors"))) void (*const tab[16 + 42])(void) = { _estack, _reset}; From 3a237e4a8d80cf8e64e384a9c5da19aca9b1deda Mon Sep 17 00:00:00 2001 From: Maksym Shutiak Date: Thu, 5 Sep 2024 14:10:07 +0300 Subject: [PATCH 2/2] bugfix: naming in variables for builtin buttons and leds --- templates/blinky/nRF52840dk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/blinky/nRF52840dk/main.c b/templates/blinky/nRF52840dk/main.c index 773c902..f52a539 100644 --- a/templates/blinky/nRF52840dk/main.c +++ b/templates/blinky/nRF52840dk/main.c @@ -34,7 +34,7 @@ __attribute__((naked, noreturn)) void _reset(void) { extern void _estack(void); // Defined in link.ld -// 16 standard and 91 STM32-specific handlers +// 16 standard and 42 nRF-specific handlers __attribute__((section(".vectors"))) void (*const tab[16 + 42])(void) = { _estack, _reset};