software:firmware
MakAir Firmware
activation.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 // INCLUDES ===================================================================
11 
12 // External libraries
13 #include "Arduino.h"
14 
15 // CLASS ======================================================================
16 
19  public:
21 
27  void refreshState();
28 
32  bool isRunning() const { return m_state != STOPPED; }
33 
39  void changeState(uint16_t state);
40 
44  void onStartButton();
45 
49  void onStopButton();
50 
51  private:
52  enum State {
54  STOPPED = 0,
55 
58 
61  };
62 
65 
68 };
69 
70 // INITIALISATION =============================================================
71 
ActivationController activationController
Instance of the activation controller.
Definition: activation.cpp:21
Controls breathing activation ON/OFF state.
Definition: activation.h:18
bool isRunning() const
Return if breathing is activated or not.
Definition: activation.h:32
void onStopButton()
Callback to call each time the stop button is pushed.
Definition: activation.cpp:37
void refreshState()
Refresh the current state.
Definition: activation.cpp:49
void changeState(uint16_t state)
Change the current state.
Definition: activation.cpp:29
void onStartButton()
Callback to call each time the start button is pushed.
Definition: activation.cpp:27
State m_state
Activation status.
Definition: activation.h:64
uint32_t m_timeOfLastStopPushed
Last time stop button was pushed.
Definition: activation.h:67
@ RUNNING_READY_TO_STOP
Breathing is ON, waiting for a second push to stop.
Definition: activation.h:60
@ RUNNING
Breathing is ON.
Definition: activation.h:57
@ STOPPED
Breathing is OFF.
Definition: activation.h:54