Переглянути джерело

interfaces for separate peripherals

namrota ghosh 9 місяців тому
батько
коміт
4ae6d147fe
43 змінених файлів з 2611 додано та 2282 видалено
  1. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/adc.c.C783CB560A28832A.idx
  2. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/adc.h.4254346EB7A93BD8.idx
  3. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/battery.c.900D8F73FDE164C8.idx
  4. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/battery.h.DD363DA997E60BB9.idx
  5. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/dac.c.91713AFCB5D40D6E.idx
  6. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/dac.h.D233D18DB68C8427.idx
  7. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_comm_controller.h.8DD4C36B9014EBE6.idx
  8. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_controller.c.D084D0AF1C0F98F4.idx
  9. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_target.c.81C6743683C30173.idx
  10. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_target.h.4BFCCCED038EBB00.idx
  11. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/multiplexer.c.3B7B273E7C0D0C2C.idx
  12. BIN
      charge_controller_v7/Debug/.clangd/.cache/clangd/index/multiplexer.h.0A1757C0295533D6.idx
  13. 25 0
      charge_controller_v7/Debug/.clangd/compile_commands.json
  14. 152 0
      charge_controller_v7/Debug/adc.d
  15. BIN
      charge_controller_v7/Debug/adc.o
  16. 4 0
      charge_controller_v7/Debug/battery.d
  17. BIN
      charge_controller_v7/Debug/battery.o
  18. 5 0
      charge_controller_v7/Debug/ccsObjs.opt
  19. 495 582
      charge_controller_v7/Debug/charge_controller_v7.map
  20. BIN
      charge_controller_v7/Debug/charge_controller_v7.out
  21. 874 1036
      charge_controller_v7/Debug/charge_controller_v7_linkInfo.xml
  22. 152 0
      charge_controller_v7/Debug/dac.d
  23. BIN
      charge_controller_v7/Debug/dac.o
  24. 13 9
      charge_controller_v7/Debug/i2c_controller.d
  25. BIN
      charge_controller_v7/Debug/i2c_controller.o
  26. 5 0
      charge_controller_v7/Debug/i2c_target.d
  27. BIN
      charge_controller_v7/Debug/i2c_target.o
  28. 7 2
      charge_controller_v7/Debug/makefile
  29. 152 0
      charge_controller_v7/Debug/multiplexer.d
  30. BIN
      charge_controller_v7/Debug/multiplexer.o
  31. 36 6
      charge_controller_v7/Debug/subdir_vars.mk
  32. 183 0
      charge_controller_v7/adc.c
  33. 34 0
      charge_controller_v7/adc.h
  34. 40 0
      charge_controller_v7/battery.c
  35. 37 0
      charge_controller_v7/battery.h
  36. 70 0
      charge_controller_v7/dac.c
  37. 11 0
      charge_controller_v7/dac.h
  38. 159 645
      charge_controller_v7/i2c_controller.c
  39. 29 0
      charge_controller_v7/i2c_target.c
  40. 32 0
      charge_controller_v7/i2c_target.h
  41. 84 0
      charge_controller_v7/multiplexer.c
  42. 10 0
      charge_controller_v7/multiplexer.h
  43. 2 2
      charge_controller_v7/ti/comm_modules/i2c/controller/i2c_comm_controller.h

BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/adc.c.C783CB560A28832A.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/adc.h.4254346EB7A93BD8.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/battery.c.900D8F73FDE164C8.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/battery.h.DD363DA997E60BB9.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/dac.c.91713AFCB5D40D6E.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/dac.h.D233D18DB68C8427.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_comm_controller.h.8DD4C36B9014EBE6.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_controller.c.D084D0AF1C0F98F4.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_target.c.81C6743683C30173.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_target.h.4BFCCCED038EBB00.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/multiplexer.c.3B7B273E7C0D0C2C.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/multiplexer.h.0A1757C0295533D6.idx


+ 25 - 0
charge_controller_v7/Debug/.clangd/compile_commands.json

@@ -9,6 +9,31 @@
       "command"   : "clang++ -D__MSPM0G3507__ -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7\" -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/armv7em-ti-none-eabihf/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/lib/clang/18/include\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c\"",
       "file"      : "/home/ngosh/workspace_ccstheia/charge_controller_v7/ti/comm_modules/i2c/controller/i2c_comm_controller.c"
    },
