aboutsummaryrefslogtreecommitdiff
path: root/include/drv/ws2812B/ws2812b.h
blob: bc86cc597036db20802fe7318f80a593098297a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef WS2812B_H_
#define WS2812B_H_

#include "kern/common.h"

typedef struct {
  /* why is it out of order? Don't know! That's the way the hardware was
   * designed! */
  uint8_t g;
  uint8_t r;
  uint8_t b;
} PACKED rgb_t;

static_assert(sizeof(rgb_t) == 3, "Sizeof rgb_t should be 3.");

uint8_t* ws2812b_compile_rgb(rgb_t* out, size_t arr_len);

/* Returns sin((n - 128) / 256) * 256. */
uint8_t byte_sin(uint8_t n);

#endif /* WS2812B_H_ */