Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MCP23017 SDFileSystem WattBob_TextLCD mbed
Revision 1:221d677fe0d3, committed 2016-02-15
- Comitter:
- sk398
- Date:
- Mon Feb 15 22:17:47 2016 +0000
- Parent:
- 0:5989ac10c4d3
- Child:
- 2:22ebabd78084
- Commit message:
- Converted to a single header file and .cpp file with all the associated tasks contained.; ; This will be adapted throughout developing the tasks independently, using OO principles.
Changed in this revision
--- a/Tasks.cpp Mon Feb 15 21:56:19 2016 +0000
+++ b/Tasks.cpp Mon Feb 15 22:17:47 2016 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "Tasks.h"
+
+
+/* ==================================== Task 1 ==================================== */
+Task1::Task1(PinName squareWaveInPin)
+{
+ Timer Task1Timer;
+ _squareWaveIn = new DigitalIn(squareWaveInPin);
+}
+
+int Task1::MeasureFreq()
+{
+
+}
+
+
+/* ==================================== Task 2 ==================================== */
+
+Task2::Task2(PinName digitalInCheckPin)
+{
+ _digitialInCheck = new DigitalOut(digitalInCheckPin);
+}
+
+
+/* ==================================== Task 3 ==================================== */
+Task3::Task3(PinName WatchdogPin)
+{
+ _Watchdog = new DigitalOut(WatchdogPin);
+}
+
+void Task3::OutputWatchdogPulse()
+{
+ _Watchdog -> write(HIGH);
+ wait_ms(WATCHDOG_PULSE_WIDTH);
+ _Watchdog -> write(LOW);
+}
+
+
+/* ==================================== Task 4 ==================================== */
\ No newline at end of file
--- a/Tasks.h Mon Feb 15 21:56:19 2016 +0000
+++ b/Tasks.h Mon Feb 15 22:17:47 2016 +0000
@@ -0,0 +1,54 @@
+#ifndef _TASKS_H_
+#define _TASKS_H_
+
+#define HIGH 1
+#define LOW 0
+
+#define WATCHDOG_PULSE_WIDTH 15
+
+
+/* ==================================== Task 1 ==================================== */
+class Task1
+{
+public:
+ Task1(PinName squareWaveInPin);
+ int MeasureFreq();
+
+private:
+
+ DigitalIn *_squareWaveIn;
+
+};
+
+
+/* ==================================== Task 2 ==================================== */
+class Task2
+{
+public:
+ Task2(PinName digitalInCheckPin);
+
+private:
+
+ DigitalIn *_digitalInCheck;
+
+};
+
+
+/* ==================================== Task 3 ==================================== */
+class Task3
+{
+public:
+ Task3(PinName WatchdogPin);
+ void OutputWatchdogPulse();
+
+private:
+ DigitalOut *_Watchdog;
+};
+
+
+/* ==================================== Task 4 ==================================== */
+
+
+/* ==================================== Task 5 ==================================== */
+
+#endif
--- a/main.cpp Mon Feb 15 21:56:19 2016 +0000
+++ b/main.cpp Mon Feb 15 22:17:47 2016 +0000
@@ -1,78 +1,12 @@
#include "mbed.h"
-
-#define WATCHDOG_PULSE_WIDTH 15
-
-class Task1 // Square Wave Reader - read every second
-{
-
-public:
- Task1::Task1(PinName squareWaveInPin)
- {
- Timer Task1Timer;
- _squareWaveIn = new DigitalIn(squareWaveInPin);
- }
-
- int Task1::MeasureFreq()
- {
-
-
- }
-
-
-private:
-
- DigitalIn *_squareWaveIn;
-};
+#include "Tasks.h"
-class Task2 // Digital Input Reader - Read every 300ms
-{
-public:
- Task2::Task2()
- {
-
- }
-
-private:
-
-};
-
-class Task3 // Watchdog Pulse - output every 300ms
-{
-public:
- Task3::Task3(WatchdogPin)
- {
- _Watchdog = new DigitalOut(WatchdogPin)
- }
-
- Task3::OutputWatchdogPulse()
- {
- _Watchdog -> write(HIGH);
- wait_ms(WATCHDOG_PULSE_WIDTH);
- _Watchdog -> wirte(LOW);
- }
-
-private:
- DigitalOut *_Watchdog;
-
-};
-
-class Task4 // Read Analogue inputs - read every 400ms
-{
-public:
- Task4::Task4()
- {
-
- }
-
-private:
-
-};
DigitalOut myled(LED1);
Task1 task1(p5); // Square wave Measurement
-Task2 task3(p6); // Watchdog Pulse
+Task3 task3(p6); // Watchdog Pulse
int main() {