Test session

Dependencies:   FatFileSystem MCP23017 WattBob_TextLCD mbed

Fork of Assignment_2_herpe by Xavier Herpe

update_analog_task.cpp

Committer:
xouf2114
Date:
2017-03-14
Revision:
4:48761259552a

File content as of revision 4:48761259552a:

#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());
}