+   {
+      "directory" : "/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug",
+      "command"   : "clang++ -D__MSPM0G3507__ -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7\" -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/armv7em-ti-none-eabihf/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/lib/clang/18/include\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c\"",
+      "file"      : "/home/ngosh/workspace_ccstheia/charge_controller_v7/battery.c"
+   },
+   {
+      "directory" : "/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug",
+      "command"   : "clang++ -D__MSPM0G3507__ -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7\" -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/armv7em-ti-none-eabihf/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/lib/clang/18/include\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c\"",
+      "file"      : "/home/ngosh/workspace_ccstheia/charge_controller_v7/i2c_target.c"
+   },
+   {
+      "directory" : "/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug",
+      "command"   : "clang++ -D__MSPM0G3507__ -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7\" -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/armv7em-ti-none-eabihf/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/lib/clang/18/include\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c\"",
+      "file"      : "/home/ngosh/workspace_ccstheia/charge_controller_v7/multiplexer.c"
+   },
+   {
+      "directory" : "/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug",
+      "command"   : "clang++ -D__MSPM0G3507__ -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7\" -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/armv7em-ti-none-eabihf/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/lib/clang/18/include\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c\"",
+      "file"      : "/home/ngosh/workspace_ccstheia/charge_controller_v7/adc.c"
+   },
+   {
+      "directory" : "/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug",
+      "command"   : "clang++ -D__MSPM0G3507__ -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7\" -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/armv7em-ti-none-eabihf/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/lib/clang/18/include\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c\"",
+      "file"      : "/home/ngosh/workspace_ccstheia/charge_controller_v7/dac.c"
+   },
    {
       "directory" : "/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug",
       "command"   : "clang++ -D__MSPM0G3507__ -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7\" -I\"/home/ngosh/workspace_ccstheia/charge_controller_v7/Debug\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include\" -I\"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/armv7em-ti-none-eabihf/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c++/v1\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/lib/clang/18/include\" -isystem\"/home/ngosh/ti/ccstheia151/ccs/tools/compiler/ti-cgt-armllvm_4.0.0.LTS/include/c\"",

+ 152 - 0
charge_controller_v7/Debug/adc.d

@@ -0,0 +1,152 @@
+# FIXED
+
+adc.o: ../adc.c /home/ngosh/workspace_ccstheia/charge_controller_v7/adc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include/core_cm0plus.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_adc12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_aes.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_comp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_crc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dac12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dma.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_flashctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gpio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gptimer.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_i2c.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_iomux.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mathacl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mcan.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_oa.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_rtc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_spi.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_trng.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_uart.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_vref.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wuc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_factoryregion.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_cpuss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_debugss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h \
+ ti_msp_dl_config.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aesadv.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_comp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crcp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dac12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dma.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_flashctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_sysctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpamp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_iwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lfss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_keystorectl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lcd.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mathacl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mcan.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_opa.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_common.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_a.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_b.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_scratchpad.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_spi.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_tamperio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timera.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timer.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timerg.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_trng.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_extend.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_main.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_vref.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_wwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h
+/home/ngosh/workspace_ccstheia/charge_controller_v7/adc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include/core_cm0plus.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_adc12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_aes.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_comp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_crc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dac12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dma.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_flashctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gpio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gptimer.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_i2c.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_iomux.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mathacl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mcan.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_oa.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_rtc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_spi.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_trng.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_uart.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_vref.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wuc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_factoryregion.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_cpuss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_debugss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h:
+ti_msp_dl_config.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aesadv.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_comp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crcp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dac12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dma.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_flashctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_sysctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpamp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_iwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lfss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_keystorectl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lcd.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mathacl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mcan.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_opa.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_common.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_a.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_b.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_scratchpad.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_spi.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_tamperio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timera.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timer.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timerg.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_trng.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_extend.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_main.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_vref.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_wwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h:

BIN
charge_controller_v7/Debug/adc.o


+ 4 - 0
charge_controller_v7/Debug/battery.d

@@ -0,0 +1,4 @@
+# FIXED
+
+battery.o: ../battery.c ../battery.h
+../battery.h:

BIN
charge_controller_v7/Debug/battery.o


+ 5 - 0
charge_controller_v7/Debug/ccsObjs.opt

@@ -1,6 +1,11 @@
+"./adc.o"
+"./battery.o"
+"./dac.o"
 "./i2c_controller.o"
 "./ti_msp_dl_config.o"
 "./startup_mspm0g350x_ticlang.o"
+"./i2c_target.o"
+"./multiplexer.o"
 "./ti/comm_modules/i2c/controller/i2c_comm_controller.o"
 -l"./device_linker.cmd"
 -ldevice.cmd.genlibs

Різницю між файлами не показано, бо вона завелика
+ 495 - 582
charge_controller_v7/Debug/charge_controller_v7.map


BIN
charge_controller_v7/Debug/charge_controller_v7.out


Різницю між файлами не показано, бо вона завелика
+ 874 - 1036
charge_controller_v7/Debug/charge_controller_v7_linkInfo.xml


+ 152 - 0
charge_controller_v7/Debug/dac.d

@@ -0,0 +1,152 @@
+# FIXED
+
+dac.o: ../dac.c ../dac.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include/core_cm0plus.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_adc12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_aes.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_comp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_crc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dac12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dma.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_flashctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gpio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gptimer.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_i2c.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_iomux.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mathacl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mcan.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_oa.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_rtc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_spi.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_trng.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_uart.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_vref.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wuc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_factoryregion.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_cpuss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_debugss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h \
+ ti_msp_dl_config.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aesadv.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_comp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crcp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dac12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dma.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_flashctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_sysctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpamp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_iwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lfss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_keystorectl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lcd.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mathacl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mcan.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_opa.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_common.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_a.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_b.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_scratchpad.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_spi.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_tamperio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timera.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timer.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timerg.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_trng.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_extend.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_main.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_vref.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_wwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h
+../dac.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include/core_cm0plus.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_adc12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_aes.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_comp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_crc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dac12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dma.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_flashctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gpio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gptimer.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_i2c.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_iomux.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mathacl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mcan.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_oa.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_rtc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_spi.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_trng.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_uart.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_vref.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wuc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_factoryregion.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_cpuss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_debugss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h:
+ti_msp_dl_config.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aesadv.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_comp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crcp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dac12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dma.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_flashctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_sysctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpamp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_iwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lfss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_keystorectl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lcd.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mathacl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mcan.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_opa.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_common.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_a.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_b.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_scratchpad.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_spi.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_tamperio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timera.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timer.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timerg.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_trng.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_extend.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_main.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_vref.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_wwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h:

BIN
charge_controller_v7/Debug/dac.o


+ 13 - 9
charge_controller_v7/Debug/i2c_controller.d

@@ -2,7 +2,7 @@
 
 i2c_controller.o: ../i2c_controller.c \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dac12.h \
- /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h \
@@ -33,12 +33,12 @@ i2c_controller.o: ../i2c_controller.c \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h \
- /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h \
  ti_msp_dl_config.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h \
- /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h \
- /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aesadv.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_comp.h \
@@ -75,9 +75,10 @@ i2c_controller.o: ../i2c_controller.c \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_wwdt.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h \
- ../ti/comm_modules/i2c/controller/i2c_comm_controller.h
+ ../ti/comm_modules/i2c/controller/i2c_comm_controller.h \
+ ../multiplexer.h ../adc.h ../dac.h
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dac12.h:
-/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h:
@@ -108,12 +109,12 @@ i2c_controller.o: ../i2c_controller.c \
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h:
-/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h:
 ti_msp_dl_config.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h:
-/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h:
-/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aesadv.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_comp.h:
@@ -151,3 +152,6 @@ ti_msp_dl_config.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h:
 ../ti/comm_modules/i2c/controller/i2c_comm_controller.h:
+../multiplexer.h:
+../adc.h:
+../dac.h:

BIN
charge_controller_v7/Debug/i2c_controller.o


+ 5 - 0
charge_controller_v7/Debug/i2c_target.d

@@ -0,0 +1,5 @@
+# FIXED
+
+i2c_target.o: ../i2c_target.c ../i2c_target.h ../battery.h
+../i2c_target.h:
+../battery.h:

BIN
charge_controller_v7/Debug/i2c_target.o


+ 7 - 2
charge_controller_v7/Debug/makefile

@@ -8,9 +8,14 @@ GEN_OPTS__FLAG := @"./device.opt"
 GEN_CMDS__FLAG := -Wl,-l"./device_linker.cmd" 
 
 ORDERED_OBJS += \
+"./adc.o" \
+"./battery.o" \
+"./dac.o" \
 "./i2c_controller.o" \
 "./ti_msp_dl_config.o" \
 "./startup_mspm0g350x_ticlang.o" \
+"./i2c_target.o" \
+"./multiplexer.o" \
 "./ti/comm_modules/i2c/controller/i2c_comm_controller.o" \
 $(GEN_CMDS__FLAG) \
 -Wl,-ldevice.cmd.genlibs \
@@ -144,8 +149,8 @@ charge_controller_v7.out: $(OBJS) $(GEN_CMDS)
 # Other Targets
 clean:
 	-$(RM) $(GEN_MISC_FILES__QUOTED)$(GEN_FILES__QUOTED)$(EXE_OUTPUTS__QUOTED)
-	-$(RM) "i2c_controller.o" "ti_msp_dl_config.o" "startup_mspm0g350x_ticlang.o" "ti/comm_modules/i2c/controller/i2c_comm_controller.o" 
-	-$(RM) "i2c_controller.d" "ti_msp_dl_config.d" "startup_mspm0g350x_ticlang.d" "ti/comm_modules/i2c/controller/i2c_comm_controller.d" 
+	-$(RM) "adc.o" "battery.o" "dac.o" "i2c_controller.o" "ti_msp_dl_config.o" "startup_mspm0g350x_ticlang.o" "i2c_target.o" "multiplexer.o" "ti/comm_modules/i2c/controller/i2c_comm_controller.o" 
+	-$(RM) "adc.d" "battery.d" "dac.d" "i2c_controller.d" "ti_msp_dl_config.d" "startup_mspm0g350x_ticlang.d" "i2c_target.d" "multiplexer.d" "ti/comm_modules/i2c/controller/i2c_comm_controller.d" 
 	-@echo 'Finished clean'
 	-@echo ' '
 

+ 152 - 0
charge_controller_v7/Debug/multiplexer.d

@@ -0,0 +1,152 @@
+# FIXED
+
+multiplexer.o: ../multiplexer.c ../multiplexer.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include/core_cm0plus.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_adc12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_aes.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_comp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_crc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dac12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dma.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_flashctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gpio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gptimer.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_i2c.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_iomux.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mathacl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mcan.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_oa.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_rtc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_spi.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_trng.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_uart.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_vref.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wuc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_factoryregion.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_cpuss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_debugss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h \
+ ti_msp_dl_config.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aesadv.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_comp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crcp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dac12.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dma.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_flashctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_sysctl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpamp.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_iwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lfss.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_keystorectl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lcd.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mathacl.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mcan.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_opa.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_common.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_a.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_b.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_scratchpad.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_spi.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_tamperio.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timera.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timer.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timerg.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_trng.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_extend.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_main.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_vref.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_wwdt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h
+../multiplexer.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/third_party/CMSIS/Core/Include/core_cm0plus.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_adc12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_aes.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_comp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_crc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dac12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_dma.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_flashctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gpio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_gptimer.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_i2c.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_iomux.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mathacl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_mcan.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_oa.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_rtc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_spi.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_trng.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_uart.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_vref.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wuc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/hw_wwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_factoryregion.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_cpuss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_debugss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h:
+ti_msp_dl_config.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aesadv.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_comp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_crcp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dac12.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_dma.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_flashctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_sysctl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpamp.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_iwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lfss.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_keystorectl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lcd.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mathacl.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_mcan.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_opa.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_common.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_a.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_rtc_b.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_scratchpad.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_spi.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_tamperio.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timera.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timer.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_timerg.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_trng.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_extend.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_uart_main.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_vref.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_wwdt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h:

BIN
charge_controller_v7/Debug/multiplexer.o


+ 36 - 6
charge_controller_v7/Debug/subdir_vars.mk

@@ -7,9 +7,14 @@ SYSCFG_SRCS += \
 ../i2c_controller.syscfg 
 
 C_SRCS += \
+../adc.c \
+../battery.c \
+../dac.c \
 ../i2c_controller.c \
 ./ti_msp_dl_config.c \
-/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0g350x_ticlang.c 
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0g350x_ticlang.c \
+../i2c_target.c \
+../multiplexer.c 
 
 GEN_CMDS += \
 ./device_linker.cmd 
@@ -20,35 +25,55 @@ GEN_FILES += \
 ./ti_msp_dl_config.c 
 
 C_DEPS += \
+./adc.d \
+./battery.d \
+./dac.d \
 ./i2c_controller.d \
 ./ti_msp_dl_config.d \
-./startup_mspm0g350x_ticlang.d 
+./startup_mspm0g350x_ticlang.d \
+./i2c_target.d \
+./multiplexer.d 
 
 GEN_OPTS += \
 ./device.opt 
 
 OBJS += \
+./adc.o \
+./battery.o \
+./dac.o \
 ./i2c_controller.o \
 ./ti_msp_dl_config.o \
-./startup_mspm0g350x_ticlang.o 
+./startup_mspm0g350x_ticlang.o \
+./i2c_target.o \
+./multiplexer.o 
 
 GEN_MISC_FILES += \
 ./device.cmd.genlibs \
 ./ti_msp_dl_config.h 
 
 OBJS__QUOTED += \
+"adc.o" \
+"battery.o" \
+"dac.o" \
 "i2c_controller.o" \
 "ti_msp_dl_config.o" \
-"startup_mspm0g350x_ticlang.o" 
+"startup_mspm0g350x_ticlang.o" \
+"i2c_target.o" \
+"multiplexer.o" 
 
 GEN_MISC_FILES__QUOTED += \
 "device.cmd.genlibs" \
 "ti_msp_dl_config.h" 
 
 C_DEPS__QUOTED += \
+"adc.d" \
+"battery.d" \
+"dac.d" \
 "i2c_controller.d" \
 "ti_msp_dl_config.d" \
-"startup_mspm0g350x_ticlang.d" 
+"startup_mspm0g350x_ticlang.d" \
+"i2c_target.d" \
+"multiplexer.d" 
 
 GEN_FILES__QUOTED += \
 "device_linker.cmd" \
@@ -56,9 +81,14 @@ GEN_FILES__QUOTED += \
 "ti_msp_dl_config.c" 
 
 C_SRCS__QUOTED += \
+"../adc.c" \
+"../battery.c" \
+"../dac.c" \
 "../i2c_controller.c" \
 "./ti_msp_dl_config.c" \
-"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0g350x_ticlang.c" 
+"/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0g350x_ticlang.c" \
+"../i2c_target.c" \
+"../multiplexer.c" 
 
 SYSCFG_SRCS__QUOTED += \
 "../i2c_controller.syscfg" 

+ 183 - 0
charge_controller_v7/adc.c

@@ -0,0 +1,183 @@
+#include <adc.h>
+#include <stdint.h>
+#include <stdio.h>
+#include "ti/driverlib/dl_i2c.h"
+#include "ti_msp_dl_config.h"
+
+volatile bool gRxComplete;
+volatile bool gTxComplete;
+uint8_t gTxPacket[I2C_TX_MAX_PACKET_SIZE];
+uint8_t gRxPacket[I2C_RX_MAX_PACKET_SIZE];
+
+uint32_t gTxADClen, gTxADCcount;
+uint32_t gRxADClen, gRxADCcount;
+
+uint8_t ADC_ConstructConfigBytes(ADC_PARAMS params) {
+
+    uint8_t config = 0;
+
+    
+    config |= ((params.channel - 1) << 5);  // Channel Selection (Bits 6-5)
+
+    if (params.continuous) config |= (1 << 4);  // Continuous Mode (Bit 4)
+
+    switch (params.resolution) {
+        case 12: config |= (0b00 << 2); break;
+        case 14: config |= (0b01 << 2); break;       
+        case 16: config |= (0b10 << 2); break;
+        default: printf("ERROR: Invalid Resolution!\n"); return 0;
+    }
+
+    switch (params.gain) {
+        case 1: config |= (0b00); break;
+        case 2: config |= (0b01); break;
+        case 4: config |= (0b10); break;
+        default: printf("ERROR: Invalid Gain!\n"); return 0;
+    }
+
+    return config;
+}
+
+/* Tansmit Data from MCU to ADC:  Function to SET configuration to ADC over I2C*/
+
+void ADC_SetConfigurationBytes(ADC_PARAMS params) {
+    // **Step 1: Construct Configuration Byte**
+    uint8_t config_byte = ADC_ConstructConfigBytes(params);
+
+    //printf("Writing Config: 0x%02X to ADC (0x%X)...\n", config_byte, DEF_TARGET_ADDR_ADC);
+
+    // **Step 2: Wait for I2C Bus to be Free**
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+    // **Step 3: Start I2C Write Transaction**
+    // Prepare TX Buffer:
+    gTxPacket[0]= config_byte;
+    gTxADClen= 1;
+    gTxADCcount= 0;
+    gTxComplete= true;
+    DL_I2C_startControllerTransfer(I2C_controller_INST, ADC_TARGET_BASE_ADDRESS, DL_I2C_CONTROLLER_DIRECTION_TX, gTxADClen);
+    DL_I2C_enableInterrupt(I2C_controller_INST, DL_I2C_INTERRUPT_CONTROLLER_TXFIFO_TRIGGER);
+
+    while(!gTxComplete);
+    // **Load Configuration Byte into TX FIFO**
+    //DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &config_byte, 1);
+
+    // **Ensure STOP Condition is Sent**
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+    
+    printf("Configuration Sent Successfully for 0x%X!\n", config_byte);
+}
+
+/*
+Function to read ADC DATA: This function simply retrieves the ADC raw digital output as 16-bit signed integer. 
+* The value returned is not yet converted to VOLTAGE.
+* adc_data[2]: Buffer with an array of size 2, to store two bytes of ADC data. 
+*             Since, the ADC output consists of two 8-bit bytes:
+*             - adc_data[0] (MSB)
+*             - adc_data[1] (LSB)
+* Next, we verify if the the I2C bus is busy using the function in the driverlib: DL_I2C_get ControllerStatus
+*       - Prevents collisions by ensuring no two I2C device is using the same bus before initializing.
+* BEGIN I2C READ operation to request 2 bytes from the ADC-> DL_I2C_startControllerTransfer()
+* Parameters:
+    - I2C_controller_INST: Refererence to the I2C instance bring used.
+    - DEF_TARGET_ADDR_ADC: Address of the ADC
+    - DL_I2C_CONTROLLER_DIRECTION_RX: Indicates that we want to receive the data from ADC
+    - 2: Specifies that we expect 2 bytes from the ADC
+* WAIT for the data to be received: (DL_I2C_getControllerStatus())
+    - Waits until the ADC sends the data over I2C.
+    - Ensures that the data transfer is complete before proceeding.
+* READ the two bytes of ADc Data:
+    - adc_data[0] : MSB
+    - adc_data[1] : LSB
+    - adc_data[2] : config_bytes
+    ADC sends its 16-bit value in two parts over 8-bit I2C data frames.
+* COMBINE the two bytes into 16-bit Integer:
+    - Shifts the MSB(first byte) left by 8 bits to make space for LSB.
+    - Performs a bitwise OR operation to combine MSB and LSB into a single 16-bit number.
+* PRINT HEXADEC and DECIMAL format for DEBUGGING.
+* Output code is in binary and is proportional to the Input Voltage and PGA settings.
+* From the datasheet: https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/22226a.pdf
+    - Equation 4.4 is being used to convert the output codes to input voltage
+*/
+
+int16_t ADC_ReadData(ADC_PARAMS params)
+{
+    uint8_t adc_data[3] = {0};  // Buffer for ADC data (MSB, LSB, Config Byte)
+    int16_t raw_adc = 0;
+    /*The ACK bits after conversion is issued by the Master, when the device receives a READ command, it outputs two data bytes
+    followed by a configuration register
+    in 16 bit conversion mode the MSB(=sign bit) of the first data type is D15.
+    */
+    uint8_t bytes_to_read= 3;
+    
+    printf("Reading ADC Data from MCP3428...\n");
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+    // Determine bytes to read
+    //printf("Resolution for reading ADC is %d\n", resolution);
+    // Request 3 Bytes from ADC**
+    //DL_I2C_startControllerTransfer(I2C_controller_INST, DEF_TARGET_ADDR_ADC, DL_I2C_CONTROLLER_DIRECTION_RX, bytes_to_read);
+    gRxADClen= bytes_to_read;
+    gRxADCcount= 0;
+    gRxComplete= false;
+
+    DL_I2C_startControllerTransfer(I2C_controller_INST, ADC_TARGET_BASE_ADDRESS, DL_I2C_CONTROLLER_DIRECTION_RX, gRxADClen);
+    DL_I2C_enableInterrupt(I2C_controller_INST, DL_I2C_INTERRUPT_CONTROLLER_RXFIFO_TRIGGER);
+    //while(!gRxComplete);
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+    uint8_t config_adc_byte= gRxPacket[2];
+    uint8_t msb= gRxPacket[0];
+    uint8_t lsb= gRxPacket[1];
+
+    if (params.resolution==16){
+        raw_adc= (msb << 8)| lsb;
+        if(raw_adc > 32767) raw_adc-= 65536;
+    }
+    else if (params.resolution == 14) {
+        raw_adc= ((msb & 0b00111111) << 8)| lsb;
+        if(raw_adc > 8191) raw_adc-= 16384;
+    }
+    else if(params.resolution == 12){
+        raw_adc = ((msb & 0b00001111) << 8) | lsb; 
+        if (raw_adc > 2047) raw_adc -= 4096; 
+
+    }
+    printf("Raw ADC Value: 0x%0X (%d)\n", raw_adc, raw_adc);
+    return raw_adc;
+   
+}
+
+
+/* Function to Convert ADC Reading to Voltage */
+uint16_t ADC_ConvertToVoltage(int16_t adc_value, ADC_PARAMS params) {
+    uint32_t measured_voltage= 0;
+    uint16_t LSB= 0;
+    uint32_t max_adc_value= 1;
+
+     switch (params.resolution) {
+        case 12:  // 12-bit
+            max_adc_value = 4095;
+            break;
+        case 14:  // 14-bit
+            max_adc_value = 16383;
+            break;
+        case 16:  // 16-bit
+            max_adc_value = 65535;
+            break;
+        default:
+            printf("Error: Unknown ADC Resolution!\n");
+            return 0;
+        }
+    measured_voltage= (((uint32_t)adc_value * ADC_VREF_MV) * 3)/max_adc_value;
+
+    
+    /*Formula for ADC to Voltage Conversion*/
+    //voltage = (adc_value / max_adc_value)* VREF/gain;
+   
+    printf("Converted Voltage: %d mV\n", measured_voltage);
+    return (uint16_t)measured_voltage;
+}
+
+
+
+

+ 34 - 0
charge_controller_v7/adc.h

@@ -0,0 +1,34 @@
+#ifndef ADC_H_
+#include "ti/driverlib/dl_i2c.h"
+#include "ti_msp_dl_config.h"
+
+#define ADC_TARGET_BASE_ADDRESS (0x68)
+#define ADC_VREF_MV (2048)
+
+//Maximum packet sizes
+#define I2C_TX_MAX_PACKET_SIZE (16)
+#define I2C_RX_MAX_PACKET_SIZE (16)
+
+//Flag for READ and WRITE
+extern volatile bool gRxComplete;
+extern volatile bool gTxComplete;
+extern uint8_t gTxPacket[I2C_TX_MAX_PACKET_SIZE];
+extern uint8_t gRxPacket[I2C_RX_MAX_PACKET_SIZE];
+
+/*Counters for Tx and Rx length and bytes sent*/
+extern uint32_t gTxADClen, gTxADCcount;
+extern uint32_t gRxADClen, gRxADCcount;
+
+typedef struct{
+    uint8_t channel;
+    uint8_t resolution;
+    bool continuous;
+    uint8_t gain;
+} ADC_PARAMS;
+
+uint8_t ADC_ConstructConfigBytes(ADC_PARAMS params);
+void ADC_SetConfigurationBytes(ADC_PARAMS params);
+int16_t ADC_ReadData(ADC_PARAMS params);
+uint16_t ADC_ConvertToVoltage(int16_t adc_value, ADC_PARAMS params);
+
+#endif

+ 40 - 0
charge_controller_v7/battery.c

@@ -0,0 +1,40 @@
+#include "battery.h"
+
+
+
+
+Battery batteries[NUM_SLOTS];
+
+// Permissible charge temperature for LiIon battery is 0.0 degree Celsius to 45.0 degree Celsius
+// Correct temp_threshold yet to be analyzed
+#define TEMP_THRESHOLD  (460)
+//#define VOLTAGE_THRESHOLD ()
+
+uint16_t charge_change_threshold;
+
+/*Initialize battery array and default parameters*/
+void Battery_Init(){
+    for(uint8_t i=0; i< NUM_SLOTS; i++){
+    batteries[i].slot_id= i;
+    batteries[i].state= STATE_EMPTY;
+    batteries[i].voltage= 0;
+    batteries[i].current= 0;
+    batteries[i].temperature= 0;
+    batteries[i].min_voltage= 0;
+    batteries[i].max_voltage= 0;
+    batteries[i].cut_off_current= 0;
+    batteries[i].capacitance= 0;
+
+    }
+}
+
+void Battery_SafetyCheck(uint8_t slot){
+    if(slot>= NUM_SLOTS){
+        return;
+    }
+
+    if (batteries[slot].temperature > TEMP_THRESHOLD){
+        batteries[slot].state= STATE_OVERCHARGING;
+        //How to exit? Disable the DAC channel?
+    }
+}

+ 37 - 0
charge_controller_v7/battery.h

@@ -0,0 +1,37 @@
+#ifndef BATTERY_H
+#define BATTERY_H
+#include <stdint.h>
+
+//define macro to be used by multiple files in the program witout the variable being overwritten
+
+#define NUM_SLOTS              (8)
+
+typedef enum{
+    STATE_EMPTY= 0x01,
+    STATE_BATTERY_DETECTED= 0x02,
+    STATE_MEASUREMENT= 0x03,
+    STATE_MEASUREMENT_IN_PROGESS= 0x04,
+    STATE_OVERCHARGING= 0x05
+} BatteryState;
+
+//Battery Structure
+
+typedef struct{
+    uint8_t slot_id;
+    BatteryState state;
+    uint16_t voltage;
+    int16_t current;
+    uint16_t temperature;
+    uint16_t min_voltage;
+    uint16_t max_voltage;
+    uint16_t cut_off_current;
+    uint16_t capacitance;
+} Battery;
+
+//global battery array declaration: extending visiblity of the variable to multiple source files
+extern Battery batteries[NUM_SLOTS];
+
+void Battery_Init();
+void Battery_SafetyCheck(uint8_t slot);
+
+#endif

+ 70 - 0
charge_controller_v7/dac.c

@@ -0,0 +1,70 @@
+#include "dac.h"
+#include <stdint.h>
+#include <stdio.h>
+#include "ti/driverlib/dl_i2c.h"
+#include "ti_msp_dl_config.h"
+
+
+//The device updates all DAC analog output(vout) at the same time
+
+void DAC_UpdateOutput() {
+    uint8_t general_call_command = 0x08;  // General Call Update Command
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &general_call_command, 1);
+
+    // Start I2C transaction
+    DL_I2C_startControllerTransfer(I2C_controller_INST, 0x00, DL_I2C_CONTROLLER_DIRECTION_TX, 1);
+    
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+    printf("DAC Outputs Updated via General Call Software Update!\n");
+}
+
+/**Function for FAST write command, sending values over I2c to every channel of DAC**/
+bool DAC_fastWrite(uint16_t channel_a_value){
+
+    /*DAC has a 12 bit resolution that ranges from 0 to 4095.
+    0x00: sets the Power Mode to NORMAL for Channel A
+    (channel_a_value >> 8): shifts the value to 8 places right and gives upper 4 bits
+    */
+
+    uint8_t output_buffer[8];
+
+    output_buffer[0]= (0x00)|(channel_a_value >> 8)&0x0F;
+    //output_buffer[0] = channel_a_value >> 8;
+    output_buffer[1]= channel_a_value & 0xFF;
+
+    output_buffer[2]= 0x40; // Power down for the other channels
+    output_buffer[3]= 0x00; 
+
+    output_buffer[4]= 0x40;
+    output_buffer[5]= 0x00;
+
+    output_buffer[6]= 0x40;
+    output_buffer[7]= 0x00;
+
+    if (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_ERROR) {
+        printf("I2C Write Error: Failed to write to DAC channels for FAST write mode!\n");
+        return false;  // Return failure if there was an error
+    }
+
+    // **Wait for I2C Bus to be Free**
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+
+    
+
+    // **Start I2C Write Transaction**
+    DL_I2C_startControllerTransfer(I2C_controller_INST, DAC_TARGET_BASE_ADDRESS, DL_I2C_CONTROLLER_DIRECTION_TX, 8);
+
+    // **Load Configuration Byte into TX FIFO**
+    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, (uint8_t*)&output_buffer, 8);
+
+
+    // **Ensure STOP Condition is Sent**
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+    printf("DAC Fast write Successful!\n");
+    DAC_UpdateOutput();
+    return true;
+
+}

