Skip to content

Commit 4d35ae6

Browse files
MaksymShutiakcpq
authored andcommitted
bugfix: naming in variables for builtin buttons and leds
1 parent 4e81d44 commit 4d35ae6

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

templates/blinky/nRF52840dk/hal.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#define P0 ((struct gpio *) 0x50000000)
22
#define P1 ((struct gpio *) 0x50000300)
33

4-
#define BUILD_IN_BUTTON_4_PIN 25
5-
#define BUILD_IN_BUTTON_3_PIN 24
6-
#define BUILD_IN_BUTTON_2_PIN 12
7-
#define BUILD_IN_BUTTON_1_PIN 11
8-
#define BUILD_IN_LED_1_PIN 13
9-
#define BUILD_IN_LED_2_PIN 14
10-
#define BUILD_IN_LED_3_PIN 15
11-
#define BUILD_IN_LED_4_PIN 16
4+
#define BUILT_IN_BUTTON_4_PIN 25
5+
#define BUILT_IN_BUTTON_3_PIN 24
6+
#define BUILT_IN_BUTTON_2_PIN 12
7+
#define BUILT_IN_BUTTON_1_PIN 11
8+
#define BUILT_IN_LED_1_PIN 13
9+
#define BUILT_IN_LED_2_PIN 14
10+
#define BUILT_IN_LED_3_PIN 15
11+
#define BUILT_IN_LED_4_PIN 16
1212

1313
enum { GPIO_MODE_INPUT, GPIO_MODE_OUTPUT };
1414
enum { LOW, HIGH };

templates/blinky/nRF52840dk/main.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
#include "hal.h"
33

44
int main(void) {
5-
set_gpio_mode(P0, BUILD_IN_LED_1_PIN, GPIO_MODE_OUTPUT, 0);
6-
set_gpio_mode(P0, BUILD_IN_LED_2_PIN, GPIO_MODE_OUTPUT, 0);
7-
set_gpio_mode(P0, BUILD_IN_LED_3_PIN, GPIO_MODE_OUTPUT, 0);
8-
set_gpio_mode(P0, BUILD_IN_LED_4_PIN, GPIO_MODE_OUTPUT, 0);
5+
set_gpio_mode(P0, BUILT_IN_LED_1_PIN, GPIO_MODE_OUTPUT, 0);
6+
set_gpio_mode(P0, BUILT_IN_LED_2_PIN, GPIO_MODE_OUTPUT, 0);
7+
set_gpio_mode(P0, BUILT_IN_LED_3_PIN, GPIO_MODE_OUTPUT, 0);
8+
set_gpio_mode(P0, BUILT_IN_LED_4_PIN, GPIO_MODE_OUTPUT, 0);
99

1010
while (1) {
11-
gpio_write(P0, BUILD_IN_LED_1_PIN, HIGH);
12-
gpio_write(P0, BUILD_IN_LED_2_PIN, HIGH);
13-
gpio_write(P0, BUILD_IN_LED_3_PIN, HIGH);
14-
gpio_write(P0, BUILD_IN_LED_4_PIN, HIGH);
11+
gpio_write(P0, BUILT_IN_LED_1_PIN, HIGH);
12+
gpio_write(P0, BUILT_IN_LED_2_PIN, HIGH);
13+
gpio_write(P0, BUILT_IN_LED_3_PIN, HIGH);
14+
gpio_write(P0, BUILT_IN_LED_4_PIN, HIGH);
1515
spin(9999999);
16-
gpio_write(P0, BUILD_IN_LED_4_PIN, LOW);
17-
gpio_write(P0, BUILD_IN_LED_3_PIN, LOW);
18-
gpio_write(P0, BUILD_IN_LED_2_PIN, LOW);
19-
gpio_write(P0, BUILD_IN_LED_1_PIN, LOW);
16+
gpio_write(P0, BUILT_IN_LED_4_PIN, LOW);
17+
gpio_write(P0, BUILT_IN_LED_3_PIN, LOW);
18+
gpio_write(P0, BUILT_IN_LED_2_PIN, LOW);
19+
gpio_write(P0, BUILT_IN_LED_1_PIN, LOW);
2020
spin(9999999);
2121
}
2222
}
@@ -34,7 +34,7 @@ __attribute__((naked, noreturn)) void _reset(void) {
3434

3535
extern void _estack(void); // Defined in link.ld
3636

37-
// 16 standard and 42 nRF52-specific handlers
37+
// 16 standard and 91 STM32-specific handlers
3838
__attribute__((section(".vectors"))) void (*const tab[16 + 42])(void) = {
3939
_estack, _reset};
4040

0 commit comments

Comments
 (0)