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 9:46408a8dea0c, committed 2016-03-02
- Comitter:
- sk398
- Date:
- Wed Mar 02 09:38:47 2016 +0000
- Parent:
- 8:7f3594882cec
- Child:
- 10:c0531edf4850
- Commit message:
- All tasks operating and Cyclic Exec working. Just need to implement task 1
Changed in this revision
| Tasks.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Tasks.cpp Wed Mar 02 01:03:09 2016 +0000
+++ b/Tasks.cpp Wed Mar 02 09:38:47 2016 +0000
@@ -28,7 +28,7 @@
/* ==================================== Task 1 ==================================== */
Task1::Task1(PinName squareWaveInPin)
{
- _squareWaveIn = new InterruptIn(squareWaveInPin);
+ _squareWaveIn = new DigitalIn(squareWaveInPin);
}
void Task1::MeasureFrequency()
--- a/main.cpp Wed Mar 02 01:03:09 2016 +0000
+++ b/main.cpp Wed Mar 02 09:38:47 2016 +0000
@@ -109,8 +109,6 @@
}
}
-Timer stampTime;
-
#define TASK1_TICKS 40
#define TASK2_TICKS 12
#define TASK3_TICKS 12
@@ -121,96 +119,7 @@
#define HIGH 1
-//void CyclicExec()
-//{
-// slotCounter++;
-// switch(slotCounter)
-// {
-// case 1:
-// if(cyclicTicks % TASK1_TICKS == 0)
-// {
-//// printf("T1\r\n");
-// task1Frequency = task1.ReadFrequency();
-// }
-// break;
-//
-// case 2:
-// if(cyclicTicks % TASK2_TICKS == 0)
-// {
-//// printf("T2\r\n");
-// task2SwitchState = task2_switch1.digitalInState();
-// }
-// break;
-//
-// case 3:
-// if(cyclicTicks % TASK3_TICKS == 0)
-// {
-//// printf("T3 ------ \r\n");
-// LenPin = 1;
-// task3.OutputWatchdogPulse();
-// LenPin = 0;
-// }
-// break;
-//
-// case 4:
-// if(cyclicTicks % TASK4_TICKS == 0)
-// {
-//// printf("T4\r\n");
-// float *analogReading = task4.returnAnalogReadings();
-// task4AnalogChannels[0] = *(analogReading);
-// task4AnalogChannels[1]= *(analogReading+1);
-// }
-// break;
-//
-// case 5:
-// if(cyclicTicks % TASK5_TICKS == 0)
-// {
-//// printf("T5\r\n");
-// task5.updateDisplay( task1Frequency,
-// task2SwitchState,
-// task6ErrorState,
-// task4AnalogChannels[0],
-// task4AnalogChannels[1] );
-// }
-// break;
-//
-// case 10:
-// if(cyclicTicks % TASK6_TICKS == 0)
-// {
-//// printf("T6\r\n");
-// task6ErrorState = task6.updateErrorCode( task2SwitchState,
-// task4AnalogChannels[0],
-// task4AnalogChannels[1] );
-// }
-// break;
-//
-// case 11:
-// if(cyclicTicks % TASK7_TICKS == 0)
-// {
-//// printf("T7\r\n");
-// int a = sprintf( logData,"Freq=%d,SW1=%d,A1=%1.3f,A2=%1.3f\n",
-// task1Frequency,
-// task2SwitchState,
-// task4AnalogChannels[0],
-// task4AnalogChannels[1] );
-// task7.writeData(logData);
-// }
-// break;
-//
-// case 12:
-// slotCounter = 0;
-// cyclicTicks++;
-// break;
-// }
-// if(SDRemoval == HIGH)
-// {
-// printf("Shutting File");
-// task7.closeFile();
-// }
-//
-//
-//}
-
+Timer stampTime;
Timer task1t;
Timer task2t;
Timer task3t;
@@ -284,7 +193,6 @@
{
if(taskNum == 2)
{
-// printf("IM IN TASK 2!!!!!!!!!!!!!!!!!!!!!\r\n");
task2t.stop();
printf("T2 %d\r\n",task2t.read_ms());
task2SwitchState = task2_switch1.digitalInState();
@@ -294,7 +202,6 @@
}
else if(taskNum == 3)
{
-// printf("IM IN TASK 3!!!!!!!!!!!!!!!!!!!!!\r\n");
task3t.stop();
printf("T3 %d\r\n",task3t.read_ms());
task3.OutputWatchdogPulse();
@@ -308,6 +215,7 @@
{
printf("SD Removed");
task7.closeFile();
+ CyclicTicker.detatch();
}
}