VLCB SDK
An opinionated SDK for VLCB protocol
Loading...
Searching...
No Matches
inc/vlcb/platform/driver/led.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <stdint.h>
4
#include <stdbool.h>
5
6
#include "
vlcb/platform/time.h
"
7
8
typedef
enum
{
9
VLCB_PLATFORM_LED_FX_BLINK
,
10
VLCB_PLATFORM_LED_FX_PULSE
11
}
VlcbPlatformLedEffectType
;
12
13
typedef
struct
{
14
uint16_t
hz
;
15
}
VlcbPlatformLedEffectDataBlink
;
16
17
typedef
struct
{
18
uint32_t
durationMs
;
19
}
VlcbPlatformLedEffectDataPulse
;
20
21
typedef
union
{
22
VlcbPlatformLedEffectDataPulse
pulse
;
23
VlcbPlatformLedEffectDataBlink
blink
;
24
}
VlcbPlatformLedEffectData
;
25
26
typedef
struct
{
27
bool
hasStarted
;
28
VlcbPlatformLedEffectType
type
;
29
VlcbPlatformLedEffectData
data
;
30
clock_t
currentCycleStartedAt
;
31
clock_t
startedAt
;
32
uint32_t
duration
;
33
}
VlcbPlatformLedEffect
;
34
35
VlcbPlatformLedEffect
vlcb_platform_led_fx_Blink
(uint16_t hz);
36
VlcbPlatformLedEffect
vlcb_platform_led_fx_Pulse
(uint32_t duration_ms);
37
38
typedef
enum
{
39
VLCB_PLATFORM_LED_OFF
,
40
VLCB_PLATFORM_LED_ON
,
41
}
VlcbPlatformLedState
;
42
43
typedef
VlcbPlatformLedState
(*
VlcbPlatformLedStatusResolver
)(void);
44
typedef
void (*
VlcbPlatformLedStatusChangeHandler
)(void);
45
46
typedef
struct
{
47
VlcbPlatformLedState
state
;
48
bool
hasEffect
;
49
VlcbPlatformLedEffect
effect
;
50
VlcbPlatformLedStatusResolver
statusResolver
;
51
VlcbPlatformLedStatusChangeHandler
statusChangeHandler
;
52
}
VlcbPlatformLedDriver
;
53
54
VlcbPlatformLedDriver
vlcb_platform_led_New
(
VlcbPlatformLedStatusResolver
resolver,
VlcbPlatformLedStatusChangeHandler
changeHandler);
vlcb_platform_led_fx_Blink
VlcbPlatformLedEffect vlcb_platform_led_fx_Blink(uint16_t hz)
Definition
led.c:4
vlcb_platform_led_fx_Pulse
VlcbPlatformLedEffect vlcb_platform_led_fx_Pulse(uint32_t duration_ms)
Definition
led.c:6
VlcbPlatformLedStatusChangeHandler
void(* VlcbPlatformLedStatusChangeHandler)(void)
Definition
inc/vlcb/platform/driver/led.h:44
VlcbPlatformLedStatusResolver
VlcbPlatformLedState(* VlcbPlatformLedStatusResolver)(void)
Definition
inc/vlcb/platform/driver/led.h:43
vlcb_platform_led_New
VlcbPlatformLedDriver vlcb_platform_led_New(VlcbPlatformLedStatusResolver resolver, VlcbPlatformLedStatusChangeHandler changeHandler)
Definition
led.c:8
VlcbPlatformLedState
VlcbPlatformLedState
Definition
inc/vlcb/platform/driver/led.h:38
VLCB_PLATFORM_LED_OFF
@ VLCB_PLATFORM_LED_OFF
Definition
inc/vlcb/platform/driver/led.h:39
VLCB_PLATFORM_LED_ON
@ VLCB_PLATFORM_LED_ON
Definition
inc/vlcb/platform/driver/led.h:40
VlcbPlatformLedEffectType
VlcbPlatformLedEffectType
Definition
inc/vlcb/platform/driver/led.h:8
VLCB_PLATFORM_LED_FX_BLINK
@ VLCB_PLATFORM_LED_FX_BLINK
Definition
inc/vlcb/platform/driver/led.h:9
VLCB_PLATFORM_LED_FX_PULSE
@ VLCB_PLATFORM_LED_FX_PULSE
Definition
inc/vlcb/platform/driver/led.h:10
VlcbPlatformLedDriver
Definition
inc/vlcb/platform/driver/led.h:46
VlcbPlatformLedDriver::effect
VlcbPlatformLedEffect effect
Definition
inc/vlcb/platform/driver/led.h:49
VlcbPlatformLedDriver::state
VlcbPlatformLedState state
Definition
inc/vlcb/platform/driver/led.h:47
VlcbPlatformLedDriver::statusResolver
VlcbPlatformLedStatusResolver statusResolver
Definition
inc/vlcb/platform/driver/led.h:50
VlcbPlatformLedDriver::hasEffect
bool hasEffect
Definition
inc/vlcb/platform/driver/led.h:48
VlcbPlatformLedDriver::statusChangeHandler
VlcbPlatformLedStatusChangeHandler statusChangeHandler
Definition
inc/vlcb/platform/driver/led.h:51
VlcbPlatformLedEffectDataBlink
Definition
inc/vlcb/platform/driver/led.h:13
VlcbPlatformLedEffectDataBlink::hz
uint16_t hz
Definition
inc/vlcb/platform/driver/led.h:14
VlcbPlatformLedEffectDataPulse
Definition
inc/vlcb/platform/driver/led.h:17
VlcbPlatformLedEffectDataPulse::durationMs
uint32_t durationMs
Definition
inc/vlcb/platform/driver/led.h:18
VlcbPlatformLedEffect
Definition
inc/vlcb/platform/driver/led.h:26
VlcbPlatformLedEffect::duration
uint32_t duration
Definition
inc/vlcb/platform/driver/led.h:32
VlcbPlatformLedEffect::hasStarted
bool hasStarted
Definition
inc/vlcb/platform/driver/led.h:27
VlcbPlatformLedEffect::type
VlcbPlatformLedEffectType type
Definition
inc/vlcb/platform/driver/led.h:28
VlcbPlatformLedEffect::startedAt
clock_t startedAt
Definition
inc/vlcb/platform/driver/led.h:31
VlcbPlatformLedEffect::data
VlcbPlatformLedEffectData data
Definition
inc/vlcb/platform/driver/led.h:29
VlcbPlatformLedEffect::currentCycleStartedAt
clock_t currentCycleStartedAt
Definition
inc/vlcb/platform/driver/led.h:30
time.h
VlcbPlatformLedEffectData
Definition
inc/vlcb/platform/driver/led.h:21
VlcbPlatformLedEffectData::pulse
VlcbPlatformLedEffectDataPulse pulse
Definition
inc/vlcb/platform/driver/led.h:22
VlcbPlatformLedEffectData::blink
VlcbPlatformLedEffectDataBlink blink
Definition
inc/vlcb/platform/driver/led.h:23
platform
inc
vlcb
platform
driver
led.h
Generated on Mon Nov 4 2024 09:13:33 for VLCB SDK by
1.12.0