C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
ST7735 Class Reference

ST7735 driven TFT color display device. More...

#include <st7735.h>

Inheritance diagram for ST7735:
Inheritance graph
Collaboration diagram for ST7735:
Collaboration graph

Public Member Functions

 ST7735 (HW_SPI_Master *spi, struct_ConfigST7735 device_config)
 Construct a new ST7735 object.
 
void set_rotation_and_color (struct_ConfigST7735 device_config)
 set the actual position of the display
 
void set_display_ON ()
 Set the display ON object.
 
void set_display_OFF ()
 Set the display OFF object.
 
void enable_sleep (bool enable)
 turn the display in sleep mode on/off
 
void check_display_device_compatibility (struct_ConfigGraphicWidget framebuffer_cfg, CanvasFormat canvas_format)
 A pure virtual member function. Each device must implement this method and check the compatibility of the widget parameter with the its physical limitations.
 
virtual 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 buffer
 
virtual 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 starting at the (anchor_x, anchor_y) coordinates of the screen , expressed in pixel. This method takes into account the specific addressing scheme and memory structure of the actual display device.
 
- Public Member Functions inherited from GraphicDisplayDevice
 GraphicDisplayDevice (size_t screen_width, size_t screen_height)
 Construct a new Display Device object.
 
virtual ~GraphicDisplayDevice ()
 Destroy the Display Device object.
 

Protected Member Functions

void enable_command_pin (bool enable)
 enable or disable the command mode (DC pin low or high)
 
void hardware_reset ()
 hardware reset of the ST7735 device
 
void init_pins ()
 initialize pins for the ST7735 device
 
void device_wakeup ()
 wake up the device from sleep mode
 
void config_frame_rate_control ()
 config framerate control
 
void config_inversion_control ()
 config display inversion control
 
void config_power_control ()
 config power control
 
void config_gamma ()
 column row address set CASET , [0x00,0x01,0x00, width-1] RASET , [0x00,0x01,0x00, height-1] we start column 1
 
void set_normal_mode ()
 _set display normal ON NORON , sleep 10ms
 
void config_device_specific_size_and_offsets (struct_ConfigST7735 device_config)
 config specific device size and offsets
 
void send_cmd (uint8_t cmd)
 send a command to the ST7735 device
 
void send_cmd_list (uint8_t *cmd, size_t len)
 send a list of command to the ST7735 device
 
void send_buffer (uint8_t *buffer, size_t buffer_len)
 send a buffer of data to the ST7735 device
 
void set_backlight (bool on)
 set the backlight of the display
 
void soft_reset ()
 perform a software reset of the display
 
void set_RAM_write_addresses (uint8_t start_x, uint8_t start_y, size_t width, size_t height)
 set the RAM write addresses for the display
 

Protected Attributes

HW_SPI_Masterspi
 SPI driver associated with the display.
 
uint dc_pin
 the GPIO connected to the Data/Command_ input
 
uint backlight_pin
 the GPIO connected to the backlight input
 
uint hw_reset_pin
 the GPIO connected to the hardware reset input
 
uint8_t ST7735_device_column_offset {0}
 the column offset for the ST7735 device
 
uint8_t ST7735_device_row_offset {0}
 the row offset for the ST7735 device
 
uint8_t TFT_panel_start_x {0}
 the x starting position of the TFT panel within the ST7735 memory
 
uint8_t TFT_panel_start_y {0}
 the y starting position of the TFT panel within the ST7735 memory
 
bool rgb_order
 a flag that indicates if the color order is RGB (true) or BGR (false)
 

Additional Inherited Members

- Public Attributes inherited from GraphicDisplayDevice
size_t TFT_panel_width_in_pixel
 the physical width of the screen (in pixel)
 
size_t TFT_panel_height_in_pixel
 the physical height of the screen (in pixel)
 

Detailed Description

ST7735 driven TFT color display device.

Constructor & Destructor Documentation

◆ ST7735()

ST7735::ST7735 ( HW_SPI_Master * spi,
struct_ConfigST7735 device_config )

Construct a new ST7735 object.

Parameters
spithe SPI associated driver
device_configthe device configuration file
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ check_display_device_compatibility()

void ST7735::check_display_device_compatibility ( struct_ConfigGraphicWidget framebuffer_cfg,
CanvasFormat canvas_format )
virtual

A pure virtual member function. Each device must implement this method and check the compatibility of the widget parameter with the its physical limitations.

Parameters
framebuffer_cfgthe widget configuration data
canvas_formatthe format of the canvas

Implements GraphicDisplayDevice.

◆ clear_device_screen_buffer()

void ST7735::clear_device_screen_buffer ( ColorIndex color_index = ColorIndex::BLACK)
virtual

fill the internal ST7735 screen buffer with the given color. Default to BLACK, clear the internal buffer

Parameters
color_index

Reimplemented in rtos_ST7735.

Here is the call graph for this function:

◆ config_device_specific_size_and_offsets()

void ST7735::config_device_specific_size_and_offsets ( struct_ConfigST7735 device_config)
protected

config specific device size and offsets

Parameters
device_configthe device configuration file
Here is the caller graph for this function:

