AEM
app.h
Go to the documentation of this file.
1  #ifndef APP_H
2 #define APP_H
3 
4 #include <Arduino.h>
5 
6 #include "config.h"
7 #include "staticQ.h"
8 #include "timeStamper.h"
9 #include "board.h"
10 
13 class SlaveApp{
14  protected:
16  // definition of the States used in state-machine logic
18  enum class State {unstarted,
19  started,
21  working,
25  // Variables only used within main code
27  u8u32f_struct nullStruct = {255,0,0.0}; //<! null struct used to inform master that there is no more to send
28 
29  State previousState = State::unstarted; //<! used to check if the new state is correct after a transition
30  Q<u8u32f_struct> *q; //<! poointer to the local q where sensor data is stored before sending to master
31  Board *board; //<! pointer to board instance which handles the adc interactions
32 
33  uint8_t nbActiveADCS, //<! of all the adcs on the board this is the number that are going to be used, is <- board_nbADCS
34  *adcIndexVec; /*<! this vector contains the indexes of all the active adcs, eg. if thereare 2 actve, 1 and 3, this would
35  look like {1,3}
36  */
37  State currentState = State::started; //<! current state of the SlaveApp state machine
38  State nextState = State::unstarted; //<! next state to be set in SlaveApp::loop when SPI ISR returns
39 
41  // protected Main code methods
43 
45  void handShake();
48  void setupHBLed();
51  void stepHB() const;
54  void sayState() const;
57  void checkCurrentState() const;
62  void setupADCVectors(uint8_t board_nbADCS, const uint8_t *bordNbChannelVec);
65  void createTimeStamper();
70  State doWork();
76 
77  public:
84  SlaveApp();
89  void loop();
90 };
91 
92 #endif
Definition: app.h:13
Q< u8u32f_struct > * q
Definition: app.h:30
void loop()
Definition: Slave2560.cpp:57
void setupADCVectors(uint8_t board_nbADCS, const uint8_t *bordNbChannelVec)
Definition: Slave2560.cpp:110
SlaveApp()
Definition: Slave2560.cpp:12
State doSingleSend()
Definition: Slave2560.cpp:157
State doWork()
Definition: Slave2560.cpp:127
Board * board
Definition: app.h:31
void createTimeStamper()
Definition: Slave2560.cpp:121
State previousState
Definition: app.h:29
uint8_t nbActiveADCS
Definition: app.h:33
Definition: board.h:11
void handShake()
Definition: Slave2560.cpp:88
void setupHBLed()
Definition: Slave2560.cpp:94
State nextState
Definition: app.h:38
State currentState
Definition: app.h:37
void sayState() const
void stepHB() const
Definition: Slave2560.cpp:102
State
Definition: app.h:18
u8u32f_struct nullStruct
Definition: app.h:27
uint8_t * adcIndexVec
Definition: app.h:33
void checkCurrentState() const
Definition: config.h:16