MetaWear C++ API
0.18.0
C++ implementation of the MetaWear protocol
|
Interacts with NeoPixel strands. More...
#include "peripheral_common.h"
Go to the source code of this file.
Enumerations | |
enum | MblMwNeoPixelColorOrdering { MBL_MW_NP_WS2811_RGB = 0, MBL_MW_NP_WS2811_RBG, MBL_MW_NP_WS2811_GRB, MBL_MW_NP_WS2811_GBR } |
Color ordering for the NeoPixel color values. More... | |
enum | MblMwNeoPixelRotDirection { MBL_MW_NP_ROT_DIR_TOWARDS, MBL_MW_NP_ROT_DIR_AWAY } |
Enumeration of rotation directions. More... | |
Functions | |
METAWEAR_API void | mbl_mw_neopixel_init_slow_strand (const MblMwMetaWearBoard *board, uint8_t strand, uint8_t gpio_pin, uint8_t n_pixels, MblMwNeoPixelColorOrdering ordering) |
Initializes memory on the MetaWear board for a NeoPixel strand with a slow operating speed (400 KHz) More... | |
METAWEAR_API void | mbl_mw_neopixel_init_fast_strand (const MblMwMetaWearBoard *board, uint8_t strand, uint8_t gpio_pin, uint8_t n_pixels, MblMwNeoPixelColorOrdering ordering) |
Initializes memory on the MetaWear board for a NeoPixel strand with a fast operating speed (800 KHz) More... | |
METAWEAR_API void | mbl_mw_neopixel_free_strand (const MblMwMetaWearBoard *board, uint8_t strand) |
Frees NeoPixel resources on the MetaWeard board for a specific strand. More... | |
METAWEAR_API void | mbl_mw_neopixel_enable_hold (const MblMwMetaWearBoard *board, uint8_t strand) |
Enables strand holding which will not refresh with any LED changes until the hold is disabled. More... | |
METAWEAR_API void | mbl_mw_neopixel_disable_hold (const MblMwMetaWearBoard *board, uint8_t strand) |
Disables strand holding. More... | |
METAWEAR_API void | mbl_mw_neopixel_clear (const MblMwMetaWearBoard *board, uint8_t strand, uint8_t start, uint8_t end) |
Clears pixel states on a strand. More... | |
METAWEAR_API void | mbl_mw_neopixel_set_color (const MblMwMetaWearBoard *board, uint8_t strand, uint8_t pixel, uint8_t red, uint8_t green, uint8_t blue) |
Sets pixel color. More... | |
METAWEAR_API void | mbl_mw_neopixel_rotate (const MblMwMetaWearBoard *board, uint8_t strand, uint8_t count, uint16_t period_ms, MblMwNeoPixelRotDirection direction) |
Rotates the pixels on a strand. More... | |
METAWEAR_API void | mbl_mw_neopixel_rotate_indefinitely (const MblMwMetaWearBoard *board, uint8_t strand, uint8_t period_ms, MblMwNeoPixelRotDirection direction) |
Rotates the pixels on a strand indefinitely. More... | |
METAWEAR_API void | mbl_mw_neopixel_stop_rotation (const MblMwMetaWearBoard *board, uint8_t strand) |
Stops the pixel rotation. More... | |
Interacts with NeoPixel strands.
METAWEAR_API void mbl_mw_neopixel_clear | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand, | ||
uint8_t | start, | ||
uint8_t | end | ||
) |
Clears pixel states on a strand.
board | Pointer to the board to send the command to |
strand | Strand number to clear |
start | Pixel index to start clearing from |
end | Pixel index to clear to, inclusive |
METAWEAR_API void mbl_mw_neopixel_disable_hold | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand | ||
) |
Disables strand holding.
The strand will be refreshed with any LED changes programmed while the hold was active
board | Pointer to the board to send the command to |
strand | Strand number (id) to release |
METAWEAR_API void mbl_mw_neopixel_enable_hold | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand | ||
) |
Enables strand holding which will not refresh with any LED changes until the hold is disabled.
This let you to form complex LED patterns without having the strand refresh with partial changes.
board | Pointer to the board to send the command to |
strand | Strand number (id) to hold |
METAWEAR_API void mbl_mw_neopixel_free_strand | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand | ||
) |
Frees NeoPixel resources on the MetaWeard board for a specific strand.
board | Pointer to the board to send the command to |
strand | Strand index to free |
METAWEAR_API void mbl_mw_neopixel_init_fast_strand | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand, | ||
uint8_t | gpio_pin, | ||
uint8_t | n_pixels, | ||
MblMwNeoPixelColorOrdering | ordering | ||
) |
Initializes memory on the MetaWear board for a NeoPixel strand with a fast operating speed (800 KHz)
board | Pointer to the board to send the command to |
strand | Strand number (id) to initialize, can be in the range [0, 2] |
ordering | Color ordering format |
gpio_pin | GPIO pin the strand's data pin is connected to |
n_pixels | Number of pixels to allocate memory for |
METAWEAR_API void mbl_mw_neopixel_init_slow_strand | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand, | ||
uint8_t | gpio_pin, | ||
uint8_t | n_pixels, | ||
MblMwNeoPixelColorOrdering | ordering | ||
) |
Initializes memory on the MetaWear board for a NeoPixel strand with a slow operating speed (400 KHz)
board | Pointer to the board to send the command to |
strand | Strand number (id) to initialize, can be in the range [0, 2] |
ordering | Color ordering format |
gpio_pin | GPIO pin the strand's data pin is connected to |
n_pixels | Number of pixels to allocate memory for |
METAWEAR_API void mbl_mw_neopixel_rotate | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand, | ||
uint8_t | count, | ||
uint16_t | period_ms, | ||
MblMwNeoPixelRotDirection | direction | ||
) |
Rotates the pixels on a strand.
board | Pointer to the board to send the command to |
strand | Strand to rotate |
direction | Rotation direction |
count | Number of times to repeat the rotation |
period_ms | Amount of time, in milliseconds, between rotations |
METAWEAR_API void mbl_mw_neopixel_rotate_indefinitely | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand, | ||
uint8_t | period_ms, | ||
MblMwNeoPixelRotDirection | direction | ||
) |
Rotates the pixels on a strand indefinitely.
board | Pointer to the board to send the command to |
strand | Strand to rotate |
direction | Rotation direction |
period_ms | Amount of time, in milliseconds, between rotations |
METAWEAR_API void mbl_mw_neopixel_set_color | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand, | ||
uint8_t | pixel, | ||
uint8_t | red, | ||
uint8_t | green, | ||
uint8_t | blue | ||
) |
Sets pixel color.
board | Pointer to the board to send the command to |
strand | Strand number the pixel is on |
pixel | Index of the pixel |
red | Red value, between [0, 255] |
green | Green value, between [0, 255] |
blue | Blue value, between [0, 255] |
METAWEAR_API void mbl_mw_neopixel_stop_rotation | ( | const MblMwMetaWearBoard * | board, |
uint8_t | strand | ||
) |
Stops the pixel rotation.
board | Pointer to the board to send the command to |
strand | Strand to stop LED rotation |