Ver código fonte

Configuration in WWDT and TIMER for watchdog mode timer

namrota ghosh 7 meses atrás
pai
commit
6c4ad73b18
2 arquivos alterados com 19 adições e 6 exclusões
  1. 18 6
      main.syscfg
  2. 1 0
      src/cc_cv_charging.c

+ 18 - 6
main.syscfg

@@ -20,6 +20,8 @@ const I2C2          = I2C.addInstance();
 const PWM           = scripting.addModule("/ti/driverlib/PWM", {}, false);
 const PWM1          = PWM.addInstance();
 const SYSCTL        = scripting.addModule("/ti/driverlib/SYSCTL");
+const TIMER         = scripting.addModule("/ti/driverlib/TIMER", {}, false);
+const TIMER1        = TIMER.addInstance();
 const WWDT          = scripting.addModule("/ti/driverlib/WWDT", {}, false);
 const WWDT1         = WWDT.addInstance();
 const ProjectConfig = scripting.addModule("/ti/project_config/ProjectConfig");
@@ -88,12 +90,22 @@ PWM1.PWM_CHANNEL_0.$name        = "ti_driverlib_pwm_PWMTimerCC0";
 PWM1.PWM_CHANNEL_0.invert       = true;
 PWM1.ccp0PinConfig.$name        = "ti_driverlib_gpio_GPIOPinGeneric4";
 
-SYSCTL.peripheral.$assign = "SYSCTL";
+SYSCTL.clockTreeEn           = true;
+SYSCTL.powerPolicy           = "STANDBY0";
+SYSCTL.forceDefaultClkConfig = true;
+SYSCTL.validateClkStatus     = true;
 
-WWDT1.$name             = "WWDT0";
-WWDT1.wwdtMode          = "INTERVAL";
-WWDT1.sleepMode         = true;
-WWDT1.enabledInterrupts = true;
+TIMER1.$name              = "TIMER_0";
+TIMER1.timerClkSrc        = "LFCLK";
+TIMER1.timerClkPrescale   = 33;
+TIMER1.timerMode          = "PERIODIC";
+TIMER1.timerPeriod        = "300 ms";
+TIMER1.interrupts         = ["ZERO"];
+TIMER1.peripheral.$assign = "TIMG0";
+
+WWDT1.$name               = "WWDT0";
+WWDT1.sleepMode           = true;
+WWDT1.window0ClosedPeriod = "25";
 
 ProjectConfig.migrationCondition = true;
 
@@ -102,5 +114,5 @@ ProjectConfig.migrationCondition = true;
  * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
  * re-solve from scratch.
  */
-PWM1.peripheral.$suggestSolution  = "TIMG0";
+PWM1.peripheral.$suggestSolution  = "TIMG6";
 WWDT1.peripheral.$suggestSolution = "WWDT0";

+ 1 - 0
src/cc_cv_charging.c

@@ -174,6 +174,7 @@ void CC_CV_ControlCharging(uint8_t slot_id, int16_t charge_current) {
     case STATE_DISCHARGING:
       DL_GPIO_setPins(GPIO_Battery_Charging_PORT, GPIO_Battery_Charging_PIN_PB6_PIN);
       DL_GPIO_setPins(GPIO_Battery_Discharging_PORT, GPIO_Battery_Discharging_PIN_PB7_PIN);
+      //controller_EvaluateBatterySlotState(slot_id, BatteryMeasurement *measurement);
       controller_SetCurrent(TARGET_MCU_ADDRESS, slot_id, charge_current);
       printf("DISCHARGING: Slot %d at %d mA.\n", slot_id, batt_current);