diff options
Diffstat (limited to 'demos/AVR-ATmega128-GCC/main.c')
-rw-r--r-- | demos/AVR-ATmega128-GCC/main.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/demos/AVR-ATmega128-GCC/main.c b/demos/AVR-ATmega128-GCC/main.c index 29a19701b..53fe21b2d 100644 --- a/demos/AVR-ATmega128-GCC/main.c +++ b/demos/AVR-ATmega128-GCC/main.c @@ -24,6 +24,7 @@ #include <avr/io.h>
#include "board.h"
+#include "lcd.h"
void hwinit(void);
@@ -31,7 +32,8 @@ static WorkingArea(waThread1, 32); static msg_t Thread1(void *arg) {
while (TRUE) {
- PORTA ^= PORTA_RELAY;
+ if (!(PINA & PORTA_BUTTON2))
+ PORTA ^= PORTA_RELAY;
chThdSleep(1000);
}
return 0;
@@ -40,7 +42,7 @@ static msg_t Thread1(void *arg) { static void TimerHandler(eventid_t id) {
msg_t TestThread(void *p);
- if (!(PORTA & PORTA_BUTTON1))
+ if (!(PINA & PORTA_BUTTON1))
TestThread(&SER2);
}
@@ -60,6 +62,15 @@ int main(int argc, char **argv) { chSysInit();
/*
+ * This initialization requires the OS already active because it uses delay
+ * APIs inside.
+ */
+ lcdInit();
+ lcdCmd(LCD_CLEAR);
+ lcdPuts(LCD_LINE1, " ChibiOS/RT ");
+ lcdPuts(LCD_LINE2, " Hello World! ");
+
+ /*
* Event Timer initialization.
*/
evtInit(&evt, 500); /* Initializes an event timer object. */
|