Graphic Display v1.0.0
Control any mochrome display, with any microcontroller, in any amount.
Loading...
Searching...
No Matches
GraphicDisplay.c File Reference
#include "GraphicDisplay.h"

Macros

#define _SET_PIXEL_COLOR_TYPECAST   (uint8_t (*)(void *, uint32_t, uint32_t, uint8_t))
 
#define _FILL_FRAME_BUFFER_TYPEFCAST   (uint8_t (*)(void *, uint8_t))
 
#define _REFRESH_DISP_TYPECAST   (uint8_t (*)(void *))
 
#define _SET_ON_TYPECASTAT   (uint8_t (*)(void *, _Bool))
 
#define _SET_CONTRAST_TYPECAST   (uint8_t (*)(void *, uint8_t))
 

Functions

static void _drv_fill_frame_buffer (gd_t *Gd, gd_color_e color)
 
static void _drv_set_pixel (gd_t *Gd, uint32_t x, uint32_t y, gd_color_e color)
 
static void _drv_set_refresh (gd_t *Gd)
 
static void _drv_set_constrat (gd_t *Gd, uint8_t value)
 
static void _drv_set_on (gd_t *Gd, bool On)
 
static void _mtx_lock (gd_t *Gd)
 
static void _mtx_unlock (gd_t *Gd)
 
static float _DegToRad (float par_deg)
 
static uint16_t _NormalizeTo0_360 (uint16_t par_deg)
 
gd_error_e GD_Init (gd_t *Gd, gd_params_t *params)
 Initializes the Graphic Display module, configured with the parameters provided.
 
gd_error_e GD_Fill (gd_t *Gd, gd_color_e color)
 Fill the Frame Buffer with the provided color.
 
gd_error_e GD_UpdateScreen (gd_t *Gd)
 Update and refresh the update screen with the data into Frame Buffer.
 
gd_error_e GD_DrawPixel (gd_t *Gd, uint32_t x, uint32_t y, gd_color_e color)
 Write a color into the desired pixel in the frame buffer.
 
gd_error_e GD_WriteChar (gd_t *Gd, char ch, const gd_font_t *Font, gd_color_e color)
 Write a character into a Frame Buffer, with the lines with the desired color.
 
gd_error_e GD_WriteString (gd_t *Gd, char *str, const gd_font_t *Font, gd_color_e color)
 Write a string into frame buffer, with the character lines with the desired color.
 
gd_error_e GD_SetCursor (gd_t *Gd, uint32_t x, uint32_t y)
 Set the cursor to the position X,Y.
 
gd_error_e GD_Line (gd_t *Gd, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, gd_color_e color)
 Write a line into the frame buffer between (x1,y1) (x2,y2).
 
gd_error_e GD_Polyline (gd_t *Gd, gd_vertex_t *par_vertex, uint16_t par_size, gd_color_e color)
 Draw a polyline, composed by staigth lines connecting the points given by vertex array.
 
gd_error_e GD_DrawArc (gd_t *Gd, uint32_t x, uint32_t y, uint32_t radius, uint16_t start_angle, uint16_t sweep, gd_color_e color)
 Draw an arc into the frame buffer with center, radius, start angle, and sweep.
 
gd_error_e GD_DrawArcWithRadiusLine (gd_t *Gd, uint32_t x, uint32_t y, uint32_t radius, uint16_t start_angle, uint16_t sweep, gd_color_e color)
 Draw an arc into frame buffer with lines in the radius line.
 
gd_error_e GD_DrawCircle (gd_t *Gd, uint32_t par_x, uint32_t par_y, uint32_t par_r, gd_color_e par_color)
 Draw a complete circle with defined radius.
 
gd_error_e GD_FillCircle (gd_t *Gd, uint32_t par_x, uint32_t par_y, uint32_t par_r, gd_color_e par_color)
 Draw a circle filled with the provided color.
 
gd_error_e GD_DrawRectangle (gd_t *Gd, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, gd_color_e color)
 Draw a Rectangle between the position (x1,y1) and (x2,y2). The rectangle is not filled, just four lines of a thickness of 1px.
 
gd_error_e GD_FillRectangle (gd_t *Gd, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, gd_error_e color)
 Draw a filled rectangle between the pointes (x1,y1) and (x2,y2).
 
gd_error_e GD_DrawBitmap (gd_t *Gd, uint32_t x, uint32_t y, const unsigned char *bitmap, uint32_t w, uint32_t h, gd_color_e color)
 Draw a bitmap into the Frame Buffer. The bitmap is an array with the pixels on/off.
 
