pull/222/head
Przemek Wirkus 2014-03-19 19:57:29 +00:00
commit c0263fdf4d
7 changed files with 18 additions and 28 deletions

View File

@ -16,7 +16,7 @@
#ifndef MBED_H #ifndef MBED_H
#define MBED_H #define MBED_H
#define MBED_LIBRARY_VERSION 80 #define MBED_LIBRARY_VERSION 81
#include "platform.h" #include "platform.h"

View File

@ -19,11 +19,11 @@
WEAK void mbed_die(void); WEAK void mbed_die(void);
WEAK void mbed_die(void) { WEAK void mbed_die(void) {
#ifndef NRF51_H
__disable_irq(); // dont allow interrupts to disturb the flash pattern __disable_irq(); // dont allow interrupts to disturb the flash pattern
#endif
#if (DEVICE_ERROR_RED == 1) #if (DEVICE_ERROR_RED == 1)
gpio_t led_red; gpio_init_out(&led_red, LED_RED); gpio_t led_red; gpio_init_out(&led_red, LED_RED);
#elif (DEVICE_ERROR_PATTERN == 1) #elif (DEVICE_ERROR_PATTERN == 1)
gpio_t led_1; gpio_init_out(&led_1, LED1); gpio_t led_1; gpio_init_out(&led_1, LED1);
gpio_t led_2; gpio_init_out(&led_2, LED2); gpio_t led_2; gpio_init_out(&led_2, LED2);

View File

@ -18,8 +18,8 @@
static inline void _gpio_init_in(gpio_t* gpio, PinName pin, PinMode mode) static inline void _gpio_init_in(gpio_t* gpio, PinName pin, PinMode mode)
{ {
gpio_init(gpio, pin); gpio_init(gpio, pin);
gpio_mode(gpio, mode);
gpio_dir(gpio, PIN_INPUT); gpio_dir(gpio, PIN_INPUT);
gpio_mode(gpio, mode);
} }
static inline void _gpio_init_out(gpio_t* gpio, PinName pin, PinMode mode, int value) static inline void _gpio_init_out(gpio_t* gpio, PinName pin, PinMode mode, int value)

View File

@ -44,24 +44,11 @@ void SystemCoreClockUpdate(void)
void SystemInit(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 // 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 // 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 // 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 // that do not need it is that the new peripherals in the second generation devices (LPCOMP for
// example) will not be available. // example) will not be available.
if (is_manual_peripheral_setup_needed()){ if (is_manual_peripheral_setup_needed()){
*(uint32_t volatile *)0x40000504 = 0xC007FFDF; *(uint32_t volatile *)0x40000504 = 0xC007FFDF;
*(uint32_t volatile *)0x40006C18 = 0x00008000; *(uint32_t volatile *)0x40006C18 = 0x00008000;

View File

@ -98,13 +98,13 @@ typedef enum {
P0_29 = p29, P0_29 = p29,
P0_30 = p30, P0_30 = p30,
LED1 = p18, LED1 = p18,
LED2 = p19, LED2 = p19,
LED3 = p18, LED3 = p18,
LED4 = p19, LED4 = p19,
BUTTON0 = p16, BUTTON1 = p16,
BUTTON1 = p17, BUTTON2 = p17,
RX_PIN_NUMBER = p11, RX_PIN_NUMBER = p11,
TX_PIN_NUMBER = p9, TX_PIN_NUMBER = p9,

View File

@ -50,6 +50,8 @@
#define DEVICE_STDIO_MESSAGES 0 #define DEVICE_STDIO_MESSAGES 0
#define DEVICE_ERROR_PATTERN 1
#include "objects.h" #include "objects.h"
#endif #endif

View File

@ -29,7 +29,8 @@ volatile uint16_t timeStamp=0;
extern "C" { extern "C" {
#endif #endif
void TIMER1_IRQHandler(void){ void TIMER1_IRQHandler(void){
if ((US_TICKER_TIMER->EVENTS_COMPARE[1] != 0) &&
if ((US_TICKER_TIMER->EVENTS_COMPARE[1] != 0) &&
((US_TICKER_TIMER->INTENSET & TIMER_INTENSET_COMPARE1_Msk) != 0)) ((US_TICKER_TIMER->INTENSET & TIMER_INTENSET_COMPARE1_Msk) != 0))
{ {
US_TICKER_TIMER->EVENTS_COMPARE[1] = 0; US_TICKER_TIMER->EVENTS_COMPARE[1] = 0;