pololu / pololu-3pi-2040-robot

Example code for the Pololu 3pi+ 2040 Robot
MIT License
12 stars 5 forks source link

rgb_leds_write() doesn't allow setting the brightness on individual LEDs. #4

Open adamgreen opened 1 year ago

adamgreen commented 1 year ago

Maybe the rgb_color structure could be renamed to something like rgbi_color where it could contain an intensity/brightness value for each LED or have the rgb_leds_write() take an array of uint8_t values for brightnesses instead of a single value.

typedef struct rgb_color {
  /// The value of the red component, from 0 to 255.
  uint8_t red;
  /// The value of the green component, from 0 to 255.
  uint8_t green;
  /// The value of the blue component, from 0 to 255.
  uint8_t blue;
  /// The value of the brightness component, from 0 to 31.
} rgbi_color;

void rgb_leds_write(rgbi_color * colors, uint32_t count);

-OR-

void rgb_leds_write(rgb_color * colors, uint8_t * brightness, uint32_t count);