+ 11 - 0
charge_controller_v7/dac.h

@@ -0,0 +1,11 @@
+#ifndef DAC_H_
+#include "ti/driverlib/dl_i2c.h"
+#include "ti_msp_dl_config.h"
+#include <stdbool.h>
+
+#define DAC_TARGET_BASE_ADDRESS (0x60)
+
+bool DAC_fastWrite(uint16_t channel_a_value);
+void DAC_UpdateOutput();
+
+#endif

+ 159 - 645
charge_controller_v7/i2c_controller.c

@@ -18,79 +18,35 @@
     - Convert Analog output to voltage in Volts: Convert_ADC_To_Voltage()
     - Commented out interrupts for the time being.
     - Adding code for Pi to READ ADC voltages in mV.
-    - 
+
+ 27.02.2025: 
+ DAC function to write to Channel A in Fast Mode and return the Analog output
  */
 
 
 #include "ti/devices/msp/peripherals/hw_dac12.h"
+#include "ti/driverlib/dl_adc12.h"
 #include "ti/driverlib/dl_gpio.h"
 #include "ti/driverlib/dl_i2c.h"
 #include "ti/driverlib/m0p/dl_core.h"
 #include "ti_msp_dl_config.h"
 #include "ti/comm_modules/i2c/controller/i2c_comm_controller.h"
