MCCI Trusted Bootloader
Simple trusted bootloader and tools for small embedded systems
mcci_bootloader_led_annunciator.h
Go to the documentation of this file.
1/*
2
3Module: mcci_bootloader_led_annunciator.h
4
5Function:
6 Bootloader LED annunciator library functions
7
8Copyright and License:
9 This file copyright (C) 2026 by
10
11 MCCI Corporation
12 3520 Krums Corners Road
13 Ithaca, NY 14850
14
15 See accompanying LICENSE file for copyright and license information.
16
17Author:
18 Terry Moore, MCCI Corporation June 2026
19
20*/
21
22#ifndef _mcci_bootloader_led_annunciator_h_
23#define _mcci_bootloader_led_annunciator_h_ /* prevent multiple includes */
24
25#pragma once
26
27#ifndef _mcci_bootloader_types_h_
29#endif
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/// @brief symbolic type for the structure representing the bootloader LED state
36typedef struct McciBootloader_LED_Annunciator_s McciBootloader_LED_Annunciator_t;
37
38/// @brief The states of the Bootloader LED finite state machine.
48
49/// @brief The bootloader LED annunciator state object.
51 {
52 /// @brief incremented every systick
53 uint32_t tick;
54 ///
55 /// @brief Mask of pattern to be displayed on the LED.
56 ///
57 /// @details
58 /// The display pattern mask in ::display always
59 /// ends in a 1, followed by all zeroes to the right. This trailing is
60 /// the "stop bit", and is not displayed. ::display itself it is not
61 /// shifted; it is used to refresh the shift register, which is ::value.
62 /// For example, to display 0b101, annunciatorIndicateState adds a stop bit,
63 /// making 0b1011, then left-justifies in a uint32_t, making 0xB0000000.
64 ///
65 /// This is then copied to ::value after the inter-pattern gap. The update
66 /// routine (assumed to be called from the clock tick handler) shifts
67 /// ::value left, successively yielding 1, 0, 1. The FSM then flashed the LED
68 /// for 3 bit times, 1 bit time, and 3 bit times, with a 1-bit time pause between
69 /// each bit. The FSM discovers when shifting the stop bit that ::value is
70 /// now zero, and changes state to displaying the gap betwen words
71 /// (turning off the LED) for two bit times.
72 ///
73 uint32_t display;
74 ///
75 /// @brief bit pattern being displayed. Shifted left each systick. 1 means LED on,
76 /// 0 means LED off. When zero, there's nothing left to display for the
77 /// current pattern.
78 ///
79 uint32_t value;
80 ///
81 /// @brief number of systicks per bit. Usually, one systick is assumed to be
82 /// one millisecond, but this value is used to stretch bit times to something
83 /// perceptually useful.
84 ///
85 uint32_t bittime;
86 /// @brief tick count at which next thing should happen.
87 uint32_t timer;
88 /// @brief current state of the LED FSM.
90 };
91
92bool
94 void
95 );
96
97void
100 );
101
102void
104 void
105 );
106
107#ifdef __cplusplus
108}
109#endif
110
111#endif /* _mcci_bootloader_led_annunciator_h_ */
void McciBootloader_LED_annunciatorIndicateState(McciBootloaderState_t state)
void McciBootloader_LED_annunciatorInit(void)
McciBootloader_LED_AnnunciatorBitState_t
The states of the Bootloader LED finite state machine.
@ McciBootloader_LED_Annunciator_stNoChange
internal: don't change state.
@ McciBootloader_LED_Annunciator_stByteGap
displaying byte gap
@ McciBootloader_LED_Annunciator_stInitial
not initialized
@ McciBootloader_LED_Annunciator_stLedOn
light is on
@ McciBootloader_LED_Annunciator_stBitGap
displaying bit gap
@ McciBootloader_LED_Annunciator_stIdle
not displaying
bool McciBootloader_LED_handleSysTick(void)
uint32_t McciBootloaderState_t
Current boot system state.
The bootloader LED annunciator state object.
uint32_t value
bit pattern being displayed.
uint32_t timer
tick count at which next thing should happen.
uint32_t display
Mask of pattern to be displayed on the LED.
uint32_t bittime
number of systicks per bit.
McciBootloader_LED_AnnunciatorBitState_t bitState
current state of the LED FSM.