MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
led.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "peripheral_common.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
15 const uint8_t MBL_MW_LED_REPEAT_INDEFINITELY = 0xff;
16 
20 typedef enum {
21  MBL_MW_LED_COLOR_GREEN,
22  MBL_MW_LED_COLOR_RED,
23  MBL_MW_LED_COLOR_BLUE
25 
30 typedef enum {
31  MBL_MW_LED_PRESET_BLINK,
32  MBL_MW_LED_PRESET_PULSE,
33  MBL_MW_LED_PRESET_SOLID
35 
39 typedef struct {
40  uint8_t high_intensity;
41  uint8_t low_intensity;
42  uint16_t rise_time_ms;
43  uint16_t high_time_ms;
44  uint16_t fall_time_ms;
45  uint16_t pulse_duration_ms;
46  uint16_t delay_time_ms;
47  uint8_t repeat_count;
49 
56 
89 
90 #ifdef __cplusplus
91 }
92 #endif
#define METAWEAR_API
Indicates the function should be exported to the symbol table
Definition: dllmarker.h:27
METAWEAR_API void mbl_mw_led_load_preset_pattern(MblMwLedPattern *pattern, MblMwLedPreset preset)
Loads the struct with a preset configuration.
METAWEAR_API void mbl_mw_led_stop(const MblMwMetaWearBoard *board)
Stops playing LED patterns.
METAWEAR_API void mbl_mw_led_stop_and_clear(const MblMwMetaWearBoard *board)
Stops playing LED patterns and clears all pattern configurations.
const uint8_t MBL_MW_LED_REPEAT_INDEFINITELY
Value indicating the led pulse will repeat indefinitely.
Definition: led.h:15
MblMwLedColor
Available colors on the LED.
Definition: led.h:20
METAWEAR_API void mbl_mw_led_write_pattern(const MblMwMetaWearBoard *board, const MblMwLedPattern *pattern, MblMwLedColor color)
Writes the led pattern to the board.
METAWEAR_API void mbl_mw_led_autoplay(const MblMwMetaWearBoard *board)
Plays any programmed patterns, and immediately plays any patterns programmed later.
METAWEAR_API void mbl_mw_led_pause(const MblMwMetaWearBoard *board)
Pauses the patterns.
MblMwLedPreset
Enumeration of preset patterns available in the library Patterns are based on the led blog post,...
Definition: led.h:30
METAWEAR_API void mbl_mw_led_play(const MblMwMetaWearBoard *board)
Plays any programmed patterns.
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
Attributes describing a light pulse.
Definition: led.h:39
uint16_t fall_time_ms
Transition time from high to low state, in milliseconds.
Definition: led.h:44
uint16_t rise_time_ms
Transition time from low to high state, in milliseconds.
Definition: led.h:42
uint16_t pulse_duration_ms
Length of time for one pulse, in milliseconds.
Definition: led.h:45
uint8_t repeat_count
Number of repetitions.
Definition: led.h:47
uint8_t high_intensity
Intensity when the pulse is in a high state, between [0, 31].
Definition: led.h:40
uint8_t low_intensity
Intensity when the pulse is in a low state, between [0, 31].
Definition: led.h:41
uint16_t high_time_ms
Length of time the pulse spends in the high state, in milliseconds.
Definition: led.h:43
uint16_t delay_time_ms
How long to wait before starting the pulse, only used on firmware v1.2.3 or later.
Definition: led.h:46