Selaa lähdekoodia

Logic for dynamic addressing added for setCurrent; not implemented

namrota ghosh 7 kuukautta sitten
vanhempi
commit
0355a5091b
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      src/controller/controller.c

+ 3 - 1
src/controller/controller.c

@@ -13,7 +13,9 @@ Format: command + ((slot_id) + data (optional))
 */
 //Send command to set charge and discharge current to the target
 void controller_SetCurrent(uint8_t const TARGET_ADDRESS, uint8_t slot_id, int16_t current_mA){
-
+    
+    uint8_t target_address= TARGET_BASE_ADDRESS + ((slot_id & 0b00000100) >> 2);
+    printf("Target Address 0x%02X \n", target_address);
     //Bitmasked: Slot id + Command
     uint8_t txBuffer_setCurrent[3]; 
     txBuffer_setCurrent[0]= (slot_id<<4) | (CMD_SET_CURRENT & 0x0F);