mbed code for Farrari board

Dependencies:   DDRO_Farrari mbed

Fork of DDRO_Farrari by Liangzhen Lai

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

00001 #ifndef MAIN_H
00002 #define MAIN_H
00003 
00004 extern "C" void mbed_reset();
00005 extern "C" void HardFault_Handler() { mbed_reset(); }
00006 class Watchdog {
00007 public:
00008 // Load timeout value in watchdog timer and enable
00009     void kick(float s) {
00010         LPC_WDT->WDCLKSEL = 0x1;                // Set CLK src to PCLK  
00011         uint32_t clk = SystemCoreClock / 16;    // WD has a fixed /4 prescaler, PCLK default is /4
00012         LPC_WDT->WDTC = s * (float)clk;
00013         LPC_WDT->WDMOD = 0x3;                   // Enabled and Reset
00014         kick();
00015     }
00016 // "kick" or "feed" the dog - reset the watchdog timer
00017 // by writing this required bit pattern
00018     void kick() {
00019         LPC_WDT->WDFEED = 0xAA;
00020         LPC_WDT->WDFEED = 0x55;
00021     }
00022 };
00023 Watchdog wdt;
00024 
00025 void DDRO_Sensor(JTAG &jtag);
00026 int check_FFT_Freq(JTAG &jtag, int fMHz);
00027 #endif