aboutsummaryrefslogtreecommitdiffstats
path: root/demos/NRF51
diff options
context:
space:
mode:
authorFabio Utzig <utzig@utzig.org>2015-05-15 20:45:44 -0300
committerFabio Utzig <utzig@utzig.org>2015-05-15 20:45:44 -0300
commit443c13d8785cbcbd3550bc091ba502fd156a5c8b (patch)
tree2516cb267393cfefb087e5b36d5b2873862bfa04 /demos/NRF51
parent57f582abae3e240498c91d3ccf398880bb78d3a2 (diff)
downloadChibiOS-Contrib-443c13d8785cbcbd3550bc091ba502fd156a5c8b.tar.gz
ChibiOS-Contrib-443c13d8785cbcbd3550bc091ba502fd156a5c8b.tar.bz2
ChibiOS-Contrib-443c13d8785cbcbd3550bc091ba502fd156a5c8b.zip
Demo with extra thread for blinker using PAL
Diffstat (limited to 'demos/NRF51')
-rw-r--r--demos/NRF51/RT-WVSHARE_BLE400/halconf.h2
-rw-r--r--demos/NRF51/RT-WVSHARE_BLE400/main.c25
2 files changed, 23 insertions, 4 deletions
diff --git a/demos/NRF51/RT-WVSHARE_BLE400/halconf.h b/demos/NRF51/RT-WVSHARE_BLE400/halconf.h
index 28f2cc5..8061b96 100644
--- a/demos/NRF51/RT-WVSHARE_BLE400/halconf.h
+++ b/demos/NRF51/RT-WVSHARE_BLE400/halconf.h
@@ -34,7 +34,7 @@
* @brief Enables the PAL subsystem.
*/
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
-#define HAL_USE_PAL FALSE
+#define HAL_USE_PAL TRUE
#endif
/**
diff --git a/demos/NRF51/RT-WVSHARE_BLE400/main.c b/demos/NRF51/RT-WVSHARE_BLE400/main.c
index 6545d30..2f1cb2a 100644
--- a/demos/NRF51/RT-WVSHARE_BLE400/main.c
+++ b/demos/NRF51/RT-WVSHARE_BLE400/main.c
@@ -18,6 +18,20 @@
#include "hal.h"
#include "test.h"
+static THD_WORKING_AREA(waThread1, 64);
+static THD_FUNCTION(Thread1, arg) {
+
+ (void)arg;
+ uint8_t led = LED0;
+ chRegSetThreadName("Blinker");
+ while (1) {
+ palSetPad(IOPORT1, led);
+ chThdSleepMilliseconds(100);
+ palClearPad(IOPORT1, led);
+ if (++led > LED4) led = LED0;
+ }
+}
+
/*
* Application entry point.
*/
@@ -33,13 +47,18 @@ int main(void) {
halInit();
chSysInit();
+ /*
+ * Activates UART0 using the driver default configuration.
+ */
sdStart(&SD1, NULL);
+ /*
+ * Creates the blinker thread.
+ */
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+
TestThread(&SD1);
while (1) {
- NRF_GPIO->OUTCLR = (uint32_t) 1 << 18;
- chThdSleepMilliseconds(500);
- NRF_GPIO->OUTSET = (uint32_t) 1 << 18;
chThdSleepMilliseconds(500);
}
}