state-handler: #6 rename the class
This commit is contained in:
26
StateHandler/inc/Counter.h
Normal file
26
StateHandler/inc/Counter.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Counter.h
|
||||
*
|
||||
* Created on: Sep 1, 2022
|
||||
* Author: tylen
|
||||
*/
|
||||
|
||||
#ifndef COUNTER_H_
|
||||
#define COUNTER_H_
|
||||
|
||||
class Counter {
|
||||
|
||||
public:
|
||||
Counter(int i, int up);
|
||||
void inc();
|
||||
void dec();
|
||||
int getInit();
|
||||
void setInit(int i);
|
||||
~Counter() = default;
|
||||
|
||||
private:
|
||||
int init;
|
||||
int up_lim;
|
||||
|
||||
};
|
||||
#endif /* COUNTER_H_ */
|
||||
50
StateHandler/inc/StateHandler.h
Normal file
50
StateHandler/inc/StateHandler.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* EventHandler.h
|
||||
*
|
||||
* Created on: Sep 21, 2022
|
||||
* Author: tylen
|
||||
*
|
||||
* Purpose of this class is to store and pass
|
||||
* the events of the current mode to further process.
|
||||
*
|
||||
* Current goal is to make it to operate on interrupts
|
||||
* caused by button presses.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EVENTHANDLER_H_
|
||||
#define EVENTHANDLER_H_
|
||||
|
||||
#include "DigitalIoPin.h"
|
||||
#include "Counter.h"
|
||||
|
||||
/** A structure to hold button pointers
|
||||
*
|
||||
* Main four buttons that operate the
|
||||
* whole program. The structure should be
|
||||
* initialized in main with correct values and
|
||||
* passed to main EvenHandler object constructor.
|
||||
*
|
||||
* */
|
||||
typedef struct _EVENT_HANDL{
|
||||
DigitalIoPin * _button_control_up;
|
||||
DigitalIoPin * _button_control_down;
|
||||
DigitalIoPin * _button_control_toggle_mode;
|
||||
DigitalIoPin * _button_control_toggle_active;
|
||||
} EVENT_HANDL;
|
||||
|
||||
class EventHandler {
|
||||
public:
|
||||
EventHandler(EVENT_HANDL btns);
|
||||
virtual ~EventHandler();
|
||||
int getSetPresuure(); // Get currently set pressure 0-100%
|
||||
int getSetSpeed(); //Get currently set FanSpeed 0-100%
|
||||
private:
|
||||
EVENT_HANDL internal = {0,0,0,0};
|
||||
bool mode;
|
||||
Counter * bar_pressure;
|
||||
Counter * bar_speed;
|
||||
|
||||
};
|
||||
|
||||
#endif /* EVENTHANDLER_H_ */
|
||||
Reference in New Issue
Block a user