Skip to content

File syn_smartled.h

FileList > output > syn_smartled.h

Go to the source code of this file

Generic Addressable RGB/RGBW Smart LED Strip Driver (WS2812B, SK6812, APA102, SK9822).

  • #include "../common/syn_defs.h"
  • #include "../port/syn_port_gpio.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_SmartLED
Generic Smart LED Strip Instance Context.
struct SYN_SmartLEDColor
24-bit RGB Color Struct.

Public Types

Type Name
enum SYN_SmartLEDOrder
Smart LED Color Channel Order.

Public Functions

Type Name
void syn_smartled_clear (SYN_SmartLED * led)
Clear all pixels in strip (turn off all LEDs).
void syn_smartled_fill_rgb (SYN_SmartLED * led, uint8_t r, uint8_t g, uint8_t b)
Fill entire strip with a single RGB color.
SYN_Status syn_smartled_init (SYN_SmartLED * led, SYN_GPIO_Pin data_pin, uint16_t num_leds, SYN_SmartLEDColor * pixel_buf, SYN_SmartLEDOrder order)
Initialize a Smart LED Strip context.
void syn_smartled_set_brightness (SYN_SmartLED * led, uint8_t brightness)
Set global brightness scale (0 = off, 255 = 100% full brightness).
void syn_smartled_set_pixel_hsv (SYN_SmartLED * led, uint16_t index, uint8_t h, uint8_t s, uint8_t v)
Set HSV color of a specific LED pixel (0-255 hue, sat, val).
void syn_smartled_set_pixel_rgb (SYN_SmartLED * led, uint16_t index, uint8_t r, uint8_t g, uint8_t b)
Set RGB color of a specific LED pixel.

Public Types Documentation

enum SYN_SmartLEDOrder

Smart LED Color Channel Order.

enum SYN_SmartLEDOrder {
    SYN_SMARTLED_ORDER_GRB = 0,
    SYN_SMARTLED_ORDER_RGB = 1,
    SYN_SMARTLED_ORDER_RGBW = 2
};


Public Functions Documentation

function syn_smartled_clear

Clear all pixels in strip (turn off all LEDs).

void syn_smartled_clear (
    SYN_SmartLED * led
) 

Parameters:

  • led Smart LED context.

function syn_smartled_fill_rgb

Fill entire strip with a single RGB color.

void syn_smartled_fill_rgb (
    SYN_SmartLED * led,
    uint8_t r,
    uint8_t g,
    uint8_t b
) 

Parameters:

  • led Smart LED context.
  • r Red channel.
  • g Green channel.
  • b Blue channel.

function syn_smartled_init

Initialize a Smart LED Strip context.

SYN_Status syn_smartled_init (
    SYN_SmartLED * led,
    SYN_GPIO_Pin data_pin,
    uint16_t num_leds,
    SYN_SmartLEDColor * pixel_buf,
    SYN_SmartLEDOrder order
) 

Parameters:

  • led Smart LED context.
  • data_pin GPIO data pin.
  • num_leds Total LED count in strip.
  • pixel_buf Array of SYN_SmartLEDColor structs (length = num_leds).
  • order Color channel order (GRB, RGB, RGBW).

Returns:

SYN_OK on success.


function syn_smartled_set_brightness

Set global brightness scale (0 = off, 255 = 100% full brightness).

void syn_smartled_set_brightness (
    SYN_SmartLED * led,
    uint8_t brightness
) 

Parameters:

  • led Smart LED context.
  • brightness Brightness scale (0 to 255).

function syn_smartled_set_pixel_hsv

Set HSV color of a specific LED pixel (0-255 hue, sat, val).

void syn_smartled_set_pixel_hsv (
    SYN_SmartLED * led,
    uint16_t index,
    uint8_t h,
    uint8_t s,
    uint8_t v
) 

Parameters:

  • led Smart LED context.
  • index Pixel index (0 to num_leds-1).
  • h Hue (0 to 255).
  • s Saturation (0 to 255).
  • v Value / Intensity (0 to 255).

function syn_smartled_set_pixel_rgb

Set RGB color of a specific LED pixel.

void syn_smartled_set_pixel_rgb (
    SYN_SmartLED * led,
    uint16_t index,
    uint8_t r,
    uint8_t g,
    uint8_t b
) 

Parameters:

  • led Smart LED context.
  • index Pixel index (0 to num_leds-1).
  • r Red channel (0 to 255).
  • g Green channel (0 to 255).
  • b Blue channel (0 to 255).


The documentation for this class was generated from the following file src/syntropic/output/syn_smartled.h