Test session

Dependencies:   FatFileSystem MCP23017 WattBob_TextLCD mbed

Fork of Assignment_2_herpe by Xavier Herpe

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers update_analog_task.cpp Source File

update_analog_task.cpp

00001 #include "update_analog_task.h"
00002 
00003 /**
00004  *
00005  * @param starting_offset           when the task should but run first
00006  * @param frequency_ms              the frequency in ms of how often the task should run
00007  * @param state                             pointer to the state object
00008  */
00009 UpdateAnalogTask::UpdateAnalogTask(int starting_offset, int frequency_ms,
00010                                                                      State * state)
00011                                     : Task(starting_offset, frequency_ms) {
00012                                         
00013     this->state = state;
00014     this->analog_in_1 = new AnalogIn(p17);
00015     this->analog_in_2 = new AnalogIn(p18);
00016 }
00017 
00018 UpdateAnalogTask::~UpdateAnalogTask() {
00019     delete this->analog_in_1;
00020     delete this->analog_in_2;
00021 }
00022 
00023 void UpdateAnalogTask::action() {
00024     this->state->update_analog(this->analog_in_1->read(), this->analog_in_2->read());
00025 }