Browse Source

added controller and pi i2c communication fixed and working

namrota ghosh 6 months ago
parent
commit
85f940b37b
2 changed files with 3 additions and 3 deletions
  1. 1 1
      src/controller/controller.c
  2. 2 2
      src/pi/i2c_pi_target.c

+ 1 - 1
src/controller/controller.c

@@ -45,7 +45,7 @@ void controller_SetCurrent(uint8_t slot_id, int16_t current_mA){
     }
     printf("STATUS ***SetCurrent successful for slot %d with current %d mA***\n", slot_id, current_mA);
     // Clean up and exit
-    DL_I2C_flushControllerTXFIFO(I2C_1_INST);
+    //DL_I2C_flushControllerTXFIFO(I2C_1_INST);
 
 }
 

+ 2 - 2
src/pi/i2c_pi_target.c

@@ -51,7 +51,7 @@ void dynamic_gpio_addressing(){
 void pi_i2c_mcu(){
     //uint8_t rxBuffer_getLimits[12];
     uint8_t receivedCommand= DL_I2C_receiveTargetData(I2C_0_INST);
-    printf("Received Command: 0x%02X\n", receivedCommand);
+    //printf("Received Command: 0x%02X\n", receivedCommand);
     if(receivedCommand == CMD_GET_BATTERY_STATUS){
         //Example: i2cget -y 1 0x20 0x01 i 4
         uint8_t status_buffer[NUM_SLOTS];
@@ -71,7 +71,7 @@ void pi_i2c_mcu(){
         //0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
 
         uint8_t requestedSlot = (receivedCommand & 0xF0)>>4;
-        printf("Requested slot:%d\n", requestedSlot);
+        //printf("Requested slot:%d\n", requestedSlot);
         BatteryData battery_measure;
         if(requestedSlot >= NUM_SLOTS){
             DL_I2C_flushTargetRXFIFO(I2C_0_INST);