|
@@ -1,5 +1,6 @@
|
|
|
|
|
|
|
|
#include "ti/driverlib/m0p/dl_core.h"
|
|
#include "ti/driverlib/m0p/dl_core.h"
|
|
|
|
|
+#include "ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h"
|
|
|
#include "ti_msp_dl_config.h"
|
|
#include "ti_msp_dl_config.h"
|
|
|
#include "src/pi/i2c_pi_target.h"
|
|
#include "src/pi/i2c_pi_target.h"
|
|
|
#include "src/controller/controller.h"
|
|
#include "src/controller/controller.h"
|
|
@@ -61,6 +62,11 @@ void I2C_1_INST_IRQHandler(void)
|
|
|
break;
|
|
break;
|
|
|
case DL_I2C_IIDX_CONTROLLER_NACK:
|
|
case DL_I2C_IIDX_CONTROLLER_NACK:
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case DL_I2C_IIDX_TIMEOUT_A:
|
|
|
|
|
+ case DL_I2C_IIDX_TIMEOUT_B:
|
|
|
|
|
+ DL_I2C_flushTargetTXFIFO(I2C_1_INST);
|
|
|
|
|
+ DL_I2C_flushTargetRXFIFO(I2C_1_INST);
|
|
|
|
|
+ break;
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -118,23 +124,25 @@ int main(void)
|
|
|
picommandPending = false;
|
|
picommandPending = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //DL_SYSCTL_getPendingNonMaskableInterrupt();
|
|
|
|
|
|
|
|
|
|
+
|
|
|
for(uint8_t slot_id= 0; slot_id< NUM_SLOTS; slot_id++){
|
|
for(uint8_t slot_id= 0; slot_id< NUM_SLOTS; slot_id++){
|
|
|
//GET battery measurement from the Target
|
|
//GET battery measurement from the Target
|
|
|
getBatteryMeasurement(slot_id);
|
|
getBatteryMeasurement(slot_id);
|
|
|
|
|
+
|
|
|
//Reading battery state:
|
|
//Reading battery state:
|
|
|
Battery_StateCondition(slot_id);
|
|
Battery_StateCondition(slot_id);
|
|
|
- printf("Battery State: %d\n", battery_data[slot_id].battery_state);
|
|
|
|
|
- //If target received battery limits from Pi then start charging, else wait with state: 3::
|
|
|
|
|
- //CC_CV_ControlCharging(slot_id, 50);
|
|
|
|
|
- if(battery_data[slot_id].batteryLimitReceived){
|
|
|
|
|
|
|
+ printf("Battery State: %d, Charging State:%d\n", battery_data[slot_id].battery_state, battery_data[slot_id].battery_charging_state);
|
|
|
|
|
+ CC_CV_ControlCharging(slot_id);
|
|
|
|
|
+ //If target received battery limits from Pi then start charging, else wait with state: 3::
|
|
|
|
|
+ /*if(battery_data[slot_id].batteryLimitReceived){
|
|
|
printf("Battery Limits: Slot: %d, Max Voltage:%u, Min Voltage:%u, "
|
|
printf("Battery Limits: Slot: %d, Max Voltage:%u, Min Voltage:%u, "
|
|
|
"Cutoff Current: %u, Capacitance:%u, Charge Fraction:%u, Cycle Number: %u\n", slot_id, battery_data[slot_id].max_voltage,
|
|
"Cutoff Current: %u, Capacitance:%u, Charge Fraction:%u, Cycle Number: %u\n", slot_id, battery_data[slot_id].max_voltage,
|
|
|
battery_data[slot_id].min_voltage, battery_data[slot_id].cut_off_current,
|
|
battery_data[slot_id].min_voltage, battery_data[slot_id].cut_off_current,
|
|
|
battery_data[slot_id].capacitance, battery_data[slot_id].charge_fraction, battery_data[slot_id].cycle_number);
|
|
battery_data[slot_id].capacitance, battery_data[slot_id].charge_fraction, battery_data[slot_id].cycle_number);
|
|
|
- CC_CV_ControlCharging(slot_id, 50);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
delay_cycles(MEASUREMENT_CHECK_INTERVAL);
|
|
delay_cycles(MEASUREMENT_CHECK_INTERVAL);
|
|
|
|
|
|