ported pca10059
This commit is contained in:
@@ -38,10 +38,11 @@
|
||||
/*------------------------------------------------------------------*/
|
||||
/* MACRO TYPEDEF CONSTANT ENUM
|
||||
*------------------------------------------------------------------*/
|
||||
#define LED_PIN 13
|
||||
#define LED_STATE_ON 0
|
||||
#define LED_PIN 13
|
||||
#define LED_STATE_ON 0
|
||||
|
||||
#define BUTTON_PIN 11
|
||||
#define BUTTON_PIN 11
|
||||
#define BUTTON_STATE_ACTIVE 0
|
||||
|
||||
// tinyusb function that handles power event (detected, ready, removed)
|
||||
// We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled.
|
||||
@@ -49,8 +50,11 @@ extern void tusb_hal_nrf_power_event(uint32_t event);
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
// Config clock source: XTAL or RC in sdk_config.h
|
||||
NRF_CLOCK->LFCLKSRC = (uint32_t)((CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk);
|
||||
// stop LF clock just in case we jump from application without reset
|
||||
NRF_CLOCK->TASKS_LFCLKSTOP = 1UL;
|
||||
|
||||
// Use Internal OSC to compatible with all boards
|
||||
NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_RC;
|
||||
NRF_CLOCK->TASKS_LFCLKSTART = 1UL;
|
||||
|
||||
// LED
|
||||
@@ -116,8 +120,7 @@ void board_led_write(bool state)
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
{
|
||||
// button is active LOW
|
||||
return (nrf_gpio_pin_read(BUTTON_PIN) ? 0 : 1);
|
||||
return BUTTON_STATE_ACTIVE == nrf_gpio_pin_read(BUTTON_PIN);
|
||||
}
|
||||
|
||||
int board_uart_read(uint8_t* buf, int len)
|
||||
|
||||
Reference in New Issue
Block a user