rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
led.c File Reference

Functions

void LedBlinkInit (blt_int16u interval_ms)
 Initializes the LED blink driver.
 
void LedBlinkTask (void)
 Task function for blinking the LED as a fixed timer interval.
 
void LedBlinkExit (void)
 Cleans up the LED blink driver. This is intended to be used upon program exit.
 

Variables

static blt_int16u ledBlinkIntervalMs
 Holds the desired LED blink interval time.
 

Function Documentation

◆ LedBlinkExit()

void LedBlinkExit ( void  )

Cleans up the LED blink driver. This is intended to be used upon program exit.

Returns
none.

Definition at line 101 of file led.c.

102{
103 /* turn the LED off */
104 HAL_GPIO_WritePin(STATUS_LED_PORT, STATUS_LED_PIN, GPIO_PIN_RESET);
105} /*** end of LedBlinkExit ***/

Referenced by CpuUserProgramStartHook().

Here is the caller graph for this function:

◆ LedBlinkInit()

void LedBlinkInit ( blt_int16u  interval_ms)

Initializes the LED blink driver.

Parameters
interval_msSpecifies the desired LED blink interval time in milliseconds.
Returns
none.

Definition at line 58 of file led.c.

59{
60 /* store the interval time between LED toggles */
61 ledBlinkIntervalMs = interval_ms;
62} /*** end of LedBlinkInit ***/
static blt_int16u ledBlinkIntervalMs
Holds the desired LED blink interval time.
Definition led.c:49

◆ LedBlinkTask()

void LedBlinkTask ( void  )

Task function for blinking the LED as a fixed timer interval.

Returns
none.

Definition at line 70 of file led.c.

71{
72 static blt_bool ledOn = BLT_FALSE;
73 static blt_int32u nextBlinkEvent = 0;
74
75 /* check for blink event */
76 if (TimerGet() >= nextBlinkEvent)
77 {
78 /* toggle the LED state */
79 if (ledOn == BLT_FALSE)
80 {
81 ledOn = BLT_TRUE;
82 HAL_GPIO_WritePin(STATUS_LED_PORT, STATUS_LED_PIN, GPIO_PIN_SET);
83 }
84 else
85 {
86 ledOn = BLT_FALSE;
87 HAL_GPIO_WritePin(STATUS_LED_PORT, STATUS_LED_PIN, GPIO_PIN_RESET);
88 }
89 /* schedule the next blink event */
90 nextBlinkEvent = TimerGet() + ledBlinkIntervalMs;
91 }
92} /*** end of LedBlinkTask ***/
blt_int32u TimerGet()
unsigned char blt_bool
Definition types.h:46
unsigned int blt_int32u
Definition types.h:53
Here is the call graph for this function:

Variable Documentation

◆ ledBlinkIntervalMs

blt_int16u ledBlinkIntervalMs
static

Holds the desired LED blink interval time.

Definition at line 49 of file led.c.

Referenced by LedBlinkInit(), and LedBlinkTask().

Go to the source code of this file.