← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/include/rgb_led.h
blob: 66eaddcfaea8adcfaeb8cf803b56a71ac5990714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
typedef struct {
  bool R;
  bool G;
  bool B;
} rgb_color;

#define rgb_white (rgb_color){ .R = 0, .G = 0, .B = 0 }
#define rgb_yellow (rgb_color){ .R = 0, .G = 0, .B = 1 }
#define rgb_purple (rgb_color){ .R = 0, .G = 1, .B = 0 }
#define rgb_red (rgb_color){ .R = 0, .G = 1, .B = 1 }
#define rgb_cyan (rgb_color){ .R = 1, .G = 0, .B = 0 }
#define rgb_green (rgb_color){ .R = 1, .G = 0, .B = 1 }
#define rgb_blue (rgb_color){ .R = 1, .G = 1, .B = 0 }
#define rgb_black (rgb_color){ .R = 1, .G = 1, .B = 1 }

typedef struct {
  rgb_color color;
  int R_pin;
  int G_pin;
  int B_pin;
} rgb_led;

void rgb_init_LED(rgb_led *LED, int R_pin, int G_pin, int B_pin);

void rgb_set_color(rgb_led *LED, rgb_color color);