From 36d1e0978ac7cce6074470ac5a09d14b9986f922 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 10 Oct 2011 18:08:37 +0000 Subject: Finalized AVR PAL driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3441 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/AVR-AT90CANx-GCC/main.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'demos/AVR-AT90CANx-GCC/main.c') diff --git a/demos/AVR-AT90CANx-GCC/main.c b/demos/AVR-AT90CANx-GCC/main.c index d039c6cf6..50d43a7f9 100644 --- a/demos/AVR-AT90CANx-GCC/main.c +++ b/demos/AVR-AT90CANx-GCC/main.c @@ -20,34 +20,22 @@ #include "ch.h" #include "hal.h" -#include "evtimer.h" +#include "test.h" static WORKING_AREA(waThread1, 32); static msg_t Thread1(void *arg) { while (TRUE) { - PORTE ^= PORTE_LED; - chThdSleepMilliseconds(500); + palTogglePad(IOPORT5, PORTE_LED); + chThdSleepMilliseconds(500); } return 0; } -static void TimerHandler(eventid_t id) { - msg_t TestThread(void *p); - - if (!(PORTE & PORTE_BUTTON)) - TestThread(&SD2); -} - /* * Application entry point. */ int main(void) { - static EvTimer evt; - static evhandler_t handlers[1] = { - TimerHandler - }; - static EventListener el0; /* * System initializations. @@ -64,20 +52,16 @@ int main(void) { */ sdStart(&SD2, NULL); - /* - * Event Timer initialization. - */ - evtInit(&evt, MS2ST(500)); /* Initializes an event timer object. */ - evtStart(&evt); /* Starts the event timer. */ - chEvtRegister(&evt.et_es, &el0, 0); /* Registers on the timer event source. */ - /* * Starts the LED blinker thread. */ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); - while(TRUE) - chEvtDispatch(handlers, chEvtWaitOne(ALL_EVENTS)); + while(TRUE) { + if (!palReadPad(IOPORT5, PORTE_BUTTON)) + TestThread(&SD2); + chThdSleepMilliseconds(500); + } return 0; } -- cgit v1.2.3