-#include<stdint.h>
-#include<stdio.h>
+#include <stdint.h>
+#include <stdio.h>
+#include "multiplexer.h"
+#include "adc.h"
+#include "dac.h"
 
 I2C_Instance gI2C;
+I2C_ResponseInfo gResponse;
+
+
+#define NUM_BATTERY_SLOT (1)
+uint16_t battery_slots[NUM_BATTERY_SLOT];
+uint8_t battery_status[1]= {0x02};
+
+
 
-/*MULTIPLEXER SECTION:*/
-
-/*Multiplexer Address*/
-#define MULTIPLEXER_I2C_ADDR (0x70)
-
-/*Multiplexer channel*/
-#define ADC_I2C_CHANNEL (0x01)
-
-/*****************DAC*********************/
-
-/*Fast write command for DAC*/
-#define FAST_WRITE_COMMAND  0x00
-#define MULTI_WRITE         0x40
-#define SINGLE_WRITE        0x58
-#define SEQ_WRITE           0x50
-#define VREF_CMD            0x80
-#define GAIN_CMD            0xC0
-#define PWR_DWN_CMD         0xA0
-
-//DAC Channel Selection
-typedef enum{
-    DAC_A = 0,
-    DAC_B,
-    DAC_C,
-    DAC_D
-} DAC_CH;
-
-typedef enum{
-    VREF_VDD= 0,
-    VREF_INTERNAL= 1
-}VREF_SELECTION;
-
-typedef enum{
-    GAIN_X1= 0,
-    GAIN_X2= 1
-}GAIN_SELECTION;
-
-typedef enum{
-    PD_NORMAL=0,
-    PD_GND_1KOHM= 1,
-    PD_GND_100KOHM= 2,
-    PD_GND_500KOHM= 3
-}PWR_DOWN_SELECTION;
-
-// Structure to Hold DAC Register Data
-typedef struct {
-    VREF_SELECTION vref;
-    PWR_DOWN_SELECTION pd;
-    GAIN_SELECTION gain;
-    uint16_t data;
-} DACRegisterData;
-
-// Create Global Storage for DAC Values
-DACRegisterData read_reg_[4];  // Holds Active Register Values
-DACRegisterData read_eep_[4];  // Holds EEPROM Stored Values
-
-
-/***********************/
 
 /*
 
@@ -110,31 +66,35 @@ Calculation for V(IN)= (ADC Value/2^ (Resolution-1))* V(REF)
 - Register address where ADC result would be stored
 */
 
-#define VREF 2.048 
+//#define VREF 2.048 
 // address register for ADC Voltage Read:
-#define ADC_REGISTER 0x10
+//#define ADC_REGISTER 0x10
+/*****************/
 /*Register for the MCU*/
 #define REGISTER_SIZE 256
-#define I2C_BUFFER_SIZE (16)
-//#define DAC12_REF_VOLTAGE_mV (2500)
-
 uint8_t registers[REGISTER_SIZE]= {1, 2, 3, 4, 5};
 
-/* Buffers for data exchange with Pi*/
-uint16_t gRxBuffer[I2C_BUFFER_SIZE]= {0};
-uint16_t gTxBuffer[I2C_BUFFER_SIZE]={0};
 
-/*Counter for data length and bytes*/
+/*Counters for TX length and bytes sent*/
 uint32_t gTxLen, gTxCount;
+/* Counters for RX length and bytes sent*/
 uint32_t gRxLen, gRxCount;
 
-volatile I2C_CommandInfo gCommand;
-
-I2C_ResponseInfo gResponse;
+/* Boolean to know when a stop command was issued */
+bool gStopReceived = false;
 
+/* ADC variables:
+ * gADCResult is the adc result taken from the Memory Register
+ * NumberOfADCSamples is the count of total ADC samples to keep track for the gTxResult buffer
+ */
 
-volatile bool gSendCommand = true;
-volatile bool newMeasurementAvailable = false;
+//uint16_t gADCResult;
+//uint8_t gNumberOfADCSamples = 0;
+//bool gCheckADC = false;
+//volatile I2C_CommandInfo gCommand;
+//I2C_ResponseInfo gResponse;
+//volatile bool gSendCommand = true;
+//volatile bool newMeasurementAvailable = false;
 
 
 uint8_t gTxData[MAX_DATA_SIZE] = {0} ;
@@ -167,137 +127,10 @@ void I2C_scanBus() {
     printf("I2C Scan Complete!\n");
 }
 
