Skip to content
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

Add board_init2 and board_teardown2 #304

Merged
merged 1 commit into from
May 26, 2023
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
11 changes: 9 additions & 2 deletions src/boards/boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ bool button_pressed(uint32_t pin)
}

// This is declared so that a board specific init can be called from here.
void __attribute__((weak)) board_init_extra(void) { }
void __attribute__((weak)) board_init2(void) { }

void board_init(void)
{
// stop LF clock just in case we jump from application without reset
Expand Down Expand Up @@ -96,7 +97,7 @@ void board_init(void)
NRF_POWER->DCDCEN = 1;
#endif
// Make sure any custom inits are performed
board_init_extra();
board_init2();

// When board is supplied on VDDH (and not VDD), this specifies what voltage the GPIO should run at
// and what voltage is output at VDD. The default (0xffffffff) is 1.8V; typically you'll want
Expand Down Expand Up @@ -129,6 +130,9 @@ void board_init(void)
SysTick_Config(SystemCoreClock/1000);
}

// Actions at the end of board_teardown.
void __attribute__((weak)) board_teardown2(void) { }

void board_teardown(void)
{
// Disable systick, turn off LEDs
Expand Down Expand Up @@ -159,6 +163,9 @@ void board_teardown(void)
{
nrf_gpio_cfg_default(i);
}

// board specific teardown actions
board_teardown2();
}

static uint32_t _systick_count = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/boards/challenger_840_ble/pinconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const uint32_t bootloaderConfig[] =
/* CF2 END */
};

void board_init_extra(void)
void board_init2(void)
{
// Turn LDO on
nrf_gpio_cfg_output(LDO_CONTROL_PIN);
Expand Down