2929#include < cstdint>
3030
3131#include " spi/paint.h"
32- #include " spi/spilcd.h"
33- #include " hal_gpio.h"
34- #include " firmware/debug/debug_debug.h"
35-
36- namespace st77xx
37- {
38- namespace cmd
39- {
32+ #include " gpio.h"
33+ #include " firmware/debug/debug_debug.h"
34+
35+ namespace st77xx {
36+ namespace cmd {
4037inline constexpr uint8_t kNop = 0x00 ;
4138inline constexpr uint8_t kSwreset = 0x01 ; // /< Software Reset
4239inline constexpr uint8_t kRddid = 0x04 ; // /< Read Display ID
4340inline constexpr uint8_t kRddst = 0x09 ; // /< Read Display Status
44- inline constexpr uint8_t kSlpin = 0x10 ; // /< Sleep In
45- inline constexpr uint8_t kSlpout = 0x11 ; // /< Sleep Out
46- inline constexpr uint8_t kPtlon = 0x12 ; // /< Partial Display Mode On
47- inline constexpr uint8_t kNoron = 0x13 ; // /< Normal Display Mode On
48- inline constexpr uint8_t kInvoff = 0x20 ; // /< Display Inversion Off
49- inline constexpr uint8_t kInvon = 0x21 ; // /< Display Inversion On
50- inline constexpr uint8_t kGamset = 0x26 ; // /< Gamma Set
51- inline constexpr uint8_t kDispoff = 0x28 ; // /< Display Offs
52- inline constexpr uint8_t kDispon = 0x29 ; // /< Display On
41+ inline constexpr uint8_t kSlpin = 0x10 ; // /< Sleep In
42+ inline constexpr uint8_t kSlpout = 0x11 ; // /< Sleep Out
43+ inline constexpr uint8_t kPtlon = 0x12 ; // /< Partial Display Mode On
44+ inline constexpr uint8_t kNoron = 0x13 ; // /< Normal Display Mode On
45+ inline constexpr uint8_t kInvoff = 0x20 ; // /< Display Inversion Off
46+ inline constexpr uint8_t kInvon = 0x21 ; // /< Display Inversion On
47+ inline constexpr uint8_t kGamset = 0x26 ; // /< Gamma Set
48+ inline constexpr uint8_t kDispoff = 0x28 ; // /< Display Offs
49+ inline constexpr uint8_t kDispon = 0x29 ; // /< Display On
5350inline constexpr uint8_t kCaSet = 0x2A ; // /< Column Address Set
54- inline constexpr uint8_t kRaset = 0x2B ; // /< Row Address Set
55- inline constexpr uint8_t kRamwr = 0x2C ; // /< Memory Write
56- inline constexpr uint8_t kRamrd = 0x2E ; // /< Memory Read
57- inline constexpr uint8_t kPtlar = 0x30 ; // /< Partial Area
51+ inline constexpr uint8_t kRaset = 0x2B ; // /< Row Address Set
52+ inline constexpr uint8_t kRamwr = 0x2C ; // /< Memory Write
53+ inline constexpr uint8_t kRamrd = 0x2E ; // /< Memory Read
54+ inline constexpr uint8_t kPtlar = 0x30 ; // /< Partial Area
5855inline constexpr uint8_t kTeoff = 0x34 ; // /< Tearing Effect Line OFF
5956inline constexpr uint8_t kTeon = 0x35 ; // /< Tearing Effect Line ON .
6057inline constexpr uint8_t kMadctl = 0x36 ; // /< Memory Data Access Control.
6158inline constexpr uint8_t kIdmoff = 0x38 ; // /< Idle Mode Off .
6259inline constexpr uint8_t kColmod = 0x3A ; // /< Interface Pixel Format
6360} // namespace cmd
64- namespace data
65- {
61+ namespace data {
6662/* *
6763 * Memory Data Access Control Register (0x36H)
6864 * MAP: D7 D6 D5 D4 D3 D2 D1 D0
@@ -82,8 +78,7 @@ inline constexpr uint8_t kMadctlRgb = 0x00;
8278inline constexpr uint8_t kMadctlBgr = 0x08 ;
8379} // namespace data
8480
85- namespace colour
86- {
81+ namespace colour {
8782inline constexpr uint16_t kBlack = 0x0000 ;
8883inline constexpr uint16_t kBlue = 0x001F ;
8984inline constexpr uint16_t kCyan = 0x07FF ;
@@ -99,11 +94,9 @@ inline constexpr uint16_t kYellow = 0xFFE0;
9994
10095} // namespace st77xx
10196
102- class ST77XX : public Paint
103- {
97+ class ST77XX : public Paint {
10498 public:
105- explicit ST77XX (uint32_t cs) : Paint(cs)
106- {
99+ explicit ST77XX (uint32_t cs) : Paint(cs) {
107100 DEBUG_ENTRY ();
108101 DEBUG_EXIT ();
109102 }
@@ -114,10 +107,9 @@ class ST77XX : public Paint
114107
115108 void EnableSleep (bool enable) { WriteCommand (enable ? st77xx::cmd::kSlpin : st77xx::cmd::kSlpout ); }
116109
117- void SetBackLight (uint32_t value) { FUNC_PREFIX ( GpioWrite ( SPI_LCD_BL_GPIO , value == 0 ? 0 : 1 ) ); }
110+ void SetBackLight (uint32_t value) { gpio::Write ( SPI_LCD_BL_GPIO , value == 0 ? 0 : 1 ); }
118111
119- void SetAddressWindow (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1) override
120- {
112+ void SetAddressWindow (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1) override {
121113 const auto kStartX = x0 + shift_x_;
122114 const auto kEndX = x1 + shift_x_;
123115 const auto kStartY = y0 + shift_y_;
@@ -143,4 +135,4 @@ class ST77XX : public Paint
143135 uint32_t shift_y_{0 };
144136};
145137
146- #endif // SPI_ST77XX_H_
138+ #endif // SPI_ST77XX_H_
0 commit comments