Skip to content

bugfix: naming in variables for builtin buttons and leds #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions templates/blinky/nRF52840dk/hal.h
Original file line number Diff line number Diff line change
@@ -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 };
Expand Down
26 changes: 13 additions & 13 deletions templates/blinky/nRF52840dk/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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 42 nRF-specific handlers
__attribute__((section(".vectors"))) void (*const tab[16 + 42])(void) = {
_estack, _reset};

Loading