diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-04-03 12:17:37 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-04-03 12:17:37 +0000 |
commit | 220341765d0934143787dcdf0dfa40577059f884 (patch) | |
tree | 692e55d7af9d5aaeeab26e64480bdfde2e2a4c88 /demos/ARMCM0-LPC1114-GCC | |
parent | 7fa66fc81d60bc00a35ab0643b268cd9874b53ad (diff) | |
download | ChibiOS-220341765d0934143787dcdf0dfa40577059f884.tar.gz ChibiOS-220341765d0934143787dcdf0dfa40577059f884.tar.bz2 ChibiOS-220341765d0934143787dcdf0dfa40577059f884.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1837 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARMCM0-LPC1114-GCC')
-rw-r--r-- | demos/ARMCM0-LPC1114-GCC/Makefile | 2 | ||||
-rw-r--r-- | demos/ARMCM0-LPC1114-GCC/main.c | 50 |
2 files changed, 42 insertions, 10 deletions
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;
|