-/*
-Multiplexer TCA9548A:
-Address:0x70
-The TCA9548A is example of a single-register device, which is controlled via I2C commands. Since it has 1 bit to enable or disable a channel, there is only 1 register
-needed, and the controller merely writes the register data after the target address, skipping the register number.
-ADC connected to channel 0
-Both SDA and SL lines of the multiplexer is connected to VIN through pull-up resistors
-The following is the general procedure for a controller to access a target device:
-1. If a controller wants to send data to a target:
-    • Controller-transmitter sends a START condition and addresses the target-receiver.
-    • Controller-transmitter sends data to target-receiver.
-    • Controller-transmitter terminates the transfer with a STOP condition.
-2. If a controller wants to receive or read data from a target:
-    • Controller-receiver sends a START condition and addresses the target-transmitter.
-    • Controller-receiver sends the requested register to read to target-transmitter.
-    • Controller-receiver receives data from the target-transmitter.
-    • Controller-receiver terminates the transfer with a STOP condition.
-The TCA9548A is example of a single-register device, which is controlled via I2C commands. Since it has 1 bit to enable or disable a channel, 
-there is only 1 register needed, and the controller merely writes the register data after the target address, skipping the register number.
-*/
-
-/*Function for Multiplexer*/
-
-void Multiplexer_SelectChannel(uint8_t channel)
-{
-    uint8_t data = channel;
-    printf("Selecting Multiplexer Channel: 0x%02X\n", data);
-
-    // Ensure bus is idle before starting communication
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    // SEND Command to Multiplexer
-    DL_I2C_startControllerTransfer(I2C_controller_INST, MULTIPLEXER_I2C_ADDR, DL_I2C_CONTROLLER_DIRECTION_TX, 1);
-    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &data, 1);
-
-    // **Ensure STOP condition is sent**
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    // **Slightly Increase Delay for Multiplexer to Process Command**
-    delay_cycles(30000); 
-
-    // Verify Multiplexer Response:
-    uint8_t response= 0x00;
-    DL_I2C_startControllerTransfer(I2C_controller_INST, MULTIPLEXER_I2C_ADDR, DL_I2C_CONTROLLER_DIRECTION_RX, 1);
-
-    // Wait for a response from the multiplexer
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-    response = DL_I2C_receiveControllerData(I2C_controller_INST);
-
-    // **Debug: Print Expected vs. Received Response**
-    printf("Multiplexer Response: 0x%02X (Expected: 0x%02X)\n", response, data);
-    
-    // **CHECK FOR ADDRESS ACKNOWLEDGMENT**
-    /*if (!(DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_ERROR)) {
-        printf("Multiplexer detected at 0x70.\n");
-        return;
-    } else{
-        printf("ERROR: Multiplexer (0x70) detected.\n");
-    }*/
-
-    // Wait for transaction completion
-    //while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    if(response != data){
-        printf("ERROR: Multiplexer did not set the correct channel!\n");
-        // **Retry Mechanism: Attempt to Set the Channel Again**
-        delay_cycles(10000);
-        Multiplexer_SelectChannel(channel);
-    } else {
-        printf("Multiplexer Active Channel: 0x%X\n", data);
-    }
-}
-
 
-/*
-CONFIGURATION REGISTER:
-8-bit wide configuration register to select for: input channel, conversion mode, conversion rate, and PGA gain. 
-Device allows the user to changethe operating condition of the device:
 
-*/
 
-uint8_t Construct_Config_Byte(uint8_t channel, uint8_t resolution, bool continuous, uint8_t gain) {
 
-    uint8_t config = 0;
-
-    
-    config |= ((channel - 1) << 5);  // Channel Selection (Bits 6-5)
-
-    if (continuous) config |= (1 << 4);  // Continuous Mode (Bit 4)
-
-    switch (resolution) {
-        case 12: config |= (0b00 << 2); break;
-        case 14: config |= (0b01 << 2); break;       
-        case 16: config |= (0b10 << 2); break;
-        case 18: config |= (0b11 << 2); break;
-        default: printf("ERROR: Invalid Resolution!\n"); return 0;
-    }
-
-    switch (gain) {
-        case 1: config |= (0b00); break;
-        case 2: config |= (0b01); break;
-        case 4: config |= (0b10); break;
-        case 8: config |= (0b11); break;
-        default: printf("ERROR: Invalid Gain!\n"); return 0;
-    }
-
-    return config;
-}
-
-/* Tansmit Data from MCU to ADC:  Function to SET configuration to ADC over I2C*/
-
-void SetConfiguration(uint8_t channel, uint8_t resolution, bool mode, uint8_t gain) {
-    // **Step 1: Construct Configuration Byte**
-    uint8_t config_byte = Construct_Config_Byte(channel, resolution, mode, gain);
-
-    printf("Writing Config: 0x%02X to ADC (0x%X)...\n", config_byte, DEF_TARGET_ADDR_ADC);
-
-    // **Step 2: Wait for I2C Bus to be Free**
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    // **Step 3: Start I2C Write Transaction**
-    DL_I2C_startControllerTransfer(I2C_controller_INST, DEF_TARGET_ADDR_ADC, DL_I2C_CONTROLLER_DIRECTION_TX, 1);
-
-    // **Step 4: Load Configuration Byte into TX FIFO**
-    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &config_byte, 1);
-
-    // **Step 5: Ensure STOP Condition is Sent**
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-    printf("Configuration Byte: 0x%02X\n", config_byte);
-    printf("Configuration Sent Successfully!\n");
-}
 
 /*Function to get the RDY bit from ADC*/
 
@@ -316,362 +149,12 @@ bool Check_ADC_Ready()
 
     */
 
-    DL_I2C_startControllerTransfer(I2C_controller_INST, DEF_TARGET_ADDR_ADC, DL_I2C_CONTROLLER_DIRECTION_RX, 1);
+    DL_I2C_startControllerTransfer(I2C_controller_INST, ADC_TARGET_BASE_ADDRESS, DL_I2C_CONTROLLER_DIRECTION_RX, 1);
     config_byte = DL_I2C_receiveControllerData(I2C_controller_INST);
     return (config_byte & 0x80) == 0;  // Check if RDY bit is cleared in bit 7
 
 }
 
