ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputGECEFrame.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* OutputGECEFrame.h - GECE driver code for ESPixelStick
4*
5* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6* Copyright (c) 2015, 2022 Shelby Merrick
7* http://www.forkineye.com
8*
9* This program is provided free for you to use in any way that you wish,
10* subject to the laws and regulations where you are using it. Due diligence
11* is strongly suggested before using this code. Please give credit where due.
12*
13* The Author makes no warranty of any kind, express or implied, with regard
14* to this program or the documentation contained in this document. The
15* Author shall not be liable in any event for incidental or consequential
16* damages in connection with, or arising out of, the furnishing, performance
17* or use of these programs.
18*
19*/
20
21/*
22 frame layout: 0x0AAIIBGR (26 bits)
23
24 output looks like this:
25 Start bit = High for 8us
26 26 data bits.
27 Each data bit is 29/31us
28 0 = 6 us low, 25 us high
29 1 = 23 us low, 6 us high
30 stop bit = low for at least 45us
31*/
32
33#define GECE_ADDRESS_MASK 0x03F00000
34#define GECE_ADDRESS_SHIFT 20
35
36#define GECE_INTENSITY_MASK 0x000FF000
37#define GECE_INTENSITY_SHIFT 12
38
39#define GECE_BLUE_MASK 0x00000F00
40#define GECE_BLUE_SHIFT 8
41
42#define GECE_GREEN_MASK 0x000000F0
43#define GECE_GREEN_SHIFT 0
44
45#define GECE_RED_MASK 0x0000000F
46#define GECE_RED_SHIFT 4
47
48#define GECE_SET_ADDRESS(value) ((uint32_t(value) << GECE_ADDRESS_SHIFT) & GECE_ADDRESS_MASK)
49#define GECE_SET_BRIGHTNESS(value) ((uint32_t(value) << GECE_INTENSITY_SHIFT) & GECE_INTENSITY_MASK)
50#define GECE_SET_BLUE(value) ((uint32_t(value) << GECE_BLUE_SHIFT) & GECE_BLUE_MASK)
51#define GECE_SET_GREEN(value) ((uint32_t(value)) & GECE_GREEN_MASK)
52#define GECE_SET_RED(value) ((uint32_t(value) >> GECE_RED_SHIFT) & GECE_RED_MASK)