Skip to content

OlegUA/ST7735

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ST7735

ST7735 driver and library for STM32F3DISCOVEY board

The idea has been taken from Arduino Adafruit and UTFT sources. The arduino code has been ported for STM32F3 controller.

Demo video

Initialization

Initialization for ST7735B LCD (B&W)
void lcd7735_initB(void);

Initialization for ST7735R LCD (green or red tabs)
void lcd7735_initR(uint8_t options);

Graphics function

Fill screen by selected color.
 void lcd7735_fillScreen(uint16_t color);
Draw colored rectangular on screen. The x1,y1 is top left corner and x2,y2 bottom right corner on screen.
void lcd7735_drawRect(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2,uint16_t color);
Fill rectangular on screen by specified color. The x1,y1 is top left corner and x2,y2 bottom right corner on screen.
void lcd7735_fillRect(int16_t x, int16_t y, int16_t width, int16_t height, uint16_t color);
Draw colored pixel on screen.
void lcd7735_drawPixel(int16_t x, int16_t y, uint16_t color);
Draw horizontal line with specified parameters.
void lcd7735_drawFastHLine(int16_t x, int16_t y, int16_t width, uint16_t color);
Draw vertical line with specified parameters.
void lcd7735_drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
Draw line with specified parameters.
void lcd7735_drawFastLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint16_t color);
Draw colored circle on screen.
void lcd7735_drawCircle(int16_t x, int16_t y, int radius, uint16_t color);
Fill circle on screen by specified color.
void lcd7735_fillCircle(int16_t x, int16_t y, int radius, uint16_t color);
Render bitmap on screen. The x1,y1 is top left corner. The “scale” – integer values for multiply bitmap size.
void lcd7735_drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale);
The same but rotated.
void lcd7735_drawBitmapRotate(int x, int y, int sx, int sy, bitmapdatatype data, int deg, int rox, int roy);

Service functions

Get sizes of LCD matrix in pixels
uint8_t lcd7735_getWidth(void);
uint8_t lcd7735_getHeight(void);
Invert screen, parameters: INVERT_ON/ INVERT_OFF
void lcd7735_invertDisplay(const uint8_t mode);
Pass 8-bit (each) R,G,B, get back 16-bit packed color
uint16_t lcd7735_Color565(uint8_t r, uint8_t g, uint8_t b);
Rotate screen clockwise. Possible values:
Parameter, Degree
PORTRAIT, 0
LANDSAPE, 90
PORTRAIT_FLIP, 180
LANDSAPE_FLIP, 270
void lcd7735_setRotation(uint8_t m);

Arduino UTFT ported character render functions

Set current font for lcd7735_print()
void lcd7735_setFont(uint8_t* font);
Set transparency for lcd7735_print(), if “set” == 1
void lcd7735_setTransparent(uint8_t  set);
Set current foreground color for lcd7735_print()
void lcd7735_setForeground(uint16_t  fg_color);
Set current background color for lcd7735_print()
void lcd7735_setBackground(uint16_t  bg_colol);
Print text on screen starting from x,y position with appropriate degree
 void lcd7735_print(char *st, int x, int y, int deg);

Emulation of TTY ASCII green-screen terminal

Initialize LCD for emulation
void lcd7735_init_screen(void *font,uint16_t fg, uint16_t bg, uint8_t orientation);
Put single char of text line on terminal. The only ‘\n’ is emulated (as CRLF).
void lcd7735_puts(char *str);
void lcd7735_putc(char c);

Notes

- The standard printf functionality is redirected if will use Redirect.c
- Two preprocessor defines are used to reducing code size in this mode:
   ONLY_TERMINAL_EMULATOR - excludes all graphics functions
   ONLY_SMALL_FONT - excludes Big and SevenSeg fonts

Please see hw_config.h for hardware settings. You have to carefuly setup INVEC table due to ST7735 is used SysTick for programing delays.

Standard libraries like CMSIS, Peripheral, etc are not included


About

ST7735 driver and library for STM32F3DISCOVEY board

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published