LCM — CH32V003 Light Control Module
Light Control Module, I2C slave
Loading...
Searching...
No Matches
lcm_led.c File Reference
#include "lcm_led.h"
#include "debug.h"
#include "ch32v00x_conf.h"

Go to the source code of this file.

Macros

#define LCM_LED_GREEN_MS   100U
 
#define LCM_LED_RED_MIN_MS   100U
 
#define LCM_LED_RED_PORT   GPIOD
 
#define LCM_LED_RED_PIN   GPIO_Pin_4
 
#define LCM_LED_GREEN_PORT   GPIOC
 
#define LCM_LED_GREEN_PIN   GPIO_Pin_0
 

Functions

static void LCM_Led_RedSet (uint8_t on)
 
static void LCM_Led_GreenSet (uint8_t on)
 
static void LCM_Led_ConfigPins (void)
 
void LCM_Led_Init (void)
 
void LCM_Led_ErrorOn (void)
 
void LCM_Led_ErrorOff (void)
 
void LCM_Led_ActivityPulse (void)
 
void LCM_Led_Poll (void)
 

Variables

static volatile uint16_t s_green_ms_left
 
static volatile uint16_t s_red_ms_left
 
static volatile uint8_t s_red_off_pending
 

Macro Definition Documentation

◆ LCM_LED_GREEN_MS

#define LCM_LED_GREEN_MS   100U

Definition at line 21 of file lcm_led.c.

Referenced by LCM_Led_ActivityPulse().

◆ LCM_LED_GREEN_PIN

#define LCM_LED_GREEN_PIN   GPIO_Pin_0

Definition at line 27 of file lcm_led.c.

Referenced by LCM_Led_ConfigPins(), and LCM_Led_GreenSet().

◆ LCM_LED_GREEN_PORT

#define LCM_LED_GREEN_PORT   GPIOC

Definition at line 26 of file lcm_led.c.

Referenced by LCM_Led_ConfigPins(), and LCM_Led_GreenSet().

◆ LCM_LED_RED_MIN_MS

#define LCM_LED_RED_MIN_MS   100U

Definition at line 22 of file lcm_led.c.

Referenced by LCM_Led_ErrorOn().

◆ LCM_LED_RED_PIN

#define LCM_LED_RED_PIN   GPIO_Pin_4

Definition at line 25 of file lcm_led.c.

Referenced by LCM_Led_ConfigPins(), and LCM_Led_RedSet().

◆ LCM_LED_RED_PORT

#define LCM_LED_RED_PORT   GPIOD

Definition at line 24 of file lcm_led.c.

Referenced by LCM_Led_ConfigPins(), and LCM_Led_RedSet().

Function Documentation

◆ LCM_Led_ActivityPulse()

void LCM_Led_ActivityPulse ( void )

Definition at line 110 of file lcm_led.c.

References LCM_LED_GREEN_MS, LCM_Led_GreenSet(), and s_green_ms_left.

Referenced by LCM_I2C_OnRxData().

◆ LCM_Led_ConfigPins()

static void LCM_Led_ConfigPins ( void )
static

Definition at line 67 of file lcm_led.c.

References LCM_LED_GREEN_PIN, LCM_LED_GREEN_PORT, LCM_LED_RED_PIN, and LCM_LED_RED_PORT.

Referenced by LCM_Led_Init().

◆ LCM_Led_ErrorOff()

void LCM_Led_ErrorOff ( void )

◆ LCM_Led_ErrorOn()

void LCM_Led_ErrorOn ( void )

Definition at line 93 of file lcm_led.c.

References LCM_LED_RED_MIN_MS, LCM_Led_RedSet(), s_red_ms_left, and s_red_off_pending.

Referenced by LCM_SetError().

◆ LCM_Led_GreenSet()

static void LCM_Led_GreenSet ( uint8_t on)
static

Definition at line 58 of file lcm_led.c.

References LCM_LED_GREEN_PIN, and LCM_LED_GREEN_PORT.

Referenced by LCM_Led_ActivityPulse(), LCM_Led_Init(), and LCM_Led_Poll().

◆ LCM_Led_Init()

void LCM_Led_Init ( void )

◆ LCM_Led_Poll()

void LCM_Led_Poll ( void )

Definition at line 116 of file lcm_led.c.

References LCM_Led_GreenSet(), LCM_Led_RedSet(), s_green_ms_left, s_red_ms_left, and s_red_off_pending.

Referenced by LCM_Module_Poll().

◆ LCM_Led_RedSet()

static void LCM_Led_RedSet ( uint8_t on)
static

Definition at line 49 of file lcm_led.c.

References LCM_LED_RED_PIN, and LCM_LED_RED_PORT.

Referenced by LCM_Led_ErrorOff(), LCM_Led_ErrorOn(), LCM_Led_Init(), and LCM_Led_Poll().

Variable Documentation

◆ s_green_ms_left

volatile uint16_t s_green_ms_left
static

Definition at line 36 of file lcm_led.c.

Referenced by LCM_Led_ActivityPulse(), LCM_Led_Init(), and LCM_Led_Poll().

◆ s_red_ms_left

volatile uint16_t s_red_ms_left
static

Definition at line 46 of file lcm_led.c.

Referenced by LCM_Led_ErrorOff(), LCM_Led_ErrorOn(), LCM_Led_Init(), and LCM_Led_Poll().

◆ s_red_off_pending

volatile uint8_t s_red_off_pending
static

Definition at line 47 of file lcm_led.c.

Referenced by LCM_Led_ErrorOff(), LCM_Led_ErrorOn(), LCM_Led_Init(), and LCM_Led_Poll().