-
-/*
-Function to read ADC DATA: This function simply retrieves the ADC raw digital output as 16-bit signed integer. 
-* The value returned is not yet converted to VOLTAGE.
-* adc_data[2]: Buffer with an array of size 2, to store two bytes of ADC data. 
-*             Since, the ADC output consists of two 8-bit bytes:
-*             - adc_data[0] (MSB)
-*             - adc_data[1] (LSB)
-* Next, we verify if the the I2C bus is busy using the function in the driverlib: DL_I2C_get ControllerStatus
-*       - Prevents collisions by ensuring no two I2C device is using the same bus before initializing.
-* BEGIN I2C READ operation to request 2 bytes from the ADC-> DL_I2C_startControllerTransfer()
-* Parameters:
-    - I2C_controller_INST: Refererence to the I2C instance bring used.
-    - DEF_TARGET_ADDR_ADC: Address of the ADC
-    - DL_I2C_CONTROLLER_DIRECTION_RX: Indicates that we want to receive the data from ADC
-    - 2: Specifies that we expect 2 bytes from the ADC
-* WAIT for the data to be received: (DL_I2C_getControllerStatus())
-    - Waits until the ADC sends the data over I2C.
-    - Ensures that the data transfer is complete before proceeding.
-* READ the two bytes of ADc Data:
-    - adc_data[0] : MSB
-    - adc_data[1] : LSB
-    - adc_data[2] : config_bytes
-    ADC sends its 16-bit value in two parts over 8-bit I2C data frames.
-* COMBINE the two bytes into 16-bit Integer:
-    - Shifts the MSB(first byte) left by 8 bits to make space for LSB.
-    - Performs a bitwise OR operation to combine MSB and LSB into a single 16-bit number.
-* PRINT HEXADEC and DECIMAL format for DEBUGGING.
-* Output code is in binary and is proportional to the Input Voltage and PGA settings.
-* From the datasheet: https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/22226a.pdf
-    - Equation 4.4 is being used to convert the output codes to input voltage
-*/
-
-int16_t Read_ADC_Data(uint8_t resolution)
-{
-    uint8_t adc_data[3] = {0};  // Buffer for ADC data (MSB, LSB, Config Byte)
-    int16_t raw_adc = 0;
-    
-    printf("Reading ADC Data from MCP3428...\n");
-
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    // Determine bytes to read
-    printf("Resolution for reading ADC is %d\n", resolution);
-
-    delay_cycles(10000);
-
-    // Request 3 Bytes from ADC**
-    DL_I2C_startControllerTransfer(I2C_controller_INST, DEF_TARGET_ADDR_ADC, DL_I2C_CONTROLLER_DIRECTION_RX, 3);
-
-    // Read Data into Buffer**
-    int i = 0;
-    while(i<3){
-        while (DL_I2C_isControllerRXFIFOEmpty(I2C_controller_INST));
-        printf("Loop no: %d\n",i);
-        while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-        adc_data[i] = DL_I2C_receiveControllerData(I2C_controller_INST);
-        printf("Received Byte[%d]: 0x%02X\n", i, adc_data[i]);
-        i++;
-    }
-    newMeasurementAvailable = true;
-
-    /*Combining MSB and LSB for ADC output*/
-    raw_adc= adc_data[0] << 8 | adc_data[1];
-    printf("Raw ADC Value: 0x%0X (%d)\n", raw_adc, raw_adc);
-    //printf("Resolution: %d \n", resolution_bits );
-    return raw_adc;
-   
-}
-
-
-/* Function to Convert ADC Reading to Voltage */
-float Convert_ADC_To_Voltage(int16_t adc_value, uint8_t resolution, uint8_t gain) {
-    if (!newMeasurementAvailable) 
-    { return -1; }
-    float voltage= 0;
-    float LSB= 0;
-    uint32_t max_adc_value= 1;
-
-     switch (resolution) {
-        case 12:  // 12-bit
-            max_adc_value = 2048;
-            break;
-        case 14:  // 14-bit
-            max_adc_value = 8192;
-            break;
-        case 16:  // 16-bit
-            max_adc_value = 32768;
-            break;
-        case 18:  // 18-bit
-            max_adc_value = 131072;
-            break;
-        default:
-            printf("Error: Unknown ADC Resolution!\n");
-            return 0.0;
-    }
-
-    /*Considering that MSB is always 0*/
-    printf("Max Resolution %d\n", max_adc_value);
-    LSB= ((VREF)/max_adc_value);
-    printf("LSB: %f\n", LSB);
-    float inputVoltage= ((float)adc_value*(LSB/gain));
-
-    
-    /*Formula for ADC to Voltage Conversion*/
-    /*voltage = ((float)adc_value / max_adc_value) * VREF;
-   
-    printf("Converted Voltage: %.2f V\n", voltage);*/
-
-    printf("Input Voltage Measured: %.2f V\n", inputVoltage);
-
-    /*To send the voltage to Pi in milliVolts*/
-    uint16_t voltage_mV= inputVoltage * 1000;
-
-    /*Storing ADC voltages in mVolts */
-    registers[ADC_REGISTER] = (voltage_mV>>8) & 0xFF; //Highest Byte
-    registers[ADC_REGISTER + 1] = (voltage_mV) & 0xFF; //Lowest Byte
-    newMeasurementAvailable = false;
-    printf("ADC Voltage Stored %d mV in MCU: MSB= 0x%02X, LSB= 0x%02X\n", voltage_mV, registers[ADC_REGISTER], registers[ADC_REGISTER + 1]);
-    return voltage;
-}
-
-/*
-DAC Configuration function: Tx to DAC channel
-DAC expects 3 bytes from the channel:
-Byte 0: write command + channel_selection
-Byte 1: configuration + high byte of DAC
-Byte 2: low byte of DAC
-*/
-/*bool SET_CHANNEL_VALUE(DAC_CH ch, uint16_t new_value, VREF_SELECTION new_vref, GAIN_SELECTION new_gain, PWR_DOWN_SELECTION new_pwr_dwn, bool udac){
-    uint8_t output_buffer[8];
-
-    //Build the setter header (Address) -> 01000 DAC0 DAC1 DAC2
-
-    uint8_t channel_write_cmd = FAST_WRITE_COMMAND; //0x00; FAST write mode
-    //channel_write_cmd |= (ch << 1); //SET DAC channel
-    //channel_write_cmd|= udac; // if udac is SET to 0; VOUT is updated after the 4th byte's ACK is issued
-
-    output_buffer[0]= channel_write_cmd;
-
-    // Construct the 12bit DAC value with the configuration settings
-    // For Fast write command it does not gives VREF:
-    // PD1 PD2 Gx D11 D10 D9 D8 [Byte 1]
-    // D7 D6 D5 D4 D3 D2 D1 D0 [Byte 2]
-
-    //new_value &= 0x0FFF; //Ensure only 12 bits are set
-    //new_value |= (new_vref << 15);
-    new_value |= (new_pwr_dwn << 13);
-    //new_value |= (new_gain << 12);
-    new_value |= new_value<< 9;
-    new_value |= new_value<< 8;
-
-    output_buffer[1]= new_value >> 8; //Upper Byte
-    output_buffer[2]= new_value & 0xFF; //Lower Byte
-
-    //Send the data via I2C:
-    if (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS){
-        printf("I2C Bus is busy! Retry..\n");
-        return false;
-    }
-
-    //start I2C transmission:
-    DL_I2C_startControllerTransfer(I2C_controller_INST, DEF_TARGET_ADDR_DAC, DL_I2C_CONTROLLER_DIRECTION_TX, 3);
-    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, output_buffer, 3);
-
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    if (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_ERROR) {
-        printf("I2C Write Error: Failed to write to DAC!\n");
-        return false;  // Return failure if there was an error
-    }
-
-    return true;
-}*/
-
-//The device updates all DAC analog output(vout) at the same time
-
-void update_DAC_Output() {
-    uint8_t general_call_command = 0x08;  // General Call Update Command
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &general_call_command, 1);
-
-    // Start I2C transaction
-    DL_I2C_startControllerTransfer(I2C_controller_INST, 0x00, DL_I2C_CONTROLLER_DIRECTION_TX, 1);
-    
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    printf("DAC Outputs Updated via General Call Software Update!\n");
-}
-
-/**Function for FAST write command, sending values over I2c to every channel of DAC**/
-bool fastWrite(uint16_t channel_a_value){
-
-    /*DAC has a 12 bit resolution that ranges from 0 to 4095.
-    0x00: sets the Power Mode to NORMAL for Channel A
-    (channel_a_value >> 8): shifts the value to 8 places right and gives upper 4 bits
-    */
-
-    uint8_t output_buffer[8];
-
-    output_buffer[0]= (0x00)|(channel_a_value >> 8)&0x0F;
-    //output_buffer[0] = channel_a_value >> 8;
-    output_buffer[1]= channel_a_value & 0xFF;
-
-    output_buffer[2]= 0x40; // Power down for the other channels
-    output_buffer[3]= 0x00; 
-
-    output_buffer[4]= 0x40;
-    output_buffer[5]= 0x00;
-
-    output_buffer[6]= 0x40;
-    output_buffer[7]= 0x00;
-
-    if (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_ERROR) {
-        printf("I2C Write Error: Failed to write to DAC channels for FAST write mode!\n");
-        return false;  // Return failure if there was an error
-    }
-
-    // **Wait for I2C Bus to be Free**
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-
-    
-
-    // **Start I2C Write Transaction**
-    DL_I2C_startControllerTransfer(I2C_controller_INST, DEF_TARGET_ADDR_DAC, DL_I2C_CONTROLLER_DIRECTION_TX, 8);
-
-    // **Load Configuration Byte into TX FIFO**
-    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, (uint8_t*)&output_buffer, 8);
-
-
-    // **Ensure STOP Condition is Sent**
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-    printf("DAC Fast write Successful!\n");
-    update_DAC_Output();
-    return true;
-
-}
-
-/*void readRegisters(){
-
-    uint8_t data[24];
-    uint8_t channel;
-    bool isEeprom;
-
-    printf("Reading MCP4728 Registers...\n");
-
-    // ** Request 24 Bytes from MCP4728 over I2C **
-    DL_I2C_startControllerTransfer(I2C_controller_INST, DEF_TARGET_ADDR_DAC, DL_I2C_CONTROLLER_DIRECTION_RX, 24);
-
-    for (int i = 0; i < 24; i++) {
-        while (DL_I2C_isControllerRXFIFOEmpty(I2C_controller_INST));
-        data[i] = DL_I2C_receiveControllerData(I2C_controller_INST);
-    }
-
-    // ** Process the Received Data (8 Iterations for 4 Channels) **
-    for (uint8_t i = 0; i < 8; i++) {
-        isEeprom = i % 2; // Even indices: Register, Odd indices: EEPROM
-        //Extract channel:
-        uint8_t ch= (data[0] & 0x30)>>4;
-
-        if (isEeprom) {
-            read_eep_[ch].vref = (VREF_SELECTION) ((data[i * 3 + 1] & 0b10000000) >> 7);
-            read_eep_[ch].pd   = (PWR_DOWN_SELECTION) ((data[i * 3 + 1] & 0b01100000) >> 5);
-            read_eep_[ch].gain = (GAIN_SELECTION) ((data[i * 3 + 1] & 0b00010000) >> 4);
-            read_eep_[ch].data = (uint16_t) ((data[i * 3 + 1] & 0b00001111) << 8 | data[i * 3 + 2]);
-        } else {
-            read_reg_[ch].vref = (VREF_SELECTION) ((data[i * 3 + 1] & 0b10000000) >> 7);
-            read_reg_[ch].pd   = (PWR_DOWN_SELECTION) ((data[i * 3 + 1] & 0b01100000) >> 5);
-            read_reg_[ch].gain = (GAIN_SELECTION) ((data[i * 3 + 1] & 0b00010000) >> 4);
-            read_reg_[ch].data = (uint16_t) ((data[i * 3 + 1] & 0b00001111) << 8 | data[i * 3 + 2]);
-        }
-    }
-
-    printf("MCP4728 Registers Read Successfully!\n");
-}
-*/
-
-
-/*
-DAC Function: 
--12 bit Voltage Output DAC with Four Buffered outputs.
--Using Internal VREF (2.048V):
-    - Output voltage range:
-    - 0.000V to 2.048V with Gain setting= 1
-    - 0.000V to 4.096V with Gain setting= 2
-- User can select internal reference or external voltage (VDD) for each channel
-- VOUTA: Buffered analog voltage of Channel A.
-- Channel Selection bits: 0x00 for Channel A
-*/
-
-
-/*int16_t read_DAC_Output()
-{
-    readRegisters(); //Read current register DAC values
-    uint16_t dac_a = read_reg_[DAC_A].data;
-    uint16_t dac_b = read_reg_[DAC_B].data;
-    uint16_t dac_c = read_reg_[DAC_C].data;
-    uint16_t dac_d = read_reg_[DAC_D].data;
-
-    printf("DAC Output Digital Values: A=%d, B=%d, C=%d, D=%d\n", 
-           dac_a, dac_b, dac_c, dac_d);
-    return dac_a;
-}
-
-float get_DAC_Output_Voltage(DAC_CH channel){
-    if(channel< DAC_A || channel> DAC_D){
-        printf("Error: Invalid DAC channel!\n");
-        return -1.0;
-    }
-    uint16_t dac_value = read_reg_[channel].data;
-    VREF_SELECTION vref = read_reg_[channel].vref;
-    GAIN_SELECTION gain = read_reg_[channel].gain;
-
-    //GET correct VREF value:
-    float vref_value= (vref==VREF_INTERNAL)? 2.048: 3.3;
-    uint8_t gain_factor= (gain==GAIN_X2)? 2: 1;
-
-    // Calculate Output Voltage
-    float vout = ((float)dac_value / 4095.0) * vref_value * gain_factor;
-
-    printf("DAC Channel %d - Digital Value: %d, VOUT: %.3fV\n", channel, dac_value, vout);
-    return vout;
-
-}*/
-
-/**Function to call DAC*/
-/*void get_Analog_Output(){
-    bool success= fastWrite(2048, 0, 0, 0);
-    if(!success){
-        printf("Error: DAC Fast Write Failed.\n");
-        return;
-    }
-
-    update_DAC_Output();
-    read_DAC_Output();
-
-    float vout_a= get_DAC_Output_Voltage(DAC_A);
-    float vout_b= get_DAC_Output_Voltage(DAC_B);
-    float vout_c= get_DAC_Output_Voltage(DAC_C);
-    float vout_d= get_DAC_Output_Voltage(DAC_D);
-
-    printf("\nMeasured DAC output Voltages:\n");
-    printf("Channel A: %.2f V\n", vout_a);
-    printf("Channel B: %.2f V\n", vout_b);
-    printf("Channel C: %.2f V\n", vout_c);
-    printf("Channel D: %.2f V\n", vout_d);
-}
-*/
-
 /*
 Function to initialize MCU as target: Pi communicates as the Controller and MCU as the Target
 */
