1
0
mirror of https://github.com/peterantypas/maiana.git synced 2025-05-31 23:00:16 -07:00

Added wathcdog timer

This commit is contained in:
Peter Antypas 2016-05-30 15:18:21 -07:00
parent 9e998f9e4e
commit 4e00dfa159
4 changed files with 12 additions and 8 deletions

View File

@ -171,7 +171,7 @@
</fileInfo> </fileInfo>
<sourceEntries> <sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry excluding="src/stm32f3-stdperiph/stm32f30x_wwdg.c|src/stm32f3-stdperiph/stm32f30x_rtc.c|src/stm32f3-stdperiph/stm32f30x_pwr.c|src/stm32f3-stdperiph/stm32f30x_opamp.c|src/stm32f3-stdperiph/stm32f30x_iwdg.c|src/stm32f3-stdperiph/stm32f30x_flash.c|src/stm32f3-stdperiph/stm32f30x_dma.c|src/stm32f3-stdperiph/stm32f30x_dbgmcu.c|src/stm32f3-stdperiph/stm32f30x_dac.c|src/stm32f3-stdperiph/stm32f30x_crc.c|src/stm32f3-stdperiph/stm32f30x_comp.c|src/stm32f3-stdperiph/stm32f30x_can.c|src/stm32f3-stdperiph/stm32f30x_adc.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/> <entry excluding="src/stm32f3-stdperiph/stm32f30x_wwdg.c|src/stm32f3-stdperiph/stm32f30x_rtc.c|src/stm32f3-stdperiph/stm32f30x_pwr.c|src/stm32f3-stdperiph/stm32f30x_opamp.c|src/stm32f3-stdperiph/stm32f30x_flash.c|src/stm32f3-stdperiph/stm32f30x_dma.c|src/stm32f3-stdperiph/stm32f30x_dbgmcu.c|src/stm32f3-stdperiph/stm32f30x_dac.c|src/stm32f3-stdperiph/stm32f30x_crc.c|src/stm32f3-stdperiph/stm32f30x_comp.c|src/stm32f3-stdperiph/stm32f30x_can.c|src/stm32f3-stdperiph/stm32f30x_adc.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>
@ -333,7 +333,7 @@
</fileInfo> </fileInfo>
<sourceEntries> <sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry excluding="src/stm32f3-stdperiph/stm32f30x_wwdg.c|src/stm32f3-stdperiph/stm32f30x_rtc.c|src/stm32f3-stdperiph/stm32f30x_pwr.c|src/stm32f3-stdperiph/stm32f30x_opamp.c|src/stm32f3-stdperiph/stm32f30x_iwdg.c|src/stm32f3-stdperiph/stm32f30x_flash.c|src/stm32f3-stdperiph/stm32f30x_dma.c|src/stm32f3-stdperiph/stm32f30x_dbgmcu.c|src/stm32f3-stdperiph/stm32f30x_dac.c|src/stm32f3-stdperiph/stm32f30x_crc.c|src/stm32f3-stdperiph/stm32f30x_comp.c|src/stm32f3-stdperiph/stm32f30x_can.c|src/stm32f3-stdperiph/stm32f30x_adc.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/> <entry excluding="src/stm32f3-stdperiph/stm32f30x_wwdg.c|src/stm32f3-stdperiph/stm32f30x_rtc.c|src/stm32f3-stdperiph/stm32f30x_pwr.c|src/stm32f3-stdperiph/stm32f30x_opamp.c|src/stm32f3-stdperiph/stm32f30x_flash.c|src/stm32f3-stdperiph/stm32f30x_dma.c|src/stm32f3-stdperiph/stm32f30x_dbgmcu.c|src/stm32f3-stdperiph/stm32f30x_dac.c|src/stm32f3-stdperiph/stm32f30x_crc.c|src/stm32f3-stdperiph/stm32f30x_comp.c|src/stm32f3-stdperiph/stm32f30x_can.c|src/stm32f3-stdperiph/stm32f30x_adc.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>

View File

@ -37,7 +37,7 @@ public:
void push(Event* event); void push(Event* event);
/* /*
* This method must be called repeatedly either by main() or some timer ISR. * This method must be called repeatedly by main() (never an ISR!!!!!!)
*/ */
void dispatch(); void dispatch();
private: private:

View File

@ -61,7 +61,6 @@
// Maximum allowed backlog in TX queue // Maximum allowed backlog in TX queue
#define MAX_TX_PACKETS_IN_QUEUE 4 #define MAX_TX_PACKETS_IN_QUEUE 4
// Define this to set BT=0.4 for GMSK (as per ITU spec for AIS). Default is 0.5 // Define this to set BT=0.4 for GMSK (as per ITU spec for AIS). Default is 0.5
#define USE_BT_04 #define USE_BT_04
@ -71,9 +70,6 @@
// Default interval for message 24 A&B (static data report) // Default interval for message 24 A&B (static data report)
#define MSG_24_TX_INTERVAL 180 #define MSG_24_TX_INTERVAL 180
// Maximum number of seconds to spend in CCA mode before giving up transmission of current packet (must be less than DEFAULT_TX_INTERVAL)
#define MAX_CCA_TIME 20
#define CCA_SLOT_BIT 8 #define CCA_SLOT_BIT 8
// Extra debugging using halting assertions // Extra debugging using halting assertions

View File

@ -103,10 +103,18 @@ main(int argc, char* argv[])
configureUnusedPins(); configureUnusedPins();
// Dispatch events issued by ISRs // Configure the watchdog timer
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(IWDG_Prescaler_32);
IWDG_SetReload(4095); // Max 12-bit value
IWDG_Enable();
// Dispatch events issued by ISRs and keep the watchdog happy
printf2("Starting main event loop\r\n"); printf2("Starting main event loop\r\n");
while (true) { while (true) {
EventQueue::instance().dispatch(); EventQueue::instance().dispatch();
IWDG_ReloadCounter();
} }
// If execution jumps here, something is seriously fucked up!!! // If execution jumps here, something is seriously fucked up!!!