瀏覽代碼

Refactored the main page by removing unnecessary flags and fill buffer

namrota ghosh 7 月之前
父節點
當前提交
991707d688
共有 1 個文件被更改,包括 4 次插入14 次删除
  1. 4 14
      main.c

+ 4 - 14
main.c

@@ -12,11 +12,9 @@
 
 
 //define the varibales:
-volatile bool mcuSendCommand = false;
 volatile bool picommandPending = false;
 volatile bool watchdog_triggered= false;
-volatile uint8_t current_command= 0x06;
-volatile bool txCommandSent= false;
+
 
 // Interrupt for I2C instance -> MCU to Target
 
@@ -28,8 +26,7 @@ void I2C_1_INST_IRQHandler(void)
             break;
 
         case DL_I2C_IIDX_CONTROLLER_RXFIFO_TRIGGER:
-            mcuSendCommand= true;
-            
+      
             while(DL_I2C_isControllerRXFIFOEmpty(I2C_1_INST) != true) {
                 if(rxPacket.rxCount < rxPacket.rxLen){
                      //Get byte from the I2C RX FIFO of the target
@@ -49,13 +46,11 @@ void I2C_1_INST_IRQHandler(void)
             
         case DL_I2C_IIDX_CONTROLLER_TXFIFO_TRIGGER:
             /* Fill TX FIFO with bytes to send */
-            mcuSendCommand = true;
-            DL_I2C_fillControllerTXFIFO(I2C_1_INST, (uint8_t *)&txPacket.txBuffer[0], 1); 
+            //DL_I2C_fillControllerTXFIFO(I2C_1_INST, (uint8_t *)&txPacket.txBuffer[0], 1); 
             txPacket.txComplete= true; 
             break;
 
         case DL_I2C_IIDX_CONTROLLER_STOP:
-            mcuSendCommand = true;
             rxPacket.rxComplete= true;
             txPacket.txComplete= true;
             DL_I2C_flushControllerRXFIFO(I2C_1_INST);
@@ -122,12 +117,7 @@ int main(void)
             pi_i2c_mcu();
             picommandPending = false;
         }
-        if(mcuSendCommand){   
-            //printf("MCU Interrupt Triggered.\n");
-            //getBatteryMeasurement_test();
-            mcuSendCommand = false;
-            
-        }
+        
         
         for(uint8_t slot_id= 0; slot_id< NUM_SLOTS; slot_id++){
             //GET battery measurement from the Target