Basic Mid-Level control for the rebuilt MorphGI control unit, using PWM to communicate with the low level controllers.

Dependencies:   ros_lib_kinetic

Revision:
42:5a5ad23a4bb1
Parent:
37:37da606f4466
--- a/LLComms.h	Thu Sep 03 16:30:23 2020 +0000
+++ b/LLComms.h	Thu Jun 24 20:34:47 2021 +0000
@@ -35,6 +35,12 @@
         double positionSensor_mm[N_CHANNELS]; // The actual chamber lengths in meters given as the change in length relative to neutral (should always be >=0)
         unsigned int pressureSensor_uint[N_CHANNELS];
         double pressureSensor_bar[N_CHANNELS];  // The pressure in a given chamber in bar (1 bar  = 100,000 Pa)
+        unsigned int formatMessage(short int type, double dblValue, double dblMaxValue);
+        //bool CheckMessage(int msg, short int trueType);
+        bool CheckMessage(int msg);
+        bool PerformMasterSPI(SPI *spi, unsigned int outboundMsgs[], unsigned int inboundMsgsData[]);
+        void SendReceiveData(int channel);
+        int countervar;     
         
         LLComms(); // Constructor
         //~LLComms(); // Destructor
@@ -42,50 +48,30 @@
     private:
     
         // PIN DECLARATIONS     
-        InterruptIn pinGate6; // This pin HAS TO BE defined before SPI set up. No Clue Why.
         SPI spi_0; // mosi, miso, sclk
-        SPI spi_1;
-        SPI spi_2;
+        //SPI spi_1; // mosi, miso, sclk
         DigitalOut* cs_LL[N_CHANNELS]; // Chip select for low level controller
         //DigitalOut* cs_ADC[N_CHANNELS]; // Chip select for ADC
         // These interrupt pins have to be declared AFTER SPI declaration. No Clue Why.
         InterruptIn pinGate0;
         InterruptIn pinGate1;
         InterruptIn pinGate2;
-        InterruptIn pinGate3;
-        InterruptIn pinGate4;
-        InterruptIn pinGate5;
-        InterruptIn pinGate7;
-        InterruptIn pinGate8;
-        DigitalOut pinReset; // Reset pin for all controllers.
+        //InterruptIn pinGate3;
+        DigitalInOut pinReset; // Reset pin for all controllers.
         
         int ThreadID[N_CHANNELS];
         
-        unsigned int formatMessage(short int type, double dblValue, double dblMaxValue);
-        //bool CheckMessage(int msg, short int trueType);
-        bool CheckMessage(int msg);
-        bool PerformMasterSPI(SPI *spi, unsigned int outboundMsgs[], unsigned int inboundMsgsData[]);
-        void SendReceiveData(int channel);
+        
         void common_rise_handler(int channel);
         void common_fall_handler(int channel);
         void rise0(void);
         void rise1(void);
         void rise2(void);
-        void rise3(void);
-        void rise4(void);
-        void rise5(void);
-        void rise6(void);
-        void rise7(void);
-        void rise8(void);
+        //void rise3(void);
         void fall0(void);
         void fall1(void);
         void fall2(void);
-        void fall3(void);
-        void fall4(void);
-        void fall5(void);
-        void fall6(void);
-        void fall7(void);
-        void fall8(void);
+        //void fall3(void);
 
 };