TeensyNanoExoCode
Loading...
Searching...
No Matches
ComsMCU.h
Go to the documentation of this file.
1
9#ifndef COMSMCU_H
10#define COMSMCU_H
11
12#include "Arduino.h"
13#include "ExoBLE.h"
14#include "Battery.h"
15#include "BleMessage.h"
16#include "ParseIni.h"
17#include "ExoData.h"
18#include "BleMessageQueue.h"
19
25#if defined(ARDUINO_ARDUINO_NANO33BLE) | defined(ARDUINO_NANO_RP2040_CONNECT)
26class ComsMCU
27{
28 public:
35 ComsMCU(ExoData* data, uint8_t* config_to_send);
36
41 void handle_ble();
42
47 void local_sample();
48
52 void update_UART();
53
59 void update_gui();
60
65 void handle_errors();
66 private:
71 void _life_pulse();
72 const int k_pulse_count = 10;
78 void _process_complete_gui_command(BleMessage* msg);
79
80 // Reference to ExoBLE object, this is the next step down the composition heirarchy
81 ExoBLE* _exo_ble;
82 // Hold on to the last message from the GUI
83 BleMessage _latest_gui_message = BleMessage();
84 //Data
85 ExoData* _data;
86 //Battery
87 _Battery* _battery;
88
89 const int _mark_index = 1;
90
91 // Alpha value for the exponentially weighted moving average on the battery data
92 const float k_battery_ewma_alpha = 0.1;
93 const float k_time_threshold = 5000; //microseconds
94
95};
96#endif
97#endif
Defines the BleMessage class used to hold command-data pairs exchanged between the GUI.
Defines a FIFO queue for the BLEMessage type. The maximum size is specified in the cpp.
Class to handle all bluetooth work. This include initialization, advertising, connection,...
Declares a class used to store data for the Exo to access.
Declares the functions needed and defines mapping between the INI keys and the exo components.
Definition BleMessage.h:16
Class to store all the data related to the exo.
Definition ExoData.h:38