Today's the day. Renamed platform to framework.
This commit is contained in:
52
power/PowerSwitcher.h
Normal file
52
power/PowerSwitcher.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* PowerSwitcher.h
|
||||
*
|
||||
* Created on: 21.01.2014
|
||||
* Author: baetz
|
||||
*/
|
||||
|
||||
#ifndef POWERSWITCHER_H_
|
||||
#define POWERSWITCHER_H_
|
||||
#include <framework/power/PowerSwitchIF.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <framework/timemanager/Countdown.h>
|
||||
|
||||
class PowerSwitcher : public HasReturnvaluesIF {
|
||||
public:
|
||||
enum State_t {
|
||||
WAIT_OFF,
|
||||
WAIT_ON,
|
||||
SWITCH_IS_OFF,
|
||||
SWITCH_IS_ON,
|
||||
};
|
||||
State_t state;
|
||||
static const uint8_t INTERFACE_ID = POWER_SWITCHER;
|
||||
static const ReturnValue_t IN_POWER_TRANSITION = MAKE_RETURN_CODE(1);
|
||||
static const ReturnValue_t SWITCH_STATE_MISMATCH = MAKE_RETURN_CODE(2);
|
||||
PowerSwitcher( uint8_t setSwitch1, uint8_t setSwitch2 = NO_SWITCH, State_t setStartState = SWITCH_IS_OFF );
|
||||
ReturnValue_t initialize();
|
||||
void turnOn();
|
||||
void turnOff();
|
||||
void doStateMachine();
|
||||
State_t getState();
|
||||
ReturnValue_t checkSwitchState();
|
||||
uint32_t getSwitchDelay();
|
||||
uint8_t getFirstSwitch() const;
|
||||
uint8_t getSecondSwitch() const;
|
||||
private:
|
||||
uint8_t firstSwitch;
|
||||
uint8_t secondSwitch;
|
||||
PowerSwitchIF* power;
|
||||
static const uint8_t NO_SWITCH = 0xFF;
|
||||
enum SwitchReturn_t {
|
||||
ONE_SWITCH = 1,
|
||||
TWO_SWITCHES = 2
|
||||
};
|
||||
ReturnValue_t getStateOfSwitches();
|
||||
void commandSwitches( ReturnValue_t onOff );
|
||||
SwitchReturn_t howManySwitches();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* POWERSWITCHER_H_ */
|
Reference in New Issue
Block a user