roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
st7796s.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
7
8namespace roo_display {
9
10namespace st7796s {
11
12static const uint32_t kSpiFrequency = 80 * 1000 * 1000;
13
15
16enum Command {
17 DIC = 0xB4,
18 DFC = 0xB6,
19
20 PWCTR1 = 0xC0,
21 PWCTR2 = 0xC1,
22 PWCTR3 = 0xC2,
23 PWCTR4 = 0xC3,
24 PWCTR5 = 0xC4,
25
26 VMCTR1 = 0xC5,
27
28 GMCTRP1 = 0xE0,
29 GMCTRN1 = 0xE1,
30
31 DOCA = 0xE8,
32 CSCON = 0xF0,
33};
34
35struct Init {
36 template <typename Target>
38 int16_t yend, bool inverted = false) const {
39 using namespace ::roo_display::st77xx;
40 t.writeCommand(SWRESET, {}, 120);
41 t.writeCommand(SLPOUT, {}, 120);
42
43 t.writeCommand(CSCON, {0xC3});
44 t.writeCommand(CSCON, {0x96});
45 t.writeCommand(MADCTL, {0x48});
46 t.writeCommand(COLMOD, {0x55});
47
48 t.writeCommand(DIC, {0x01});
49
50 t.writeCommand(DFC, {0x80, 0x02, 0x3B});
51
52 // t.writeCommand(DOCA, {0x40, 0x8A, 0x00, 0x00, 0x25, 0x0A, 0x38, 0x33});
53 t.writeCommand(DOCA, {0x40, 0x8A, 0x00, 0x00, 0x29, 0x19, 0xA5, 0x33});
54
55 t.writeCommand(PWCTR2, {0x06});
56 t.writeCommand(PWCTR3, {0xA7});
57 t.writeCommand(VMCTR1, {0x18}, 120);
58
59 t.writeCommand(GMCTRP1, {0xF0, 0x09, 0x0B, 0x06, 0x04, 0x15, 0x2F, 0x54,
60 0x42, 0x3C, 0x17, 0x14, 0x18, 0x1B});
61 t.writeCommand(GMCTRN1,
62 {0xE0, 0x09, 0x0B, 0x06, 0x04, 0x03, 0x2B, 0x43, 0x42, 0x3B,
63 0x16, 0x14, 0x17, 0x1B},
64 120);
65
66 t.writeCommand(CSCON, {0x3C});
67 t.writeCommand(CSCON, {0x69});
68
69 t.writeCommand(inverted ? INVON : INVOFF);
70 t.writeCommand(NORON);
71 t.writeCommand(DISPON);
72 }
73};
74
75} // namespace st7796s
76
77template <typename Transport>
78using St7796s =
80 0, 0, 0, false, true, true>>;
81
82template <int pinCS, int pinDC, int pinRST, typename Spi = DefaultSpi,
84 typename Gpio = DefaultGpio>
87
88} // namespace roo_display
static const uint32_t kSpiFrequency
Definition st7796s.h:12
SpiSettings< kSpiFrequency, kSpiMsbFirst, kSpiMode0 > DefaultSpiSettings
Definition st7796s.h:14
Defines 140 opaque HTML named colors.
void init(Target &t, int16_t xstart, int16_t xend, int16_t ystart, int16_t yend, bool inverted=false) const
Definition st7796s.h:37