◆ config_frame_rate_control()

void ST7735::config_frame_rate_control ( )
protected

config framerate control

Frame rate control -Set the frame frequency of the full colors normal mode.

  • Frame rate=fosc/((param[1] x 2 + 40) x (LINE + param[2] + param[3] +2)) -fosc = 850kHz -FPA > 0, BPA > 0 FRMCTR1 , [0x01, 0x2C, 0x2D] normal mode fastest refresh, 6 lines front, 3 lines back FRMCTR2 , [0x01, 0x2C, 0x2D] idle mode fastest refresh, 6 lines front, 3 lines back FRMCTR3 , [0x01, 0x2c, 0x2d, 0x01, 0x2c, 0x2d], partial mode sleep 10us
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_gamma()

void ST7735::config_gamma ( )
protected

column row address set CASET , [0x00,0x01,0x00, width-1] RASET , [0x00,0x01,0x00, height-1] we start column 1

ST77XX_CASET, 4, // 1: Column addr set, 4 args, no delay: 0x00, 0x02, // XSTART = 0 0x00, 0x7F+0x02, // XEND = 127 ST77XX_RASET, 4, // 2: Row addr set, 4 args, no delay: 0x00, 0x01, // XSTART = 0 0x00, 0x9F+0x01 }, // XEND = 159

gamma correction GMCTRP1 , [0x02, 0x1c, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2d, 0x29, 0x25, 0x2b, 0x39, 0x00, 0x01, 0x03, 0x10] GMCTRN1 , [0x03, 0x1d, 0x07, 0x06, 0x2e, 0x2c, 0x29, 0x2d, 0x2e, 0x2e, 0x37, 0x3f, 0x00, 0x00, 0x02, 0x10]

Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_inversion_control()

void ST7735::config_inversion_control ( )
protected

config display inversion control

display inversion control INVCTR , [0x07] column inversion and no dot inversion for Normal, Idle and partial mode

Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_power_control()

void ST7735::config_power_control ( )
protected

config power control

power control PWCTR1 , [0xA2,0x02,0x84] PWCTR2 , [0xC5] VGH = 14.7V, VGL = -7.35V PWCTR3 , [0x0A, 0x00] opamp current small, boost frequency PWCTR4 , [0x8A, 0x2A] opamp current small, boost frequency PWCTR5 , [0x8A, 0xEE] opamp current small, boost frequency VMCTR1 , [0x0E]

Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_wakeup()

void ST7735::device_wakeup ( )
protected

wake up the device from sleep mode

_ wake up_ harware_reset SW_reset, sleep 150us SLPOUT, sleep 150us

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enable_command_pin()

void ST7735::enable_command_pin ( bool enable)
protected

enable or disable the command mode (DC pin low or high)

Parameters
enabletrue for command mode, false for data mode
Here is the caller graph for this function:

◆ enable_sleep()

void ST7735::enable_sleep ( bool enable)

turn the display in sleep mode on/off

Parameters
enable
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_buffer()

void ST7735::send_buffer ( uint8_t * buffer,
size_t buffer_len )
protected

send a buffer of data to the ST7735 device

Parameters
buffera pointer to the buffer
buffer_lenthe length of the buffer
Here is the call graph for this function:

◆ send_cmd()

void ST7735::send_cmd ( uint8_t cmd)
protected

send a command to the ST7735 device

init for "green tab" version of display ... I don't know why

Parameters
cmdthe command to be sent
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_cmd_list()

void ST7735::send_cmd_list ( uint8_t * cmd,
size_t len )
protected

send a list of command to the ST7735 device

Parameters
cmda pointer to the list of command
lenthe length of the command list
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_backlight()

void ST7735::set_backlight ( bool on)
protected

set the backlight of the display

Parameters
on
Here is the caller graph for this function:

◆ set_RAM_write_addresses()

void ST7735::set_RAM_write_addresses ( uint8_t start_x,
uint8_t start_y,
size_t width,
size_t height )
protected

set the RAM write addresses for the display

Parameters
start_xthe starting x coordinate
start_ythe starting y coordinate
widththe width of the area to write
heightthe height of the area to write
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_rotation_and_color()

void ST7735::set_rotation_and_color ( struct_ConfigST7735 device_config)

set the actual position of the display

set rotation and color

Parameters
device_configthe device configuration file
Here is the call graph for this function:
Here is the caller graph for this function:

◆ show()

void ST7735::show ( Canvas * canvas,
const uint8_t anchor_x,
const uint8_t anchor_y )
virtual

A pure virtual member function. It transfers the pixel buffer to the a part of display screen buffer starting at the (anchor_x, anchor_y) coordinates of the screen , expressed in pixel. This method takes into account the specific addressing scheme and memory structure of the actual display device.

Parameters
canvasa pointer to the canvas that contains the buffer to be displayed
anchor_xthe x(horizontal) starting position of the frame within the display screen,(in pixel)
anchor_ythe y(vertical) starting position of the frame within the display screen,(in pixel)

Implements GraphicDisplayDevice.

Reimplemented in rtos_ST7735.

Here is the call graph for this function:

The documentation for this class was generated from the following files: