|
@@ -104,17 +104,19 @@ void pi_i2c_mcu(){
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
uint8_t rx_index= 0;
|
|
uint8_t rx_index= 0;
|
|
|
|
|
+ uint8_t rxBatteryLimits[12];
|
|
|
uint8_t requestedSlot= (receivedCommand & 0xF0)>>4;
|
|
uint8_t requestedSlot= (receivedCommand & 0xF0)>>4;
|
|
|
while(rx_index < (sizeof(BatteryLimitMsg))){
|
|
while(rx_index < (sizeof(BatteryLimitMsg))){
|
|
|
if(!DL_I2C_isTargetRXFIFOEmpty(I2C_0_INST)){
|
|
if(!DL_I2C_isTargetRXFIFOEmpty(I2C_0_INST)){
|
|
|
- rxPacket.rxBuffer[rx_index]= DL_I2C_receiveTargetData(I2C_0_INST);
|
|
|
|
|
|
|
+ rxBatteryLimits[rx_index]= DL_I2C_receiveTargetData(I2C_0_INST);
|
|
|
|
|
+ //rxPacket.rxBuffer[rx_index]= DL_I2C_receiveTargetData(I2C_0_INST);
|
|
|
rx_index++;
|
|
rx_index++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//Check if all the data is received then store the battery limits in BatteryInfo struct:
|
|
//Check if all the data is received then store the battery limits in BatteryInfo struct:
|
|
|
if(rx_index== (sizeof(BatteryLimitMsg))){
|
|
if(rx_index== (sizeof(BatteryLimitMsg))){
|
|
|
BatteryLimitMsg battery_limit_received;
|
|
BatteryLimitMsg battery_limit_received;
|
|
|
- memcpy(&battery_limit_received, (const uint8_t*)rxPacket.rxBuffer, sizeof(BatteryLimitMsg));
|
|
|
|
|
|
|
+ memcpy(&battery_limit_received, (const uint8_t*)rxBatteryLimits, sizeof(BatteryLimitMsg));
|
|
|
if(requestedSlot < NUM_SLOTS){
|
|
if(requestedSlot < NUM_SLOTS){
|
|
|
BatteryInfo *battery = &battery_data[requestedSlot];
|
|
BatteryInfo *battery = &battery_data[requestedSlot];
|
|
|
battery->min_voltage = battery_limit_received.min_voltage;
|
|
battery->min_voltage = battery_limit_received.min_voltage;
|