diff --git a/libraries/mbed/api/mbed.h b/libraries/mbed/api/mbed.h index b95b01a9bc..ccfb982183 100644 --- a/libraries/mbed/api/mbed.h +++ b/libraries/mbed/api/mbed.h @@ -16,7 +16,7 @@ #ifndef MBED_H #define MBED_H -#define MBED_LIBRARY_VERSION 80 +#define MBED_LIBRARY_VERSION 81 #include "platform.h" diff --git a/libraries/mbed/common/board.c b/libraries/mbed/common/board.c index eb150eb3b0..ab24b09ec0 100644 --- a/libraries/mbed/common/board.c +++ b/libraries/mbed/common/board.c @@ -19,11 +19,11 @@ WEAK void mbed_die(void); WEAK void mbed_die(void) { +#ifndef NRF51_H __disable_irq(); // dont allow interrupts to disturb the flash pattern - +#endif #if (DEVICE_ERROR_RED == 1) gpio_t led_red; gpio_init_out(&led_red, LED_RED); - #elif (DEVICE_ERROR_PATTERN == 1) gpio_t led_1; gpio_init_out(&led_1, LED1); gpio_t led_2; gpio_init_out(&led_2, LED2); diff --git a/libraries/mbed/common/gpio.c b/libraries/mbed/common/gpio.c index 62de59d4af..1d820268db 100644 --- a/libraries/mbed/common/gpio.c +++ b/libraries/mbed/common/gpio.c @@ -17,9 +17,9 @@ static inline void _gpio_init_in(gpio_t* gpio, PinName pin, PinMode mode) { - gpio_init(gpio, pin); - gpio_mode(gpio, mode); + gpio_init(gpio, pin); gpio_dir(gpio, PIN_INPUT); + gpio_mode(gpio, mode); } static inline void _gpio_init_out(gpio_t* gpio, PinName pin, PinMode mode, int value) diff --git a/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_NRF51822/system_nrf51822.c b/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_NRF51822/system_nrf51822.c index 900b1fda2b..d30ee8a0c0 100644 --- a/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_NRF51822/system_nrf51822.c +++ b/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_NRF51822/system_nrf51822.c @@ -43,25 +43,12 @@ void SystemCoreClockUpdate(void) } void SystemInit(void) -{ - NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos); - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } - //write FWID (NRF_UICR->FWID is readonly) - *(uint32_t *)0x10001010 = 0xFFFF0049; - - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } - - NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos); - while (NRF_NVMC->READY == NVMC_READY_READY_Busy){ - } +{ // Prepare the peripherals for use as indicated by the PAN 26 "System: Manual setup is required // to enable the use of peripherals" found at Product Anomaly document for your device found at // https://www.nordicsemi.com/. The side effect of executing these instructions in the devices // that do not need it is that the new peripherals in the second generation devices (LPCOMP for // example) will not be available. - if (is_manual_peripheral_setup_needed()){ *(uint32_t volatile *)0x40000504 = 0xC007FFDF; *(uint32_t volatile *)0x40006C18 = 0x00008000; diff --git a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/PinNames.h b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/PinNames.h index 91c275b196..031b2ad26a 100644 --- a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/PinNames.h +++ b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/PinNames.h @@ -98,13 +98,13 @@ typedef enum { P0_29 = p29, P0_30 = p30, - LED1 = p18, - LED2 = p19, - LED3 = p18, - LED4 = p19, - - BUTTON0 = p16, - BUTTON1 = p17, + LED1 = p18, + LED2 = p19, + LED3 = p18, + LED4 = p19, + + BUTTON1 = p16, + BUTTON2 = p17, RX_PIN_NUMBER = p11, TX_PIN_NUMBER = p9, diff --git a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/device.h b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/device.h index ee7c664a67..9d5a5e2109 100644 --- a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/device.h +++ b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/device.h @@ -50,6 +50,8 @@ #define DEVICE_STDIO_MESSAGES 0 +#define DEVICE_ERROR_PATTERN 1 + #include "objects.h" #endif diff --git a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/us_ticker.c index a67413d40b..b6b2551753 100644 --- a/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/us_ticker.c @@ -28,8 +28,9 @@ volatile uint16_t timeStamp=0; #ifdef __cplusplus extern "C" { #endif -void TIMER1_IRQHandler(void){ - if ((US_TICKER_TIMER->EVENTS_COMPARE[1] != 0) && +void TIMER1_IRQHandler(void){ + + if ((US_TICKER_TIMER->EVENTS_COMPARE[1] != 0) && ((US_TICKER_TIMER->INTENSET & TIMER_INTENSET_COMPARE1_Msk) != 0)) { US_TICKER_TIMER->EVENTS_COMPARE[1] = 0;