diff --git a/stm-firmware/digio.c b/stm-firmware/digio.c index a8c67e9..c544072 100644 --- a/stm-firmware/digio.c +++ b/stm-firmware/digio.c @@ -52,17 +52,10 @@ static void digio_setup_pin_int(uint8_t bit_no, uint8_t in_out, uint8_t alt_func } -void digio_setup_default_all(void) +void digio_init(void) { - unsigned int i; - rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(DIGIO_RCC_MASK)); - - for (i = 0; i < COUNT_OF(digio_pins); i++) { - digio_setup_pin_int(digio_pins[i], digio_default_io[i], digio_default_altfunc[i]); - if (digio_default_io[i] == 1) - digio_set(i, 0); - } + digio_set_default_values(); } void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func) @@ -219,3 +212,14 @@ void TIM7_IRQHandler(void) #endif /** @} */ + +void digio_set_default_values() +{ + unsigned int i; + + for (i = 0; i < COUNT_OF(digio_pins); i++) { + digio_setup_pin_int(digio_pins[i], digio_default_io[i], digio_default_altfunc[i]); + if (digio_default_io[i] == 1) + digio_set(i, 0); + } +} diff --git a/stm-firmware/include/reflow-controller/digio.h b/stm-firmware/include/reflow-controller/digio.h index d8316e5..495aa3d 100644 --- a/stm-firmware/include/reflow-controller/digio.h +++ b/stm-firmware/include/reflow-controller/digio.h @@ -65,11 +65,19 @@ #define BEEPER_RCC_MASK RCC_AHB1ENR_GPIOBEN /** - * @brief Enable all clocks and setup pins in default setting + * @brief Enable all clocks and setup pins in default setting. * @warning This function uses @ref rcc_manager_enable_clock to enable the clocks. Therefore, it must not be called * multiple times. + * @note Calls @ref digio_set_default_values() internally. */ -void digio_setup_default_all(void); +void digio_init(void); + +/** + * @brief Setup or restore the default DIGIO settings. + * + * This function can be called multiple times. + */ +void digio_set_default_values(void); /** * @brief Set up a DIGIO pin. diff --git a/stm-firmware/main.c b/stm-firmware/main.c index be066e1..dcf8145 100644 --- a/stm-firmware/main.c +++ b/stm-firmware/main.c @@ -219,8 +219,8 @@ static inline void setup_system(void) /** - Initialize the oven output driver outputting the wavepacket control signal for the SSR and */ oven_driver_init(); - /** - Initialize all DIGIO Pins to theri default state and pin functions */ - digio_setup_default_all(); + /** - Initialize all DIGIO Pins to their default state and pin functions */ + digio_init(); /** - Set-up the LED outputs */ led_setup(); diff --git a/stm-firmware/temp-profile/temp-profile-executer.c b/stm-firmware/temp-profile/temp-profile-executer.c index 2ee1170..f5631a8 100644 --- a/stm-firmware/temp-profile/temp-profile-executer.c +++ b/stm-firmware/temp-profile/temp-profile-executer.c @@ -299,7 +299,9 @@ int temp_profile_executer_stop(void) if (command_list) temp_profile_free_command_list(&command_list); + /* Reset loudspeaker and reset default state of DIGIO channels */ loudspeaker_set(0); + digio_set_default_values(); return 0; }