diff --git a/ccs/hardwareInterface.cpp b/ccs/hardwareInterface.cpp index 0622fd3..ca6d2b2 100644 --- a/ccs/hardwareInterface.cpp +++ b/ccs/hardwareInterface.cpp @@ -551,43 +551,43 @@ void hardwareInterface_WakeupOtherPeripherals() bool ppValid = Param::GetInt(Param::ResistanceProxPilot) < 2000; int wakeupPinFunc = Param::GetInt(Param::WakeupPinFunc); - if (!DigIo::supply_out.Get()) { + if (!DigIo::keep_power_on.Get()) { //Make sure we don't wake ourself up //Unless we monitor PP - DigIo::wakeup_out.Clear(); + DigIo::trigger_wakeup.Clear(); return; } switch (wakeupPinFunc) { case WAKEUP_LEVEL: - DigIo::wakeup_out.Set(); //Wake up other peripherals + DigIo::trigger_wakeup.Set(); //Wake up other peripherals break; case WAKEUP_PULSE: if (wakeUpPulseLength > 0) { wakeUpPulseLength--; - DigIo::wakeup_out.Set(); + DigIo::trigger_wakeup.Set(); } - else DigIo::wakeup_out.Clear(); + else DigIo::trigger_wakeup.Clear(); break; case WAKEUP_LEVEL | WAKEUP_ONVALIDCP: - if (dutyValid) DigIo::wakeup_out.Set(); - else DigIo::wakeup_out.Clear(); + if (dutyValid) DigIo::trigger_wakeup.Set(); + else DigIo::trigger_wakeup.Clear(); break; case WAKEUP_LEVEL | WAKEUP_ONVALIDPP: - if (ppValid || dutyValid) DigIo::wakeup_out.Set(); - else DigIo::wakeup_out.Clear(); + if (ppValid || dutyValid) DigIo::trigger_wakeup.Set(); + else DigIo::trigger_wakeup.Clear(); break; case WAKEUP_PULSE | WAKEUP_ONVALIDCP: if (dutyValid && wakeUpPulseLength > 0) { wakeUpPulseLength--; - DigIo::wakeup_out.Set(); + DigIo::trigger_wakeup.Set(); } else if (!dutyValid) { wakeUpPulseLength = 10; //allow pulsing again when PWM returns - DigIo::wakeup_out.Clear(); + DigIo::trigger_wakeup.Clear(); } else { - DigIo::wakeup_out.Clear(); + DigIo::trigger_wakeup.Clear(); } break; } diff --git a/include/digio_prj.h b/include/digio_prj.h index 7025320..8f08891 100644 --- a/include/digio_prj.h +++ b/include/digio_prj.h @@ -10,13 +10,13 @@ #define DIG_IO_LIST \ DIG_IO_ENTRY(spics, GPIOA, GPIO4, PinMode::OUTPUT) \ - DIG_IO_ENTRY(led_out, GPIOB, GPIO7, PinMode::OUTPUT) \ + DIG_IO_ENTRY(led_alive, GPIOB, GPIO7, PinMode::OUTPUT) \ DIG_IO_ENTRY(statec_out, GPIOB, GPIO4, PinMode::OUTPUT) \ DIG_IO_ENTRY(red_out, GPIOB, GPIO2, PinMode::OUTPUT) \ DIG_IO_ENTRY(green_out, GPIOB, GPIO10, PinMode::OUTPUT) \ DIG_IO_ENTRY(blue_out, GPIOB, GPIO11, PinMode::OUTPUT) \ DIG_IO_ENTRY(contact_out, GPIOA, GPIO1, PinMode::OUTPUT) \ - DIG_IO_ENTRY(wakeup_out, GPIOB, GPIO0, PinMode::OUTPUT) \ - DIG_IO_ENTRY(supply_out, GPIOB, GPIO1, PinMode::OUTPUT) \ + DIG_IO_ENTRY(trigger_wakeup, GPIOB, GPIO0, PinMode::OUTPUT) \ + DIG_IO_ENTRY(keep_power_on, GPIOB, GPIO1, PinMode::OUTPUT) \ #endif // PinMode_PRJ_H_INCLUDED diff --git a/include/main.h b/include/main.h index e30f310..b27542f 100644 --- a/include/main.h +++ b/include/main.h @@ -41,8 +41,6 @@ void Error_Handler(void); #define OUT_CONTACTOR_CONTROL1_GPIO_Port GPIOB #define OUT_CONTACTOR_CONTROL2_Pin GPIO_PIN_6 #define OUT_CONTACTOR_CONTROL2_GPIO_Port GPIOB -#define OUT_LED_ALIVE_Pin GPIO_PIN_7 -#define OUT_LED_ALIVE_GPIO_Port GPIOB /* USER CODE BEGIN Private defines */ diff --git a/src/main.cpp b/src/main.cpp index b8b3da0..9e9f1cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,7 +74,7 @@ static void Ms100Task(void) { static uint32_t lastValidCp = 0; - DigIo::led_out.Toggle(); + DigIo::led_alive.Toggle(); //The boot loader enables the watchdog, we have to reset it //at least every 2s or otherwise the controller is hard reset. iwdg_reset(); @@ -159,7 +159,7 @@ static void Ms100Task(void) { if ((Param::GetInt(Param::WakeupPinFunc) & WAKEUP_ONVALIDPP) == 0 || !ppValid) { - DigIo::supply_out.Clear(); + DigIo::keep_power_on.Clear(); } } } @@ -261,7 +261,7 @@ extern "C" int main(void) write_bootloader_pininit(); //Instructs boot loader to initialize certain pins gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, AFIO_MAPR_TIM3_REMAP_FULL_REMAP | AFIO_MAPR_TIM2_REMAP_FULL_REMAP); - DigIo::supply_out.Set(); //Make sure board stays awake + DigIo::keep_power_on.Set(); //Make sure board stays awake hardwareInterface_setStateB(); hw_evaluateHardwareVariants();