Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Stm32Blinker.hxx File Reference

Go to the source code of this file.

Functions

static TIM_TypeDef * get_blinker_timer ()
 
void setup_blinker ()
 Call this function in hw_preinit to set up the blinker timer.
 
void hw_set_to_safe (void)
 
void resetblink (uint32_t pattern)
 Changes the blinking pattern.
 
void setblink (uint32_t pattern)
 Initializes the blinker routine with a specific blinking pattern.
 
void BLINKER_INTERRUPT_HANDLER (void)
 
void wait_with_blinker (void)
 
void diewith (uint32_t pattern)
 Sets a blinking pattern and never returns.
 

Variables

uint32_t blinker_pattern = 0
 Stores the canonical pattern for the blinker.
 
static uint32_t rest_pattern = 0
 Stores what is left of the pattern during the current period.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Implements the crash blinker using an STM32 timer.

Author
Balazs Racz
Date
10 April 2022

Definition in file Stm32Blinker.hxx.

Function Documentation

◆ BLINKER_INTERRUPT_HANDLER()

void BLINKER_INTERRUPT_HANDLER ( void  )

Definition at line 122 of file Stm32Blinker.hxx.

◆ diewith()

void diewith ( uint32_t  pattern)

Sets a blinking pattern and never returns.

Definition at line 148 of file Stm32Blinker.hxx.

◆ get_blinker_timer()

static TIM_TypeDef * get_blinker_timer ( )
inlinestatic
Returns
constexpr timer instance typecast to the correct struct pointer.

Definition at line 68 of file Stm32Blinker.hxx.

◆ resetblink()

void resetblink ( uint32_t  pattern)

Changes the blinking pattern.

Parameters
patternis the new blinking pattern.

Definition at line 109 of file Stm32Blinker.hxx.

◆ setblink()

void setblink ( uint32_t  pattern)

Initializes the blinker routine with a specific blinking pattern.

Parameters
patternis the blinking pattern.

Definition at line 117 of file Stm32Blinker.hxx.

◆ setup_blinker()

void setup_blinker ( )

Call this function in hw_preinit to set up the blinker timer.

Definition at line 76 of file Stm32Blinker.hxx.

◆ wait_with_blinker()

void wait_with_blinker ( void  )

Definition at line 140 of file Stm32Blinker.hxx.

Variable Documentation

◆ blinker_pattern

uint32_t blinker_pattern = 0

Stores the canonical pattern for the blinker.

The currently active blinking pattern.

Definition at line 103 of file Stm32Blinker.hxx.

◆ rest_pattern

uint32_t rest_pattern = 0
static

Stores what is left of the pattern during the current period.

Definition at line 105 of file Stm32Blinker.hxx.