PICSimLab - Programmable IC Simulator Laboratory 0.9.2
PICSimLab - API
Loading...
Searching...
No Matches
led_ws2812b.h
1/* ########################################################################
2
3 PICSimLab - Programmable IC Simulator Laboratory
4
5 ########################################################################
6
7 Copyright (c) : 2022-2024 Luis Claudio GambĂ´a Lopes <lcgamboa@yahoo.com>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 For e-mail suggestions : lcgamboa@yahoo.com
24 ######################################################################## */
25
26#ifndef LED_WS2812B
27#define LED_WS2812B
28
29#include "../lib/draw.h"
30
31/* pinout
32 1 VDD
33 2 DOUT
34 3 VSS
35 4 DIN
36*/
37
38#define MAXROWS 64
39#define MAXCOLS 64
40
41typedef struct {
42 union {
43 unsigned int fcolor;
44 struct {
45 unsigned char B;
46 unsigned char R;
47 unsigned char G;
48 unsigned char PAD;
49 };
50 };
51} rgb_color;
52
53typedef struct {
54 int T0H;
55 int TRES;
56 int ccounter; // cycle counter
57 unsigned int bit; // bit counter
58 unsigned int nrows;
59 unsigned int ncols;
60 unsigned int nleds;
61 unsigned int nbits;
62 unsigned int ledc; // led counter
63 unsigned char diffuser;
64 rgb_color* color; // RGB array
65 unsigned short adin;
66 unsigned int dat;
67 unsigned char update;
69
70void led_ws2812b_rst(led_ws2812b_t* led);
71void led_ws2812b_init(led_ws2812b_t* led, const int rows, const int cols, const int diffuser);
72void led_ws2812b_end(led_ws2812b_t* led);
73void led_ws2812b_prepare(led_ws2812b_t* led, const float freq);
74
75unsigned char led_ws2812b_io(led_ws2812b_t* led, const unsigned char din);
76
77void led_ws2812b_draw(led_ws2812b_t* led, CanvasCmd_ft CanvasCmd, const int x1, const int y1, const int w1,
78 const int h1, const int picpwr);
79
80#endif // LED_WS2812B
Definition led_ws2812b.h:53
Definition led_ws2812b.h:41