Test session
Dependencies: FatFileSystem MCP23017 WattBob_TextLCD mbed
Fork of Assignment_2_herpe by
Diff: update_analog_task.cpp
- Revision:
- 4:48761259552a
diff -r 5883d1a2c5b0 -r 48761259552a update_analog_task.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/update_analog_task.cpp Tue Mar 14 14:46:43 2017 +0000 @@ -0,0 +1,25 @@ +#include "update_analog_task.h" + +/** + * + * @param starting_offset when the task should but run first + * @param frequency_ms the frequency in ms of how often the task should run + * @param state pointer to the state object + */ +UpdateAnalogTask::UpdateAnalogTask(int starting_offset, int frequency_ms, + State * state) + : Task(starting_offset, frequency_ms) { + + this->state = state; + this->analog_in_1 = new AnalogIn(p17); + this->analog_in_2 = new AnalogIn(p18); +} + +UpdateAnalogTask::~UpdateAnalogTask() { + delete this->analog_in_1; + delete this->analog_in_2; +} + +void UpdateAnalogTask::action() { + this->state->update_analog(this->analog_in_1->read(), this->analog_in_2->read()); +} \ No newline at end of file