34#ifndef _FREERTOS_DRIVERS_ST_STM32BLINKER_HXX_
35#define _FREERTOS_DRIVERS_ST_STM32BLINKER_HXX_
63#ifndef BLINKER_INTERRUPT_HANDLER
64#error must include hardware.hxx before Stm32Blinker.hxx
70 return (TIM_TypeDef *)BlinkerHw::TIMER_BASE;
78 BlinkerHw::clock_enable();
80 TIM_HandleTypeDef TimHandle;
81 memset(&TimHandle, 0,
sizeof(TimHandle));
83 TimHandle.Init.Period = configCPU_CLOCK_HZ / 10000 / 5;
84 TimHandle.Init.Prescaler = 10000;
85 TimHandle.Init.ClockDivision = 0;
86 TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
87 TimHandle.Init.RepetitionCounter = 0;
88 if (HAL_TIM_Base_Init(&TimHandle) != HAL_OK)
93 if (HAL_TIM_Base_Start_IT(&TimHandle) != HAL_OK)
98 NVIC_SetPriority(BlinkerHw::TIMER_IRQn, 0);
99 NVIC_EnableIRQ(BlinkerHw::TIMER_IRQn);
107extern void hw_set_to_safe(
void);
113 BLINKER_RAW_Pin::set(pattern ?
true :
false);
122void BLINKER_INTERRUPT_HANDLER(
void)
140void wait_with_blinker(
void)
144 BLINKER_INTERRUPT_HANDLER();
uint32_t blinker_pattern
Stores the canonical pattern for the blinker.
void diewith(uint32_t pattern)
Sets a blinking pattern and never returns.
static uint32_t rest_pattern
Stores what is left of the pattern during the current period.
void setup_blinker()
Call this function in hw_preinit to set up the blinker timer.
void resetblink(uint32_t pattern)
Changes the blinking pattern.
static TIM_TypeDef * get_blinker_timer()
void setblink(uint32_t pattern)
Initializes the blinker routine with a specific blinking pattern.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.