City1082 telemetry application

Files at this revision

API Documentation at this revision

Comitter:
reedas
Date:
Wed Dec 01 10:15:16 2021 +0000
Parent:
7:bb1bb2a54033
Commit message:
Added status led display thread

Changed in this revision

src/main.cpp Show annotated file Show diff for this revision Revisions of this file
src/statusled.cpp Show annotated file Show diff for this revision Revisions of this file
src/statusled.h Show annotated file Show diff for this revision Revisions of this file
--- a/src/main.cpp	Wed Dec 01 00:12:30 2021 +0000
+++ b/src/main.cpp	Wed Dec 01 10:15:16 2021 +0000
@@ -3,18 +3,19 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 #include "mbed.h"
-#include <ios>
-#include <iostream>
-#include <iomanip>
+
 #include "display.h"
 #include "sensors.h"
+#include "statusled.h"
 
 
+Thread statusledThreadHandle;
 Thread sendingThreadHandle;
 Thread displayThreadHandle;
 
 int main(void)
 {
+    statusledThreadHandle.start(callback(statusledThread));
     sendingThreadHandle.start(callback(sendThread));
     displayThreadHandle.start(callback(displayThread));
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/statusled.cpp	Wed Dec 01 10:15:16 2021 +0000
@@ -0,0 +1,23 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2019 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "mbed.h"
+#include "statusled.h"
+
+
+// Blinking rate in milliseconds
+#define BLINKING_RATE     500ms
+
+
+void statusledThread()
+{
+    // Initialise the digital pin LED1 as an output
+    DigitalOut led(LED1);
+
+    while (true) {
+        led = !led;
+        ThisThread::sleep_for(BLINKING_RATE);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/statusled.h	Wed Dec 01 10:15:16 2021 +0000
@@ -0,0 +1,5 @@
+#ifndef STATUSLED_H
+#define STATUSLED_H
+
+void statusledThread();
+#endif
\ No newline at end of file