Basic Mid-Level control for the rebuilt MorphGI control unit, using PWM to communicate with the low level controllers.
Dependencies: ros_lib_kinetic
Diff: LLComms.h
- Revision:
- 12:595ed862e52f
- Parent:
- 11:7029367a1840
- Child:
- 14:54c3759e76ed
--- a/LLComms.h Fri Aug 10 10:40:18 2018 +0000 +++ b/LLComms.h Mon Aug 13 09:16:29 2018 +0000 @@ -8,7 +8,7 @@ #include "mbed.h" #include "mbed_events.h" // CUSTOM IMPORTS -#include "MLOptions.h" +#include "MLSettings.h" // ADC SPI DEFINES #define PREAMBLE 0x06 @@ -22,6 +22,19 @@ { public: + + EventQueue queue; + Mutex mutChannel[N_CHANNELS]; + bool isDataReady[N_CHANNELS]; // Flag to indicate path data is ready for transmission to low level. + int demandPosition[N_CHANNELS]; // 13-bit value to be sent to the actuator + char chrErrorFlag[N_CHANNELS]; // 3 error bits from LL + + LLComms(); // Constructor + //~LLComms(); // Destructor + double ReadADCPosition_mtrs(int channel); + double ReadADCPressure_bar(int channel); + + private: // PIN DECLARATIONS InterruptIn pinGate6; // This pin HAS TO BE defined before SPI set up. No Clue Why. @@ -39,16 +52,8 @@ InterruptIn pinGate7; DigitalOut pinReset; // Reset pin for all controllers. - bool isDataReady[N_CHANNELS]; // Flag to indicate path data is ready for transmission to low level. - Mutex mutChannel[N_CHANNELS]; int ThreadID[N_CHANNELS]; - EventQueue queue; - int demandPosition[N_CHANNELS]; // 13-bit value to be sent to the actuator - char chrErrorFlag[N_CHANNELS]; // 3 error bits from LL - - LLComms(int low_level_spi_frequency); // Constructor - //~LLComms(); // Destructor void SendReceiveData(int channel); void common_rise_handler(int channel); void common_fall_handler(int channel); @@ -68,13 +73,6 @@ void fall5(void); void fall6(void); void fall7(void); - - private: - - int _spi_frequency; - - double ReadADCPosition_mtrs(int channel); - double ReadADCPressure_bar(int channel); };