aboutsummaryrefslogtreecommitdiffstats
path: root/demos/AVR-AT90CANx-GCC/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'demos/AVR-AT90CANx-GCC/main.c')
-rw-r--r--demos/AVR-AT90CANx-GCC/main.c32
1 files changed, 8 insertions, 24 deletions
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.
@@ -65,19 +53,15 @@ 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;
}