Skip to content

Platform independent library for the neat ST7735S 80x160 IPS 0.96"

License

Notifications You must be signed in to change notification settings

cvetaevvitaliy/st7735s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Platform independent library for the ST7735S IPS display

*see st7735s_settings.h list of supported displays
-0.96" IPS mini 160x80
-1.44" display 128x128
-WaveShare ST7735S-based 1.8" display 160x128
-AliExpress/eBay 1.8" display 160x128

Library has support:

  • rotation display, 0, 90, 180, 270
  • Picture scroll
  • Scroll area

How to generate new fonts and pictures


To generate fonts, you can use a cross-platform(Win, Linux) program LCD-Image-Converter
MacOS patched version LCD-Image-Converter MacOS

Web pages

How to use library


Add include

#include "st7735s.h"

First step, need init struct LCD_ST7735_ctx_t and register callback SPI write function and GPIO

LCD_ST7735_ctx_t LCD_ST7735 = {
        .spi_write_data         = SPI_Transmit,                 // register callback for write data to SPI
        .gpio_write_pin         = GPIO_Write,                   // register callback for write GPIO pin
        .reset.gpio_port        = (uint32_t) SPI_RST_GPIO_PORT, // reset pin GPIO port
        .reset.gpio_pin         = SPI_RST_PIN,                  // reset pin GPIO
        .data.gpio_port         = (uint32_t) SPI_DC_GPIO_PORT,  // data pin GPIO port
        .data.gpio_pin          = SPI_DC_PIN,                   // data pin GPIO
        .cs.gpio_port           = (uint32_t) SPI1_CS_GPIO_PORT, // chip select pin GPIO port
        .cs.gpio_pin            = SPI1_CS_PIN,                  // chip select pin GPIO
        .backlight.gpio_port    = (uint32_t) LCD_BLK_GPIO_PORT, // backlight pin GPIO port
        .backlight.gpio_pin     = LCD_BLK_PIN,                  // backlight pin GPIO

};

example function for write data to SPI and GPIO (STM32 HAL library)
You can use any microcontrollers or even Linux user-space, it's all up to you

uint8_t SPI_Transmit(uint8_t *pData, uint16_t Size)
{
    if (HAL_SPI_Transmit(&hspi1, pData, Size,0) == HAL_OK)
        return true;
    else
        return false;
}


void GPIO_Write(uint32_t port, uint32_t pin, uint8_t state)
{
    HAL_GPIO_WritePin( (GPIO_TypeDef*)port, pin, state);
}

Call LCD_ST7735S_Init() finction and init display

LCD_ST7735S_Init(&LCD_ST7735);
LCD_ST7735_DrawString("Hello world", 0, 0, &Font_8x10, ST7735_WHITE);
LCD_ST7735S_Update();

Important note Since a buffer is used to send data to the display, you need to call the function whenever you want to update information on the display.

LCD_ST7735S_Update();

About

Platform independent library for the neat ST7735S 80x160 IPS 0.96"

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages