Przeglądaj źródła

Pi Battery Measurement Command Update from 0x20 to 0x02

namrota ghosh 7 miesięcy temu
rodzic
commit
0dbc1b2eaa
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      src/pi/i2c_pi_target.c

+ 4 - 4
src/pi/i2c_pi_target.c

@@ -63,10 +63,10 @@ void pi_i2c_mcu(){
         while(DL_I2C_transmitTargetDataCheck(I2C_0_INST, 0x00)!= false);
     }
     //bitmasked GET command:
-    else if((receivedCommand & 0xF0)== 0x20){
-        //I2Ctools command: i2cget -y 1 0x20 0x20 i 7
-        //Get Battery Measurement data for slot_id: Voltage, Current, Tempertaure
-        uint8_t requestedSlot = receivedCommand & 0x0F;
+    else if((receivedCommand & 0x0F)== 0x02){
+        //I2Ctools command: i2cget -y 1 0x20 0xn2 i 7
+        //Get Battery Measurement data for slot_id: Voltage, Current, Temperture
+        uint8_t requestedSlot = (receivedCommand & 0xF0)>>4;
         printf("Requested slot:%d\n", requestedSlot);
         BatteryData battery_measure;
         if(requestedSlot >= NUM_SLOTS){