aboutsummaryrefslogtreecommitdiffstats
path: root/demos/NRF52/Classic/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'demos/NRF52/Classic/main.c')
-rw-r--r--demos/NRF52/Classic/main.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/demos/NRF52/Classic/main.c b/demos/NRF52/Classic/main.c
index 1f92bdc..28e7505 100644
--- a/demos/NRF52/Classic/main.c
+++ b/demos/NRF52/Classic/main.c
@@ -26,6 +26,22 @@ WDGConfig WDG_config = {
};
+void gpt_callback(GPTDriver *gptp) {
+ palTogglePad(IOPORT1, LED2);
+}
+
+/*
+ * GPT configuration
+ * Frequency: 31250Hz (32us period)
+ * Resolution: 16 bits
+ */
+static const GPTConfig gpt_config = {
+ .frequency = 31250,
+ .callback = gpt_callback,
+ .resolution = 16,
+};
+
+
/*
* Command Random
*/
@@ -140,9 +156,7 @@ static THD_FUNCTION(Thread1, arg) {
while (1) {
- palSetPad(IOPORT1, led);
- chThdSleepMilliseconds(100);
- palClearPad(IOPORT1, led);
+ palTogglePad(IOPORT1, led);
chThdSleepMilliseconds(100);
}
}
@@ -166,12 +180,14 @@ int main(void)
sdStart(&SD1, &serial_config);
palSetPad(IOPORT1, LED1);
- palSetPad(IOPORT1, LED2);
- palSetPad(IOPORT1, LED3);
+ palClearPad(IOPORT1, LED2);
+ palClearPad(IOPORT1, LED3);
palSetPad(IOPORT1, LED4);
+ gptStart(&GPTD1, &gpt_config);
+ gptStartContinuous(&GPTD1, 31250);
-
+
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1,
Thread1, NULL);
@@ -181,6 +197,7 @@ int main(void)
shellThread, (void *)&shell_cfg1);
+
printf(PORT_INFO "\r\n");
chThdSleep(2);
@@ -189,7 +206,9 @@ int main(void)
printf("Priority levels %d\r\n", CORTEX_PRIORITY_LEVELS);
- test_execute((BaseSequentialStream *)&SD1);
+ //test_execute((BaseSequentialStream *)&SD1);
+
+ NRF_P0->DETECTMODE = 0;
while (true) {
if (watchdog_started &&