Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
blinker.h File Reference
#include <stdint.h>

Go to the source code of this file.

Macros

#define BLINK_DIE_UNEXPIRQ   0x800002CA
 Unexpected IRQ.
 
#define BLINK_DIE_HARDFAULT   0x80000ACA
 Hard fault.
 
#define BLINK_DIE_NMI   0x8002A0CA /* 3-1-3 */
 Non-maskable interrupt arrived.
 
#define BLINK_DIE_SVC   0x800AA0CA /* 3-1-4 */
 SVC interrupt arrived (unexpected).
 
#define BLINK_DIE_PENDSV   0x802AA0CA /* 3-1-5 */
 PendSV interrupt arrived (unexpected).
 
#define BLINK_DIE_TICK   0x80AAA0CA /* 3-1-6 */
 Tick interrupt arrived (unexpected).
 
#define BLINK_DIE_OUTOFMEM   0x80008CCA
 Out of memory. (sbrk failed to allocate memory).
 
#define BLINK_DIE_ASSERT   0x80028CCA
 an ASSERT macro failed.
 
#define BLINK_DIE_STACKOVERFLOW   0x800A8CCA
 Stack overflow.
 
#define BLINK_DIE_OUTOFMEMSTACK   0x802A8CCA
 Out of stack memory space (used only where there is a separate memory block for stack).
 
#define BLINK_DIE_STACKCOLLIDE   0x80AA8CCA
 The stack and heap has collided. Not used.
 
#define BLINK_DIE_ABORT   0x8000CCCA
 abort() was called (usually due to an assertion failure or an uncaught C++ exception).
 
#define BLINK_DIE_WATCHDOG   0x8002CCCA
 Watchdog timeout.
 
#define BLINK_DIE_STARTUP   0x800ACCCA
 Unused. (Error during startup).
 

Functions

void setblink (uint32_t pattern)
 Initializes the blinker routine with a specific blinking pattern.
 
void resetblink (uint32_t pattern)
 Changes the blinking pattern.
 
void diewith (uint32_t)
 Sets a blinking pattern and never returns.
 
unsigned parseblink (uint32_t pattern)
 Turns a blinker pattern into an error code in BCD.
 

Variables

uint32_t blinker_pattern
 The currently active blinking pattern.
 

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.

An portable interface to access a single LED on hardware boards.

Author
Balazs Racz
Date
31 May 2014

Definition in file blinker.h.

Macro Definition Documentation

◆ BLINK_DIE_ABORT

#define BLINK_DIE_ABORT   0x8000CCCA

abort() was called (usually due to an assertion failure or an uncaught C++ exception).

Definition at line 71 of file blinker.h.

◆ BLINK_DIE_ASSERT

#define BLINK_DIE_ASSERT   0x80028CCA

an ASSERT macro failed.

Definition at line 60 of file blinker.h.

◆ BLINK_DIE_HARDFAULT

#define BLINK_DIE_HARDFAULT   0x80000ACA

Hard fault.

Definition at line 47 of file blinker.h.

◆ BLINK_DIE_NMI

#define BLINK_DIE_NMI   0x8002A0CA /* 3-1-3 */

Non-maskable interrupt arrived.

Definition at line 49 of file blinker.h.

◆ BLINK_DIE_OUTOFMEM

#define BLINK_DIE_OUTOFMEM   0x80008CCA

Out of memory. (sbrk failed to allocate memory).

Definition at line 58 of file blinker.h.

◆ BLINK_DIE_OUTOFMEMSTACK

#define BLINK_DIE_OUTOFMEMSTACK   0x802A8CCA

Out of stack memory space (used only where there is a separate memory block for stack).

Definition at line 65 of file blinker.h.

◆ BLINK_DIE_PENDSV

#define BLINK_DIE_PENDSV   0x802AA0CA /* 3-1-5 */

PendSV interrupt arrived (unexpected).

Definition at line 53 of file blinker.h.

◆ BLINK_DIE_STACKCOLLIDE

#define BLINK_DIE_STACKCOLLIDE   0x80AA8CCA

The stack and heap has collided. Not used.

Definition at line 67 of file blinker.h.

◆ BLINK_DIE_STACKOVERFLOW

#define BLINK_DIE_STACKOVERFLOW   0x800A8CCA

Stack overflow.

Definition at line 62 of file blinker.h.

◆ BLINK_DIE_STARTUP

#define BLINK_DIE_STARTUP   0x800ACCCA

Unused. (Error during startup).

Definition at line 75 of file blinker.h.

◆ BLINK_DIE_SVC

#define BLINK_DIE_SVC   0x800AA0CA /* 3-1-4 */

SVC interrupt arrived (unexpected).

Definition at line 51 of file blinker.h.

◆ BLINK_DIE_TICK

#define BLINK_DIE_TICK   0x80AAA0CA /* 3-1-6 */

Tick interrupt arrived (unexpected).

Definition at line 55 of file blinker.h.

◆ BLINK_DIE_UNEXPIRQ

#define BLINK_DIE_UNEXPIRQ   0x800002CA

Unexpected IRQ.

Definition at line 45 of file blinker.h.

◆ BLINK_DIE_WATCHDOG

#define BLINK_DIE_WATCHDOG   0x8002CCCA

Watchdog timeout.

Definition at line 73 of file blinker.h.

Function Documentation

◆ diewith()

void diewith ( uint32_t  pattern)
extern

Sets a blinking pattern and never returns.

Definition at line 148 of file Stm32Blinker.hxx.

◆ parseblink()

unsigned parseblink ( uint32_t  pattern)
extern

Turns a blinker pattern into an error code in BCD.

Parameters
patterna blinker pattern from the above examples.
Returns
a nonnegative integer with each 4-bit nibble representing the number of repeats in the block of blinks, in LSB-first order. So a blink 3-1-2 will be represented as 0x213.

Definition at line 40 of file Blinker.cxx.

◆ resetblink()

void resetblink ( uint32_t  pattern)
extern

Changes the blinking pattern.

Parameters
patternis the new blinking pattern.

Definition at line 109 of file Stm32Blinker.hxx.

◆ setblink()

void setblink ( uint32_t  pattern)
extern

Initializes the blinker routine with a specific blinking pattern.

Parameters
patternis the blinking pattern.

Definition at line 117 of file Stm32Blinker.hxx.

Variable Documentation

◆ blinker_pattern

uint32_t blinker_pattern
extern

The currently active blinking pattern.

The currently active blinking pattern.

Definition at line 103 of file Stm32Blinker.hxx.