aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boards/EA_LPCXPRESSO_BB_1114/board.c10
-rw-r--r--boards/EA_LPCXPRESSO_BB_1114/board.h14
-rw-r--r--demos/ARMCM0-LPC1114-GCC/Makefile2
-rw-r--r--demos/ARMCM0-LPC1114-GCC/main.c50
-rw-r--r--os/hal/platforms/LPC111x/pal_lld.h4
-rw-r--r--os/hal/platforms/LPC111x/serial_lld.c2
6 files changed, 66 insertions, 16 deletions
diff --git a/boards/EA_LPCXPRESSO_BB_1114/board.c b/boards/EA_LPCXPRESSO_BB_1114/board.c
index 401b0532e..79a2f790c 100644
--- a/boards/EA_LPCXPRESSO_BB_1114/board.c
+++ b/boards/EA_LPCXPRESSO_BB_1114/board.c
@@ -43,9 +43,15 @@ void hwinit1(void) {
halInit();
/*
- * Extra, board-specific, initializations.
+ * Extra, board-specific, initializations.
+ * NOTE: PIO1_2 is associated also to the JTAG, if you need to use JTAG
+ * you must comment that line first.
*/
- LPC_IOCON->PIO0_7 = 0xC0; /* Disables pull-up on LED output. */
+ LPC_IOCON->PIO0_7 = 0xC0; /* Disables pull-up on LED2 output. */
+ LPC_IOCON->JTAG_nTRST_PIO1_2 = 0xC1; /* Disables pull-up on LED3B output
+ and makes it GPIO1_2. */
+ LPC_IOCON->PIO1_9 = 0xC0; /* Disables pull-up on LED3R output.*/
+ LPC_IOCON->PIO1_10 = 0xC0; /* Disables pull-up on LED3G output.*/
/*
* ChibiOS/RT initialization.
diff --git a/boards/EA_LPCXPRESSO_BB_1114/board.h b/boards/EA_LPCXPRESSO_BB_1114/board.h
index 685ab4e64..9c0a6161c 100644
--- a/boards/EA_LPCXPRESSO_BB_1114/board.h
+++ b/boards/EA_LPCXPRESSO_BB_1114/board.h
@@ -40,13 +40,15 @@
* GPIO 0 initial setup.
* Bit7 - LPCxpresso LED, initially output at low level.
*/
-#define VAL_GPIO0DIR 0x00000080
+#define VAL_GPIO0DIR PAL_PORT_BIT(GPIO0_LED2)
#define VAL_GPIO0DATA 0x00000000
/*
* GPIO 1 initial setup.
*/
-#define VAL_GPIO1DIR 0x00000000
+#define VAL_GPIO1DIR PAL_PORT_BIT(GPIO1_LED3B) | \
+ PAL_PORT_BIT(GPIO1_LED3R) | \
+ PAL_PORT_BIT(GPIO1_LED3G)
#define VAL_GPIO1DATA 0x00000000
/*
@@ -64,7 +66,13 @@
/*
* Pin definitions.
*/
-#define GPIO0_LED 7
+#define GPIO0_SW3 1
+#define GPIO0_LED2 7
+
+#define GPIO1_LED3B 2
+#define GPIO1_SW4 4
+#define GPIO1_LED3R 9
+#define GPIO1_LED3G 10
#ifdef __cplusplus
extern "C" {
diff --git a/demos/ARMCM0-LPC1114-GCC/Makefile b/demos/ARMCM0-LPC1114-GCC/Makefile
index e776ab4c5..48383738c 100644
--- a/demos/ARMCM0-LPC1114-GCC/Makefile
+++ b/demos/ARMCM0-LPC1114-GCC/Makefile
@@ -57,7 +57,7 @@ include $(CHIBIOS)/os/hal/platforms/LPC111x/platform.mk
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/ports/GCC/ARMCMx/LPC111x/port.mk
include $(CHIBIOS)/os/kernel/kernel.mk
-#include $(CHIBIOS)/test/test.mk
+include $(CHIBIOS)/test/test.mk
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
diff --git a/demos/ARMCM0-LPC1114-GCC/main.c b/demos/ARMCM0-LPC1114-GCC/main.c
index 74b7f5a78..45496acfc 100644
--- a/demos/ARMCM0-LPC1114-GCC/main.c
+++ b/demos/ARMCM0-LPC1114-GCC/main.c
@@ -19,25 +19,56 @@
#include "ch.h"
#include "hal.h"
-//#include "test.h"
+#include "test.h"
/*
- * Red LEDs blinker thread, times are in milliseconds.
+ * Red LED blinker thread, times are in milliseconds.
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
(void)arg;
while (TRUE) {
- palClearPad(IOPORT1, GPIO0_LED);
+ palClearPad(GPIO0, GPIO0_LED2);
chThdSleepMilliseconds(500);
- palSetPad(IOPORT1, GPIO0_LED);
+ palSetPad(GPIO0, GPIO0_LED2);
chThdSleepMilliseconds(500);
}
return 0;
}
/*
+ * RGB LED blinker thread, times are in milliseconds.
+ */
+static WORKING_AREA(waThread2, 128);
+static msg_t Thread2(void *arg) {
+
+ (void)arg;
+ while (TRUE) {
+ palClearPort(GPIO1, PAL_PORT_BIT(GPIO1_LED3B) |
+ PAL_PORT_BIT(GPIO1_LED3R) |
+ PAL_PORT_BIT(GPIO1_LED3G));
+ chThdSleepMilliseconds(250);
+ palClearPort(GPIO1, PAL_PORT_BIT(GPIO1_LED3B) |
+ PAL_PORT_BIT(GPIO1_LED3R) |
+ PAL_PORT_BIT(GPIO1_LED3G));
+ palSetPort(GPIO1, PAL_PORT_BIT(GPIO1_LED3B));
+ chThdSleepMilliseconds(250);
+ palClearPort(GPIO1, PAL_PORT_BIT(GPIO1_LED3B) |
+ PAL_PORT_BIT(GPIO1_LED3R) |
+ PAL_PORT_BIT(GPIO1_LED3G));
+ palSetPort(GPIO1, PAL_PORT_BIT(GPIO1_LED3R));
+ chThdSleepMilliseconds(250);
+ palClearPort(GPIO1, PAL_PORT_BIT(GPIO1_LED3B) |
+ PAL_PORT_BIT(GPIO1_LED3R) |
+ PAL_PORT_BIT(GPIO1_LED3G));
+ palSetPort(GPIO1, PAL_PORT_BIT(GPIO1_LED3G));
+ chThdSleepMilliseconds(250);
+ }
+ return 0;
+}
+
+/*
* Entry point, note, the main() function is already a thread in the system
* on entry.
*/
@@ -47,22 +78,23 @@ int main(int argc, char **argv) {
(void)argv;
/*
- * Activates the serial driver 2 using the driver default configuration.
+ * Activates the serial driver 1 using the driver default configuration.
*/
-// sdStart(&SD2, NULL);
+ sdStart(&SD1, NULL);
/*
- * Creates the blinker thread.
+ * Creates the blinker threads.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+ chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
while (TRUE) {
-// if (palReadPad(IOPORT1, GPIOA_BUTTON))
-// TestThread(&SD2);
+ if (!palReadPad(GPIO0, GPIO0_SW3))
+ TestThread(&SD1);
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/os/hal/platforms/LPC111x/pal_lld.h b/os/hal/platforms/LPC111x/pal_lld.h
index 23b93ac50..8b871721d 100644
--- a/os/hal/platforms/LPC111x/pal_lld.h
+++ b/os/hal/platforms/LPC111x/pal_lld.h
@@ -105,21 +105,25 @@ typedef LPC_GPIO_TypeDef *ioportid_t;
* @brief GPIO0 port identifier.
*/
#define IOPORT1 LPC_GPIO0
+#define GPIO0 LPC_GPIO0
/**
* @brief GPIO1 port identifier.
*/
#define IOPORT2 LPC_GPIO1
+#define GPIO1 LPC_GPIO1
/**
* @brief GPIO2 port identifier.
*/
#define IOPORT3 LPC_GPIO2
+#define GPIO2 LPC_GPIO2
/**
* @brief GPIO3 port identifier.
*/
#define IOPORT4 LPC_GPIO3
+#define GPIO3 LPC_GPIO3
/*===========================================================================*/
/* Implementation, some of the following macros could be implemented as */
diff --git a/os/hal/platforms/LPC111x/serial_lld.c b/os/hal/platforms/LPC111x/serial_lld.c
index f3e7d5e31..369b543b3 100644
--- a/os/hal/platforms/LPC111x/serial_lld.c
+++ b/os/hal/platforms/LPC111x/serial_lld.c
@@ -211,7 +211,7 @@ static void notify1(void) {
* @brief UART0 IRQ handler.
*/
#if USE_LPC111x_UART0 || defined(__DOXYGEN__)
-CH_IRQ_HANDLER(UART0IrqHandler) {
+CH_IRQ_HANDLER(Vector94) {
CH_IRQ_PROLOGUE();