enhancement/39-digio-cmd-profile-language #44

Merged
mhu merged 5 commits from enhancement/39-digio-cmd-profile-language into dev 2021-12-26 21:20:15 +01:00
4 changed files with 27 additions and 13 deletions
Showing only changes of commit a8a622df25 - Show all commits

View File

@ -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)); rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(DIGIO_RCC_MASK));
digio_set_default_values();
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);
}
} }
void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func) void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func)
@ -219,3 +212,14 @@ void TIM7_IRQHandler(void)
#endif #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);
}
}

View File

@ -65,11 +65,19 @@
#define BEEPER_RCC_MASK RCC_AHB1ENR_GPIOBEN #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 * @warning This function uses @ref rcc_manager_enable_clock to enable the clocks. Therefore, it must not be called
* multiple times. * 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. * @brief Set up a DIGIO pin.

View File

@ -219,8 +219,8 @@ static inline void setup_system(void)
/** - Initialize the oven output driver outputting the wavepacket control signal for the SSR and */ /** - Initialize the oven output driver outputting the wavepacket control signal for the SSR and */
oven_driver_init(); oven_driver_init();
/** - Initialize all DIGIO Pins to theri default state and pin functions */ /** - Initialize all DIGIO Pins to their default state and pin functions */
digio_setup_default_all(); digio_init();
/** - Set-up the LED outputs */ /** - Set-up the LED outputs */
led_setup(); led_setup();

View File

@ -299,7 +299,9 @@ int temp_profile_executer_stop(void)
if (command_list) if (command_list)
temp_profile_free_command_list(&command_list); temp_profile_free_command_list(&command_list);
/* Reset loudspeaker and reset default state of DIGIO channels */
loudspeaker_set(0); loudspeaker_set(0);
digio_set_default_values();
return 0; return 0;
} }