aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARM7-LPC214x-G++
diff options
context:
space:
mode:
Diffstat (limited to 'demos/ARM7-LPC214x-G++')
-rw-r--r--demos/ARM7-LPC214x-G++/board.c11
-rw-r--r--demos/ARM7-LPC214x-G++/board.h26
-rw-r--r--demos/ARM7-LPC214x-G++/main.cpp22
3 files changed, 29 insertions, 30 deletions
diff --git a/demos/ARM7-LPC214x-G++/board.c b/demos/ARM7-LPC214x-G++/board.c
index f188372b3..c3c39a5a9 100644
--- a/demos/ARM7-LPC214x-G++/board.c
+++ b/demos/ARM7-LPC214x-G++/board.c
@@ -18,6 +18,7 @@
*/
#include <ch.h>
+#include <pal.h>
#include "lpc214x.h"
#include "vic.h"
@@ -103,11 +104,11 @@ void hwinit0(void) {
PINSEL0 = VAL_PINSEL0;
PINSEL1 = VAL_PINSEL1;
PINSEL2 = VAL_PINSEL2;
- ioport_init_lld();
- ioport_lpc214x_set_direction_lld(IOPORT_A, VAL_FIO0DIR);
- ioport_write_lld(IOPORT_A, 0xFFFFFFFF);
- ioport_lpc214x_set_direction_lld(IOPORT_B, VAL_FIO1DIR);
- ioport_write_lld(IOPORT_B, 0xFFFFFFFF);
+ palInit();
+ pal_lld_lpc214x_set_direction(IOPORT_A, VAL_FIO0DIR);
+ palWritePort(IOPORT_A, 0xFFFFFFFF);
+ pal_lld_lpc214x_set_direction(IOPORT_B, VAL_FIO1DIR);
+ palWritePort(IOPORT_B, 0xFFFFFFFF);
}
/*
diff --git a/demos/ARM7-LPC214x-G++/board.h b/demos/ARM7-LPC214x-G++/board.h
index ee30559c8..fee4baa61 100644
--- a/demos/ARM7-LPC214x-G++/board.h
+++ b/demos/ARM7-LPC214x-G++/board.h
@@ -24,10 +24,6 @@
#include "lpc214x.h"
#endif
-#ifndef _IOPORTS_LLD_H_
-#include "ioports.h"
-#endif
-
#define BOARD_OLIMEX_LCP_P2148
/*
@@ -69,17 +65,17 @@
#define VAL_FIO0DIR 0xB0703C00
#define VAL_FIO1DIR 0x00000000
-#define PA_LED1 IOPORT_BIT(10)
-#define PA_LED2 IOPORT_BIT(11)
-#define PA_BUZZ1 IOPORT_BIT(12)
-#define PA_BUZZ2 IOPORT_BIT(13)
-#define PA_BSL IOPORT_BIT(14)
-#define PA_BUTTON1 IOPORT_BIT(15)
-#define PA_BUTTON2 IOPORT_BIT(16)
-#define PA_SSEL1 IOPORT_BIT(20)
-#define PA_LEDUSB IOPORT_BIT(31)
+#define PA_LED1 10
+#define PA_LED2 11
+#define PA_BUZZ1 12
+#define PA_BUZZ2 13
+#define PA_BSL 14
+#define PA_BUTTON1 15
+#define PA_BUTTON2 16
+#define PA_SSEL1 20
+#define PA_LEDUSB 31
-#define PB_WP1 IOPORT_BIT(24)
-#define PB_CP1 IOPORT_BIT(25)
+#define PB_WP1 24
+#define PB_CP1 25
#endif /* _BOARD_H_ */
diff --git a/demos/ARM7-LPC214x-G++/main.cpp b/demos/ARM7-LPC214x-G++/main.cpp
index 1a50f5936..683c2675d 100644
--- a/demos/ARM7-LPC214x-G++/main.cpp
+++ b/demos/ARM7-LPC214x-G++/main.cpp
@@ -18,7 +18,7 @@
*/
#include <ch.hpp>
-#include <ioports.h>
+#include <pal.h>
#include <evtimer.h>
#include <test.h>
@@ -26,6 +26,8 @@
#include <board.h>
#include <lpc214x_serial.h>
+#define BOTH_BUTTONS (PAL_PORT_BIT(PA_BUTTON1) | PAL_PORT_BIT(PA_BUTTON2))
+
using namespace chibios_rt;
/*
@@ -48,9 +50,9 @@ typedef struct {
// Flashing sequence for LED1.
static const seqop_t LED1_sequence[] =
{
- {BITCLEAR, PA_LED1},
+ {BITCLEAR, PAL_PORT_BIT(PA_LED1)},
{SLEEP, 200},
- {BITSET, PA_LED1},
+ {BITSET, PAL_PORT_BIT(PA_LED1)},
{SLEEP, 1800},
{GOTO, 0}
};
@@ -59,9 +61,9 @@ static const seqop_t LED1_sequence[] =
static const seqop_t LED2_sequence[] =
{
{SLEEP, 1000},
- {BITCLEAR, PA_LED2},
+ {BITCLEAR, PAL_PORT_BIT(PA_LED2)},
{SLEEP, 200},
- {BITSET, PA_LED2},
+ {BITSET, PAL_PORT_BIT(PA_LED2)},
{SLEEP, 1800},
{GOTO, 1}
};
@@ -69,9 +71,9 @@ static const seqop_t LED2_sequence[] =
// Flashing sequence for LED3.
static const seqop_t LED3_sequence[] =
{
- {BITCLEAR, PA_LEDUSB},
+ {BITCLEAR, PAL_PORT_BIT(PA_LEDUSB)},
{SLEEP, 200},
- {BITSET, PA_LEDUSB},
+ {BITSET, PAL_PORT_BIT(PA_LEDUSB)},
{SLEEP, 300},
{GOTO, 0}
};
@@ -98,10 +100,10 @@ protected:
case STOP:
return 0;
case BITCLEAR:
- chPortClear(IOPORT_A, curr->value);
+ palClearPort(IOPORT_A, curr->value);
break;
case BITSET:
- chPortSet(IOPORT_A, curr->value);
+ palSetPort(IOPORT_A, curr->value);
break;
}
curr++;
@@ -136,7 +138,7 @@ public:
*/
static void TimerHandler(eventid_t id) {
- if (!(chPortRead(IOPORT_A) & (PA_BUTTON1 | PA_BUTTON2))) { // Both buttons
+ if (!(palReadPort(IOPORT_A) & BOTH_BUTTONS)) { // Both buttons
TesterThread tester;
tester.Wait();
};