@@ -692,55 +175,6 @@ void I2C_Target_Init(void) {
     
 }
 
-
-/*
-MAIN function:
-*/
-
-int main(void)
-{
-    // **Step 1: Initialize System and I2C**
-    SYSCFG_DL_init();
-    printf("............System Configuration Enabled...............\n");
-
-
-    // **Step 2: Select ADC Channel via Multiplexer**
-    printf("Selecting Multiplexer Channel...\n");
-    Multiplexer_SelectChannel(ADC_I2C_CHANNEL);
-    //I2C_scanBus();
-    // **Step 3: Enable I2C Interrupts**
-    //NVIC_EnableIRQ(I2C_controller_INST_INT_IRQN);
-    //NVIC_EnableIRQ(I2C_target_INST_INT_IRQN);
-    I2C_init(&gI2C);
-
-    gTxCount = 0;
-    gTxLen   = REGISTER_SIZE;
-    gRxCount = 0;
-    gRxLen   = REGISTER_SIZE;
-
-    // **Step 4: Configure ADC (Example: CH1, 16-bit, Continuous Mode, Gain x1)**
-    uint8_t channel= 4;
-    uint8_t resolution= 16;
-    bool continuous= 1;
-    uint8_t gain= 1;
-    printf("Configuring ADC...\n");
-
-    //**Set Configuration Register for ADC**
-    //SetConfiguration(channel, resolution, continuous, gain);  // CH1, 16-bit, Continuous mode, Gain x1
-
-    while (1)
-    {
-        // Read ADC Value and DAC values:
-        //int16_t adc_value = Read_ADC_Data(resolution);
-        //Convert_ADC_To_Voltage(adc_value, resolution, gain); 
-        //delay_cycles(10000); 
-        fastWrite(3300);
-
-        //Add Delay for Next Conversion**
-        delay_cycles(100000);
-    }
-}
-
 /*Interrupt for MCU -> ADC
 * CASE: DL_I2C_IIDX_CONTROLLER_RX_DONE: ADC Reception Complete
     - ADC has finished sending data and it's fully received.
@@ -765,58 +199,57 @@ int main(void)
 
 */
 void I2C_controller_INST_IRQHandler(void)
