MetaWear C++ API  0.18.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 
64 
90 
91 #ifdef __cplusplus
92 }
93 #endif
uint8_t low_intensity
Intensity when the pulse is in a low state, between [0, 31].
Definition: led.h:41
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.
Attributes describing a light pulse.
Definition: led.h:39
MblMwLedPreset
Enumeration of preset patterns available in the library Patterns are based on the led blog post...
Definition: led.h:30
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
uint16_t high_time_ms
Length of time the pulse spends in the high state, in milliseconds.
Definition: led.h:43
METAWEAR_API void mbl_mw_led_stop_and_clear(const MblMwMetaWearBoard *board)
Stops playing LED patterns and clears all pattern configurations.
uint16_t fall_time_ms
Transition time from high to low state, in milliseconds.
Definition: led.h:44
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
METAWEAR_API void mbl_mw_led_autoplay(const MblMwMetaWearBoard *board)
Plays any programmed patterns, and immediately plays any patterns programmed later.
uint16_t rise_time_ms
Transition time from low to high state, in milliseconds.
Definition: led.h:42
const uint8_t MBL_MW_LED_REPEAT_INDEFINITELY
Value indicating the led pulse will repeat indefinitely.
Definition: led.h:15
uint8_t high_intensity
Intensity when the pulse is in a high state, between [0, 31].
Definition: led.h:40
METAWEAR_API void mbl_mw_led_stop(const MblMwMetaWearBoard *board)
Stops playing LED patterns.
uint8_t repeat_count
Number of repetitions.
Definition: led.h:47
uint16_t pulse_duration_ms
Length of time for one pulse, in milliseconds.
Definition: led.h:45
METAWEAR_API void mbl_mw_led_play(const MblMwMetaWearBoard *board)
Plays any programmed patterns.
METAWEAR_API void mbl_mw_led_load_preset_pattern(MblMwLedPattern *pattern, MblMwLedPreset preset)
Loads the struct with a preset configuration.
#define METAWEAR_API
Indicates the function should be exported to the symbol table.
Definition: dllmarker.h:27
METAWEAR_API void mbl_mw_led_pause(const MblMwMetaWearBoard *board)
Pauses the patterns.