Browse Source

pi minor updates

namrota ghosh 7 months ago
parent
commit
a9787129be
2 changed files with 17 additions and 1 deletions
  1. 8 1
      src/pi/i2c_pi_target.c
  2. 9 0
      src/pi/i2c_pi_target.h

+ 8 - 1
src/pi/i2c_pi_target.c

@@ -126,10 +126,17 @@ void pi_i2c_mcu(){
                 // this is when WWDT resets the MCU during the charging cycle
                 battery->cycle_number = battery_limit_received.previous_cycle_number;
                 battery->batteryLimitReceived= true;
-            }    
+            }  
+            /*if(battery_limit_received.previous_cycle_number > MAX_CYCLES){
+                DL_I2C_fillTargetTXFIFO(I2C_0_INST, (uint8_t *)statusResponse[1], 1);
+            }else{
+                DL_I2C_fillTargetTXFIFO(I2C_0_INST, (uint8_t *)statusResponse[0], 1);
+            }
+            DL_I2C_flushTargetTXFIFO(I2C_0_INST);*/
         }
         rx_index= 0;
         DL_I2C_flushTargetRXFIFO(I2C_0_INST);
+        
     }
 }
 

+ 9 - 0
src/pi/i2c_pi_target.h

@@ -27,6 +27,15 @@ typedef struct __attribute__((packed)){
     uint8_t previous_cycle_number;
 } BatteryLimitMsg;
 
+typedef enum{
+    SUCCESS = 0x00,
+    INVALID_CYCLE= 0x01,
+    ERROR= 0x02
+}statusResponse;
+
+typedef struct{
+    statusResponse status_response;   
+}statusResponsePi;
 
 void dynamic_gpio_addressing();
 void pi_i2c_mcu();