-{   printf("I2C Interrupt Triggered to ADC!\n");
+{   
+    //printf("I2C Interrupt Triggered to ADC!\n");
     switch (DL_I2C_getPendingInterrupt(I2C_controller_INST)) 
-    {
-        case DL_I2C_IIDX_CONTROLLER_RX_DONE:
-            gI2C.rxMsg.len = gI2C.rxMsg.ptr;
-            I2C_decodeResponse(&gI2C,&gResponse);
-            gI2C.status = I2C_STATUS_RX_COMPLETE;
-            printf("I2C RX COMPLETE!\n");
-            break;
-
-        case DL_I2C_IIDX_CONTROLLER_TX_DONE:
-            DL_I2C_disableInterrupt(
-                I2C_controller_INST, DL_I2C_INTERRUPT_CONTROLLER_TXFIFO_TRIGGER);
-            gI2C.status = I2C_STATUS_TX_COMPLETE;
-            printf("I2C TX COMPLETE!\n");
+    {   /*START Condition*/
+        case DL_I2C_IIDX_CONTROLLER_START:
+            //gTxADCcount= 0;
+            gRxADCcount= 0;
+            DL_I2C_flushControllerTXFIFO(I2C_controller_INST);
             break;
 
         case DL_I2C_IIDX_CONTROLLER_RXFIFO_TRIGGER:
-            gI2C.status = I2C_STATUS_RX_INPROGRESS;
+            gI2C.status= I2C_STATUS_RX_INPROGRESS;
             /* Store bytes received from target in Rx Msg Buffer */
             while (DL_I2C_isControllerRXFIFOEmpty(I2C_controller_INST) != true) {
-                if (gI2C.rxMsg.ptr < MAX_BUFFER_SIZE) {
-                    gI2C.rxMsg.buffer[gI2C.rxMsg.ptr++] =
-                        DL_I2C_receiveControllerData(I2C_controller_INST);
-                        if(gI2C.rxMsg.ptr>0){
-                            //printf("Received Byte[%d]: 0x%02X\n", gI2C.rxMsg.ptr, gI2C.rxMsg.buffer[gI2C.rxMsg.ptr - 1]);
-
-                        }
+                if (gRxADCcount< gRxADClen) {
+                        gRxPacket[gRxADCcount] = DL_I2C_receiveControllerData(I2C_controller_INST);
+                        printf("Received Byte[%d]: 0x%02X\n", gRxADCcount, gRxPacket[gRxADCcount]);  // Debug print
+                        gRxADCcount++;
                                       
                 } else {
-                    printf("ERROR: RX Buffer Overflow! ptr=%d MAX_BUFFER_SIZE=%d\n", gI2C.rxMsg.ptr, MAX_BUFFER_SIZE);
+                    //printf("ERROR: RX Buffer Overflow! ptr=%d MAX_BUFFER_SIZE=%d\n", gI2C.rxMsg.ptr, MAX_BUFFER_SIZE);
                     /* Ignore and remove from FIFO if the buffer is full */
                     DL_I2C_receiveControllerData(I2C_controller_INST);
                 }
+
             }
             break;
-
+        /*TRANSMIT data to ADC*/
         case DL_I2C_IIDX_CONTROLLER_TXFIFO_TRIGGER:
             printf("TX FIFO with data!\n"); 
-            gI2C.status = I2C_STATUS_TX_INPROGRESS;
-            /* Fill TX FIFO with bytes to send */
-            if (gI2C.txMsg.ptr < gI2C.txMsg.len) {
-                gI2C.txMsg.ptr += DL_I2C_fillControllerTXFIFO(
-                    I2C_controller_INST, &gI2C.txMsg.buffer[gI2C.txMsg.ptr], gI2C.txMsg.len - gI2C.txMsg.ptr);
+            gI2C.status= I2C_STATUS_TX_INPROGRESS;
+            if(gTxADCcount<gTxADClen){
+                gTxADCcount+= DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &gTxPacket[gTxADCcount], (gTxADClen-gTxADCcount));
+            } else{
+                /*Prevent overflow and just ignore data*/
+                DL_I2C_fillTargetTXFIFO(I2C_controller_INST, (uint8_t[]){0x00}, 1);
             }
             break;
-
+        /*STOP condition*/
+        case DL_I2C_IIDX_CONTROLLER_STOP:
+            gTxComplete= true;
+            gRxComplete = true;
+            printf("I2C Stop Detected- RX Complete");
         case DL_I2C_IIDX_CONTROLLER_ARBITRATION_LOST:
-            printf("Interrupt index for I2C controller Arbitration Lost!\n");
+            //printf("Interrupt index for I2C controller Arbitration Lost!\n");
             break;
         case DL_I2C_IIDX_CONTROLLER_NACK:
-            printf("I2C NACK Received\n");
+            //printf("I2C NACK Received\n");
+            if((gI2C.status== I2C_STATUS_RX_STARTED)|| (gI2C.status= I2C_STATUS_TX_STARTED)){
+                gI2C.status= I2C_STATUS_ERROR;
+            }
             break;
         default:
             break;
@@ -871,7 +304,7 @@ void I2C_target_INST_IRQHandler(void) {
                 else if (registerAddress < REGISTER_SIZE) {
                     //Storing the received data from the controller correctly
                     registers[registerAddress] = DL_I2C_receiveTargetData(I2C_target_INST);
-                    printf("Stored 0x%02X in Register 0x%02X\n", registers[registerAddress], registerAddress);
+                    //printf("Stored 0x%02X in Register 0x%02X\n", registers[registerAddress], registerAddress);
                     //gRxBuffer[gRxCount++] = DL_I2C_receiveTargetData(I2C_0_INST);
 
                 } 
@@ -885,33 +318,114 @@ void I2C_target_INST_IRQHandler(void) {
 
          /* TX FIFO trigger (Pi is reading data from MCU) */
         case DL_I2C_IIDX_TARGET_TXFIFO_TRIGGER:
+            
             //printf("transmitting data to Pi...\n");
             if(!DL_I2C_isTargetTXFIFOFull(I2C_target_INST)) {
-
-                if (registerAddress < REGISTER_SIZE) {
-                    //DL_I2C_fillTargetTXFIFO(I2C_0_INST, &gTxBuffer[gTxCount], 1);
-                    // Retrieve stored value from the correct register
-                    uint8_t value = registers[registerAddress];
-                    //uint8_t value_test[2] = { 0x01, 0x03 };
-                    DL_I2C_fillTargetTXFIFO(I2C_target_INST, &value, 1);
-                    //printf("Sending to 0x%02X: 0x%02X\n", registerAddress, value);  // Debugging
-                } else {
+                  if(registerAddress == 0x01){
+                    DL_I2C_fillTargetTXFIFO(I2C_target_INST, battery_status, NUM_BATTERY_SLOT);
+                  }
+                  else if(registerAddress== 0x02){
+                    //DL_I2C_fillTargetTXFIFO(I2C_target_INST, &value , 1);
+                  }
+      
+                  else {
                     // **Fix: Avoid infinite while loop**
                     printf("WARNING: TX Buffer Underflow! Sending default value.\n");
                     DL_I2C_fillTargetTXFIFO(I2C_target_INST, (uint8_t[]){0x00}, 1);
                     break;
-                }
+                 }
             }
             break;
 
         /* Arbitration lost or NACK */
         case DL_I2C_IIDX_TARGET_ARBITRATION_LOST:
+            printf("Arbitration Lost.\n");
         default:
             printf("Unknown Interrupt.\n");
             break;
     }
 }
 
+void Reset_I2C_Bus() {
+    printf("I2C Bus is stuck! Resetting...\n");
+    
+    // Disable I2C Controller
+    DL_I2C_disableController(I2C_controller_INST);
+    delay_cycles(50000);
+
+    // Re-enable I2C Controller
+    DL_I2C_enableController(I2C_controller_INST);
+    delay_cycles(50000);
+
+    // Check if bus is free now
+    uint32_t status = DL_I2C_getControllerStatus(I2C_controller_INST);
+    printf("I2C Bus Status After Reset: 0x%08X\n", status);
+}
+
+
+
+/*
+MAIN function:
+*/
+
+int main(void)
+{
+    // Initialize System and I2C
+    SYSCFG_DL_init();
+    //Reset_I2C_Bus();
+    //NVIC_EnableIRQ(I2C_target_INST_INT_IRQN);
+    //NVIC_EnableIRQ(I2C_controller_INST_INT_IRQN);
+
+    printf("............System Configuration Enabled...............\n");
+    
+    Multiplexer_SelectChannel(I2C_CHANNEL);
+    //I2C_scanBus();
+    I2C_init(&gI2C);
+
+    // *Configure ADC*
+    ADC_PARAMS adc_params={
+        .channel= 1,
+        .resolution= 12,
+        .continuous= 1,
+        .gain= 1
+
+    };
+    
+    printf("Configuring ADC....\n");
+    //**Set Configuration Register for ADC**
+    ADC_SetConfigurationBytes(adc_params);
+    uint16_t channel_a_value= 3300; // in mVolts
+    while (1)
+    {   
+        int16_t raw_adc_value= ADC_ReadData(adc_params);
+        ADC_ConvertToVoltage(raw_adc_value, adc_params); 
+        delay_cycles(5000);
+        DAC_fastWrite(channel_a_value);
+        delay_cycles(100000);
+
+    }   
+        
+        //Read_ADC_Data(resolution);
+        //for(uint8_t slot=0; slot<NUM_BATTERY_SLOT; slot++){
+            // Read ADC Value and DAC values:
+            //int16_t adc_value = Read_ADC_Data(resolution);
+            //Read_ADC_Data(resolution);
+            //float measured_adc_volts= Convert_ADC_To_Voltage(adc_value, resolution, gain); 
+            //if(measured_adc_volts> BATT_THRESHOLD){
+            //battery_status[slot]= 0x02;
+            //}else{
+            //    battery_status[slot]= 0x01;
+            //}
+            // Debugging Output
+            //printf("Battery Slot %d - Voltage: %.2fV, Status: 0x%02X\n", slot, measured_adc_volts, battery_status[slot]);
+
+}
+        
+        
+
+
+
+
 
 
 

+ 29 - 0
charge_controller_v7/i2c_target.c

@@ -0,0 +1,29 @@
+
+#include "i2c_target.h"
+#include "battery.h"
+
+
+/*
+- command: as defined in the Wiki for Pi 0x01, 0x02, 0x03, refer to i2c_target.h file
+- slot_id: battery slot numner from 0 to NUM_SLOTS-1
+- data: pointer to SET battery limits
+- len: length of the data
+
+*/
+void ProcessI2CCommand(uint8_t command, uint8_t slot_id, uint8_t *data, uint8_t len) {
+    switch(command) {
+        case CMD_GET_BATTERY_STATUS:
+            // Transmit the battery state for the given slot
+            
+            
+        case CMD_GET_BATTERY_DATA: {
+            // Create a data message and transmit it
+            
+        }
+        
+        case CMD_SET_BATTERY_LIMIT: {
+            
+            
+    }
+ }
+}

+ 32 - 0
charge_controller_v7/i2c_target.h

@@ -0,0 +1,32 @@
+#ifndef I2C_TARGET_H
+#define I2C_TARGET_H
+
+#include "battery.h"
+
+
+// I2C command codes
+#define CMD_GET_BATTERY_STATUS        0x01       // Request battery state
+#define CMD_GET_BATTERY_DATA          0x02       // Request battery data
+#define CMD_SET_BATTERY_LIMIT         0x03       // SET min/max voltage, cutoff current limits
+
+
+//Structure for Battery Data Message (GET battery data)
+
+typedef struct{
+    uint8_t slot_id;
+    uint16_t voltage;
+    uint16_t current;
+    uint16_t temperature;
+} BatteryData;
+
+//SET Battery Limit
+typedef struct{
+    uint8_t slot_id;
+    uint16_t min_voltage;
+    uint16_t max_voltage;
+    uint16_t cut_off_current;
+} BatteryLimitMsg;
+
+void I2C_Init();
+void ProcessI2Ccommand();
+#endif

+ 84 - 0
charge_controller_v7/multiplexer.c

@@ -0,0 +1,84 @@
+#include "multiplexer.h"
+#include "ti/driverlib/dl_i2c.h"
+#include "ti_msp_dl_config.h"
+#include <stdio.h>
+#include <stdint.h>
+
+/*
+Multiplexer TCA9548A:
+Address:0x70
+The TCA9548A is example of a single-register device, which is controlled via I2C commands. Since it has 1 bit to enable or disable a channel, there is only 1 register
+needed, and the controller merely writes the register data after the target address, skipping the register number.
+ADC connected to channel 0
+Both SDA and SL lines of the multiplexer is connected to VIN through pull-up resistors
+The following is the general procedure for a controller to access a target device:
+1. If a controller wants to send data to a target:
+    • Controller-transmitter sends a START condition and addresses the target-receiver.
+    • Controller-transmitter sends data to target-receiver.
+    • Controller-transmitter terminates the transfer with a STOP condition.
+2. If a controller wants to receive or read data from a target:
+    • Controller-receiver sends a START condition and addresses the target-transmitter.
+    • Controller-receiver sends the requested register to read to target-transmitter.
+    • Controller-receiver receives data from the target-transmitter.
+    • Controller-receiver terminates the transfer with a STOP condition.
+The TCA9548A is example of a single-register device, which is controlled via I2C commands. Since it has 1 bit to enable or disable a channel, 
+there is only 1 register needed, and the controller merely writes the register data after the target address, skipping the register number.
+*/
+
+/*Function for Multiplexer*/
+
+void Multiplexer_SelectChannel(uint8_t channel)
+{
+    if (channel > 7) {
+        printf("ERROR: Invalid Multiplexer Channel! Must be 0-7.\n");
+        return;
+    }
+    uint8_t data = (channel);
+    printf("Selecting Multiplexer Channel: 0x%02X\n", data);
+
+    // Ensure bus is idle before starting communication
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+    // SEND Command to Multiplexer
+    DL_I2C_startControllerTransfer(I2C_controller_INST, MULTIPLEXER_I2C_ADDR, DL_I2C_CONTROLLER_DIRECTION_TX, 1);
+    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &data, 1);
+
+    // **Ensure STOP condition is sent**
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+    // **Slightly Increase Delay for Multiplexer to Process Command**
+    delay_cycles(30000); 
+
+    // Verify Multiplexer Response:
+    //uint8_t response= 0x00;
+    DL_I2C_startControllerTransfer(I2C_controller_INST, MULTIPLEXER_I2C_ADDR, DL_I2C_CONTROLLER_DIRECTION_RX, 1);
+
+    // Wait for a response from the multiplexer
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+    //uint8_t response = DL_I2C_receiveControllerData(I2C_controller_INST);
+
+    // **Debug: Print Expected vs. Received Response**
+    //printf("Multiplexer Response: 0x%02X (Expected: 0x%02X)\n", response, data);
+    
+    
+    // **CHECK FOR ADDRESS ACKNOWLEDGMENT**
+    //(if (!(DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_ERROR)) {
+    //    printf("Multiplexer detected at 0x70.\n");
+    //    return;
+    //} else{
+    //    printf("ERROR: Multiplexer (0x70) detected.\n");
+    //}
+
+    // Wait for transaction completion
+    //while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+    //if(response != data){
+    //    printf("ERROR: Multiplexer did not set the correct channel!\n");
+        // **Retry Mechanism: Attempt to Set the Channel Again**
+    //    delay_cycles(10000);
+    //    Multiplexer_SelectChannel(channel);
+    //} else {
+    //    printf("Multiplexer Active Channel: 0x%X\n", data);
+    //    return;
+    //}
+}

+ 10 - 0
charge_controller_v7/multiplexer.h

@@ -0,0 +1,10 @@
+#ifndef MULTIPLEXER_H_
+#define MULTIPLEXER_H_
+
+#include <stdint.h>
+
+#define MULTIPLEXER_I2C_ADDR           (0x70)
+#define I2C_CHANNEL                    (0x01)
+
+void Multiplexer_SelectChannel(uint8_t channel);
+#endif

+ 2 - 2
charge_controller_v7/ti/comm_modules/i2c/controller/i2c_comm_controller.h

@@ -104,8 +104,8 @@ extern "C" {
 
 /*! I2C Target Addr configured in the example */
 /*! @brief Default Target Address */
-#define DEF_TARGET_ADDR_ADC             (0x68)
-#define DEF_TARGET_ADDR_DAC             (0x60)
+//#define DEF_TARGET_ADDR_ADC             (0x68)
+//#define DEF_TARGET_ADDR_DAC             (0x60)
 
 
 

Деякі файли не було показано, через те що забагато файлів було змінено