gd_error_e GD_SetContrast (gd_t *Gd, uint8_t value)
 Set the contrast of the display, if are supported. If display doesn't have this routine, nothing will happens.
 
gd_error_e GD_SetDisplayOn (gd_t *Gd, bool on)
 Set display On or Off, if the display implements this routine.
 
bool GD_GetDisplayOn (gd_t *Gd)
 Gets the display On/Off state.
 

Variables

gd_driver_t _Gd_Driver_SSD1306Attr
 
gd_driver_tGd_Driver_SSD1306 = &_Gd_Driver_SSD1306Attr
 SSD1306 Display Driver pointer.
 
gd_driver_t _Gd_Driver_ST7920Attr
 
gd_driver_tGd_Driver_ST7920 = &_Gd_Driver_ST7920Attr
 ST7920 Display Driver poointer.
 

Macro Definition Documentation

◆ _FILL_FRAME_BUFFER_TYPEFCAST

#define _FILL_FRAME_BUFFER_TYPEFCAST   (uint8_t (*)(void *, uint8_t))

◆ _REFRESH_DISP_TYPECAST

#define _REFRESH_DISP_TYPECAST   (uint8_t (*)(void *))

◆ _SET_CONTRAST_TYPECAST

#define _SET_CONTRAST_TYPECAST   (uint8_t (*)(void *, uint8_t))

◆ _SET_ON_TYPECASTAT

#define _SET_ON_TYPECASTAT   (uint8_t (*)(void *, _Bool))

◆ _SET_PIXEL_COLOR_TYPECAST

#define _SET_PIXEL_COLOR_TYPECAST   (uint8_t (*)(void *, uint32_t, uint32_t, uint8_t))

Function Documentation

◆ _DegToRad()

static float _DegToRad ( float par_deg)
static

◆ _drv_fill_frame_buffer()

static void _drv_fill_frame_buffer ( gd_t * Gd,
gd_color_e color )
static

◆ _drv_set_constrat()

static void _drv_set_constrat ( gd_t * Gd,
uint8_t value )
static

◆ _drv_set_on()

static void _drv_set_on ( gd_t * Gd,
bool On )
static

◆ _drv_set_pixel()

static void _drv_set_pixel ( gd_t * Gd,
uint32_t x,
uint32_t y,
gd_color_e color )
static

◆ _drv_set_refresh()

static void _drv_set_refresh ( gd_t * Gd)
static

◆ _mtx_lock()

static void _mtx_lock ( gd_t * Gd)
static

◆ _mtx_unlock()

static void _mtx_unlock ( gd_t * Gd)
static

◆ _NormalizeTo0_360()

static uint16_t _NormalizeTo0_360 ( uint16_t par_deg)
static

Variable Documentation

◆ _Gd_Driver_SSD1306Attr

gd_driver_t _Gd_Driver_SSD1306Attr
Initial value:
= {
.pHandle = NULL,
}
#define _FILL_FRAME_BUFFER_TYPEFCAST
Definition GraphicDisplay.c:23
#define _REFRESH_DISP_TYPECAST
Definition GraphicDisplay.c:24
#define _SET_CONTRAST_TYPECAST
Definition GraphicDisplay.c:26
#define _SET_ON_TYPECASTAT
Definition GraphicDisplay.c:25
#define _SET_PIXEL_COLOR_TYPECAST
Definition GraphicDisplay.c:22
uint8_t SSD1306_Write(ssd1306_t *ssd1306, uint32_t x, uint32_t y, bool color)
Definition ssd1306.c:321
uint8_t SSD1306_SetDisplayOn(ssd1306_t *ssd1306, bool on)
Definition ssd1306.c:273
uint8_t SSD1306_SetContrast(ssd1306_t *ssd1306, uint8_t level)
Definition ssd1306.c:259
uint8_t SSD1306_Fill(ssd1306_t *ssd1306, uint8_t color)
Definition ssd1306.c:349
uint8_t SSD1306_Refresh(ssd1306_t *ssd1306)
Definition ssd1306.c:289

Diver for SSD1306

◆ _Gd_Driver_ST7920Attr

gd_driver_t _Gd_Driver_ST7920Attr
Initial value:
= {
.pHandle = NULL,
.fxnSetOn = _SET_ON_TYPECASTAT NULL,
.fxnSetContrast = _SET_CONTRAST_TYPECAST NULL
}
uint8_t ST7920_Refresh(st7920_t *st7920)
Definition st7920.c:207
uint8_t ST7920_Fill(st7920_t *st7920, uint8_t color)
Definition st7920.c:275
uint8_t ST7920_Write(st7920_t *st7920, uint32_t x, uint32_t y, bool color)
Definition st7920.c:247

Diver for ST7920