![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test session
Dependencies: FatFileSystem MCP23017 WattBob_TextLCD mbed
Fork of Assignment_2_herpe by
update_analog_task.cpp@4:48761259552a, 2017-03-14 (annotated)
- Committer:
- xouf2114
- Date:
- Tue Mar 14 14:46:43 2017 +0000
- Revision:
- 4:48761259552a
Test of Assignment 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xouf2114 | 4:48761259552a | 1 | #include "update_analog_task.h" |
xouf2114 | 4:48761259552a | 2 | |
xouf2114 | 4:48761259552a | 3 | /** |
xouf2114 | 4:48761259552a | 4 | * |
xouf2114 | 4:48761259552a | 5 | * @param starting_offset when the task should but run first |
xouf2114 | 4:48761259552a | 6 | * @param frequency_ms the frequency in ms of how often the task should run |
xouf2114 | 4:48761259552a | 7 | * @param state pointer to the state object |
xouf2114 | 4:48761259552a | 8 | */ |
xouf2114 | 4:48761259552a | 9 | UpdateAnalogTask::UpdateAnalogTask(int starting_offset, int frequency_ms, |
xouf2114 | 4:48761259552a | 10 | State * state) |
xouf2114 | 4:48761259552a | 11 | : Task(starting_offset, frequency_ms) { |
xouf2114 | 4:48761259552a | 12 | |
xouf2114 | 4:48761259552a | 13 | this->state = state; |
xouf2114 | 4:48761259552a | 14 | this->analog_in_1 = new AnalogIn(p17); |
xouf2114 | 4:48761259552a | 15 | this->analog_in_2 = new AnalogIn(p18); |
xouf2114 | 4:48761259552a | 16 | } |
xouf2114 | 4:48761259552a | 17 | |
xouf2114 | 4:48761259552a | 18 | UpdateAnalogTask::~UpdateAnalogTask() { |
xouf2114 | 4:48761259552a | 19 | delete this->analog_in_1; |
xouf2114 | 4:48761259552a | 20 | delete this->analog_in_2; |
xouf2114 | 4:48761259552a | 21 | } |
xouf2114 | 4:48761259552a | 22 | |
xouf2114 | 4:48761259552a | 23 | void UpdateAnalogTask::action() { |
xouf2114 | 4:48761259552a | 24 | this->state->update_analog(this->analog_in_1->read(), this->analog_in_2->read()); |
xouf2114 | 4:48761259552a | 25 | } |