C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
st7735.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "pico/stdlib.h"
14#include "commands_ST7735.h"
15#include "hw/spi/hw_spi.h"
17
19#define DCX_COMMAND 0
21#define DCX_DATA 1
23#define ST7735_144_128x128_column_offset 2
25#define ST7735_144_128x128_row_offset_0_90 1
27#define ST7735_144_128x128_row_offset_180_270 3
29#define ST7735_177_160x128_column_offset 0//2
31#define ST7735_177_160x128_row_offset 0//1
32
41
44{
45
54};
55
74
81{
82private:
83 HW_SPI_Master *spi;
84 uint dc_pin;
85 uint backlight_pin;
86 uint hw_reset_pin;
87 uint8_t ST7735_device_column_offset{0};
88 uint8_t ST7735_device_row_offset{0};
89 uint8_t TFT_panel_start_x{0};
90 uint8_t TFT_panel_start_y{0};
91 bool rgb_order;
92
93 void enable_command_pin(bool enable);
94 void hardware_reset();
95 void init_pins();
96 void device_wakeup();
97 void config_frame_rate_control();
98 void config_inversion_control();
99 void config_power_control();
100 // void init_column_row_address(struct_ConfigST7735 device_config);
101 void config_gamma();
102 void set_normal_mode();
103 // void init_green_tab();
104 void config_device_specific_size_and_offsets(struct_ConfigST7735 device_config);
105 void send_cmd(uint8_t cmd);
106 void send_cmd_list(uint8_t *cmd, size_t len);
107 void send_buffer(uint8_t *buffer, size_t buffer_len);
108 void set_backlight(bool on);
109 void soft_reset();
110
111 void set_RAM_write_addresses(uint8_t start_x, uint8_t start_y, size_t width, size_t height);
112
113 public:
114
118 ST7735(HW_SPI_Master *spi, struct_ConfigST7735 device_config);
119 ~ST7735();
120
124
126 void set_display_ON();
127
129 void set_display_OFF();
130
133 void enable_sleep(bool enable);
135
139 void clear_device_screen_buffer(ColorIndex color_index = ColorIndex::BLACK);
140 void show(Canvas *canvas, const uint8_t anchor_x, const uint8_t anchor_y);
141};
ColorIndex
define the code value for color
Definition canvas.h:26
The canvas is a virtual memory in which the widget draws.
Definition canvas.h:121
GraphicDisplayDevice(size_t screen_width, size_t screen_height)
Construct a new Display Device object.
Definition display_device.cpp:4
this is a C++ wrapper for the original pico SDK spi master API
Definition hw_spi.h:48
void set_display_OFF()
Set the display OFF object.
Definition st7735.cpp:429
void check_display_device_compatibility(struct_ConfigGraphicWidget framebuffer_cfg)
A pure virtual member function. Each device must implement this method and check the compatibility of...
Definition st7735.cpp:467
void clear_device_screen_buffer(ColorIndex color_index=ColorIndex::BLACK)
fill the internal ST7735 screen buffer with the given color. Default to BLACK, clear the internal buf...
Definition st7735.cpp:474
void show(Canvas *canvas, const uint8_t anchor_x, const uint8_t anchor_y)
A pure virtual member function. It transfers the pixel buffer to the a part of display screen buffer ...
Definition st7735.cpp:497
void set_rotation_and_color(struct_ConfigST7735 device_config)
set the actual position of the display
Definition st7735.cpp:139
void set_display_ON()
Set the display ON object.
Definition st7735.cpp:423
void enable_sleep(bool enable)
turn the display in sleep mode on/off
Definition st7735.cpp:435
ST7735(HW_SPI_Master *spi, struct_ConfigST7735 device_config)
Construct a new ST7735 object.
Definition st7735.cpp:348
These commands are those for either the ST7735 TFT 1.44" 128x128 pixels or the ST7735 TFT 1....
ST7735Rotation
code indicates rotation of the display (Portrait, paysage, upside-down)
Definition st7735.h:44
@ _180
rotate 180° clockwise
Definition st7735.h:51
@ _90
rotate 90° clockwise
Definition st7735.h:49
@ _0
no rotation applied
Definition st7735.h:47
@ _270
rotate 270° clockwise
Definition st7735.h:53
ST7735DisplayType
tag used to ru the correct init code
Definition st7735.h:35
@ ST7735_177_160_RGB_128_GREENTAB
LCD TFT 1"77 160(RGB)x128 green_tab configuration.
Definition st7735.h:39
@ ST7735_144_128_RGB_128_GREENTAB
LCD TFT 1"44 128(RGB)x128 green_tab configuration.
Definition st7735.h:37
data structure used to configure graphic framebuffer
Definition canvas.h:73
data used to configure the display device
Definition st7735.h:58
ST7735Rotation rotation
indicates which rotation will be applied
Definition st7735.h:69
uint dc_pin
indicates the GPIO connected to the Data/Command_ input
Definition st7735.h:67
uint hw_reset_pin
indicates the GPIO connected to the hardware reset input
Definition st7735.h:65
ST7735DisplayType display_type
indicates which type of TFT panel must be configured
Definition st7735.h:61
uint backlight_pin
indicates the GPIO connected to the backlight input
Definition st7735.h:63
Definition st7735.h:72