AEM
SlaveApp Class Reference

#include <app.h>

Public Member Functions

 SlaveApp ()
 
void loop ()
 

Protected Types

enum  State {
  State::unstarted, State::started, State::initialized, State::working,
  State::readyToSend, State::sendingStructs
}
 

Protected Member Functions

void handShake ()
 
void setupHBLed ()
 
void stepHB () const
 
void sayState () const
 
void checkCurrentState () const
 
void setupADCVectors (uint8_t board_nbADCS, const uint8_t *bordNbChannelVec)
 
void createTimeStamper ()
 
State doWork ()
 
State doSingleSend ()
 

Protected Attributes

u8u32f_struct nullStruct = {255,0,0.0}
 
State previousState = State::unstarted
 
Q< u8u32f_struct > * q
 
Boardboard
 
uint8_t nbActiveADCS
 
uint8_t * adcIndexVec
 
State currentState = State::started
 
State nextState = State::unstarted
 

Detailed Description

SlaveApp handles all SPI interactions with master and polls the board for ADC data

Member Enumeration Documentation

enum SlaveApp::State
strongprotected
Enumerator
unstarted 
started 
initialized 
working 
readyToSend 
sendingStructs 

Constructor & Destructor Documentation

SlaveApp::SlaveApp ( )

constructor: activates Serial creates all member variables provides output to Serial to inform sets up SPI slave mode

Member Function Documentation

void SlaveApp::checkCurrentState ( ) const
protected

compare current state with previous state and dispaly error message if incorrect

void SlaveApp::createTimeStamper ( )
protected

Called to creat the instance of the timeStamper class and set t0 appropriately

SlaveApp::State SlaveApp::doSingleSend ( )
protected

as long as there are elts in the queue, pop and send via serial If there are noneleft on the queue, return State::working to inform the main loop, otherwise state remains same

Returns
State::working if there arenno more on the queue for more data, or State::readyToSend otherwise
SlaveApp::State SlaveApp::doWork ( )
protected

as long as there is room on the queue, poll the adc/channels and push the data to the queue. If there is no room left on the queue, return State::readyToSend to inform the main loop

Returns
State::working if there is still room on the queue for more data, or State::readyToSend otherwise
void SlaveApp::handShake ( )
protected

sync start up of serial comms

void SlaveApp::loop ( )

loop() is called by the main loop, manages the slave state machine by: updating state as needed then perform any actions required by the current state.

void SlaveApp::sayState ( ) const
protected

Display the heartbeat infor and current state if full data display is active

void SlaveApp::setupADCVectors ( uint8_t  board_nbADCS,
const uint8_t *  bordNbChannelVec 
)
protected

Called to initialize the nbActiveADCS and the adcIndexVector so that in the querying, there will be no wasted cycles

Parameters
board_nbADCStotal number of adcs available on the board
*bordNbChannelVeca vector of all the adc channels available
void SlaveApp::setupHBLed ( )
protected

setup calls for heartbeat led pins

void SlaveApp::stepHB ( ) const
protected

update the heartbeat flashing

Field Documentation

uint8_t * SlaveApp::adcIndexVec
protected
Board* SlaveApp::board
protected
State SlaveApp::currentState = State::started
protected
uint8_t SlaveApp::nbActiveADCS
protected
State SlaveApp::nextState = State::unstarted
protected
u8u32f_struct SlaveApp::nullStruct = {255,0,0.0}
protected
State SlaveApp::previousState = State::unstarted
protected
Q<u8u32f_struct>* SlaveApp::q
protected

The documentation for this class was generated from the following files: