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 ++++++++------------------------ demos/AVR-ATmega128-GCC/main.c | 30 ++++++------------------------ 2 files changed, 14 insertions(+), 48 deletions(-) (limited to 'demos') 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; } diff --git a/demos/AVR-ATmega128-GCC/main.c b/demos/AVR-ATmega128-GCC/main.c index cd982d1b9..36b482c4b 100644 --- a/demos/AVR-ATmega128-GCC/main.c +++ b/demos/AVR-ATmega128-GCC/main.c @@ -20,7 +20,7 @@ #include "ch.h" #include "hal.h" -#include "evtimer.h" +#include "test.h" #include "lcd.h" @@ -35,22 +35,10 @@ static msg_t Thread1(void *arg) { return 0; } -static void TimerHandler(eventid_t id) { - msg_t TestThread(void *p); - - if (!palReadPad(IOPORT1, PORTA_BUTTON1)) - TestThread(&SD2); -} - /* * Application entry point. */ int main(void) { - static EvTimer evt; - static evhandler_t handlers[1] = { - TimerHandler - }; - static EventListener el0; /* * System initializations. @@ -76,20 +64,14 @@ int main(void) { lcdPuts(LCD_LINE1, " ChibiOS/RT "); lcdPuts(LCD_LINE2, " Hello World! "); - /* - * 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)); - - return 0; + while(TRUE) { + if (!palReadPad(IOPORT1, PORTA_BUTTON1)) + TestThread(&SD2); + chThdSleepMilliseconds(500); + } } -- cgit v1.2.3