1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #include "ch.h"
- #include "hal.h"
- #include "chprintf.h"
- BaseSequentialStream *chp = (BaseSequentialStream *) &SD1;
- static const WDGConfig wdgcfg = {
- false,
- WDT_PER_1KCLK_gc,
- WDT_WPER_1KCLK_gc
- };
- int main(void) {
-
- halInit();
- chSysInit();
-
- palSetPadMode(IOPORT3, PIN3, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(IOPORT3, PIN2, PAL_MODE_INPUT_PULLUP);
-
- sdStart(&SD1, NULL);
-
- wdgStart(&WDTD1, &wdgcfg);
- chprintf(chp, "Watchdog driver test program.\r\n");
-
- while (TRUE) {
- chprintf(chp, "Watchdog reset by software.\r\n");
- wdgReset(&WDTD1);
-
-
- palTogglePad(IOPORT5, PORTE_LED);
- chThdSleepMilliseconds(500);
- }
- return 0;
- }
|