econotag: add an option to use the watchdog timer

This commit is contained in:
Mariano Alvira 2011-03-22 16:35:54 -04:00
parent 11f5bca7c4
commit 0af24040f1
2 changed files with 17 additions and 0 deletions

View file

@ -87,6 +87,12 @@
#define BLOCKING_TX 1
#define NULLRDC_CONF_802154_AUTOACK_HW 1
#define USE_WDT 0
#ifndef WDT_TIMEOUT
#define WDT_TIMEOUT 5000 /* watchdog timeout in ms */
#endif
/* end of mc1322x specific config. */
/* start of conitki config. */

View file

@ -203,6 +203,13 @@ init_lowlevel(void)
*CRM_RTC_TIMEOUT = cal_rtc_secs * 10;
#endif
#if (USE_WDT == 1)
/* set the watchdog timer timeout to 1 sec */
cop_timeout_ms(WDT_TIMEOUT);
/* enable the watchdog timer */
CRM->COP_CNTLbits.COP_EN = 1;
#endif
/* XXX debug */
/* trigger periodic rtc int */
// clear_rtc_wu_evt();
@ -479,6 +486,10 @@ main(void)
while(1) {
check_maca();
#if (USE_WDT == 1)
cop_service();
#endif
/* TODO: replace this with a uart rx interrupt */
if(uart1_input_handler != NULL) {
if(uart1_can_get()) {