|
|
@@ -16,7 +16,7 @@ void controllerSetCurrent(uint8_t slot_id, int16_t current_mA){
|
|
|
|
|
|
//For dynamic addressing:
|
|
|
uint8_t target_address= TARGET_BASE_ADDRESS + ((slot_id & 0b00000100) >> 2);
|
|
|
- printf("Target Address 0x%02X \n", target_address);
|
|
|
+ //printf("Target Address 0x%02X \n", target_address);
|
|
|
|
|
|
//Bitmasked: Slot id + Command
|
|
|
uint8_t txBuffer_setCurrent[3];
|
|
|
@@ -57,8 +57,8 @@ bool controllerGetBatteryMeasurement(uint8_t slot_id){
|
|
|
|
|
|
//Dynamic addressing:
|
|
|
uint8_t target_address= TARGET_BASE_ADDRESS + ((slot_id & 0b00000100) >> 2);
|
|
|
- printf("Target Address 0x%02X \n", target_address);
|
|
|
-
|
|
|
+ //printf("BatteryMeasurement\n");
|
|
|
+ delay_cycles(1000000);
|
|
|
//Enable the Interrupt:
|
|
|
DL_I2C_enableInterrupt(I2C_1_INST, DL_I2C_INTERRUPT_CONTROLLER_TXFIFO_TRIGGER);
|
|
|
|
|
|
@@ -70,7 +70,7 @@ bool controllerGetBatteryMeasurement(uint8_t slot_id){
|
|
|
//Calling helper function for i2c write:
|
|
|
i2c_hal.write(target_address, (uint8_t *)&txPacket.txBuffer[0], 1);
|
|
|
|
|
|
- printf("[I2C] TX Packet Sent:: 0x%02X\n", txPacket.txBuffer[0]);
|
|
|
+ //printf("[I2C] TX Packet Sent:: 0x%02X\n", txPacket.txBuffer[0]);
|
|
|
|
|
|
/* Poll until the Controller writes all bytes */
|
|
|
uint32_t timeout= 32000;
|
|
|
@@ -109,9 +109,9 @@ bool controllerGetBatteryMeasurement(uint8_t slot_id){
|
|
|
|
|
|
//DEBUG
|
|
|
//printf("[I2C] Successfully read %d bytes from target 0x%02X\n", rxPacket.rxCount, TARGET_BASE_ADDRESS);
|
|
|
- printf("Voltage: %u\n", battery_data[slot_id].battery_measurement.voltage);
|
|
|
+ /*printf("Voltage: %u\n", battery_data[slot_id].battery_measurement.voltage);
|
|
|
printf("Current: %u\n", battery_data[slot_id].battery_measurement.current);
|
|
|
printf("Temp: %u\n",battery_data[slot_id].battery_measurement.temperature);
|
|
|
- printf("Slot state: %u\n",battery_data[slot_id].battery_measurement.slot_state);
|
|
|
+ printf("Slot state: %u\n",battery_data[slot_id].battery_measurement.slot_state);*/
|
|
|
return true;
|
|
|
}
|