Graphic Display v1.0.0
Control any mochrome display, with any microcontroller, in any amount.
Loading...
Searching...
No Matches
st7920.h File Reference

Driver for ST7920 display driver. This library needs you to implement interface control, providing the function pointer to library handle the display. More...

#include <assert.h>
#include <malloc.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdbool.h>
#include <string.h>
#include "st7920_defs.h"

Go to the source code of this file.

Data Structures

struct  st7920_t
 Handler of ST7920. Each display must need your own handler. Yes, this library supports multiples displays. More...
 
struct  st7920_params_t
 Struct to initialize and configure the driver to control the ST7920 peripheral. More...
 

Macros

#define ST7920_OK   0
 
#define ST7920_FAIL   1
 
#define ST7920_COLOR_BLACK   0
 
#define ST7920_COLOR_WHITE   1
 

Typedefs

typedef void(* fxnDelay_ms) (uint32_t ms)
 Function pointer definition for milliseconds delay.
 
typedef void(* fxn7920_mtxLock) (void)
 Function pointer to routine that waits for the mutex and lock it. It's useful on RTOS environments.
 
typedef void(* fxn7920_mtxunlock) (void)
 Function pointer to routine that unlocks the mutex. It's useful on RTOS environments.
 
typedef void(* fxn1306spi_cs) (uint8_t Signal)
 Function pointer to routine to control the Chip Select signal. On ST7920, Chip Select is enabled on High signal.
 
typedef void(* fxn1306spi_reset) (uint8_t Signal)
 Function pointer to routine to control the Reset pin signal.
 
typedef uint8_t(* fxn1306spi_write) (uint8_t *buff, uint32_t len)
 Function pointer to routine to transmit packets to ST7920 over SPI.
 

Enumerations

enum  st7920_mode_e { ST7920_MODE_SPI }
 Set the Mode of ST7920 display. This device can work on 8bits, 4bits and spi mode, but, here, only the SPI method is implemented, for while. More...
 

Functions

uint8_t ST7920_Init (st7920_t *st7920, st7920_params_t *params)
 
uint8_t ST7920_SetFrameBuffer (st7920_t *st7920, uint8_t *pu8FrameBuffer)
 
uint8_t ST7920_Refresh (st7920_t *st7920)
 
uint8_t ST7920_Write (st7920_t *st7920, uint32_t x, uint32_t y, bool color)
 
uint8_t ST7920_Fill (st7920_t *st7920, uint8_t color)
 

Detailed Description

Driver for ST7920 display driver. This library needs you to implement interface control, providing the function pointer to library handle the display.

Author
Pablo Jean Rozario (pablo.nosp@m..jea.nosp@m.n.eel.nosp@m.@gma.nosp@m.il.co.nosp@m.m)
Version
v1.0.0
Date
2024-07-02

Macro Definition Documentation

◆ ST7920_COLOR_BLACK

#define ST7920_COLOR_BLACK   0

◆ ST7920_COLOR_WHITE

#define ST7920_COLOR_WHITE   1

◆ ST7920_FAIL

#define ST7920_FAIL   1

◆ ST7920_OK

#define ST7920_OK   0

Typedef Documentation

◆ fxn1306spi_cs

typedef void(* fxn1306spi_cs) (uint8_t Signal)

Function pointer to routine to control the Chip Select signal. On ST7920, Chip Select is enabled on High signal.

Note
Used only in SPI mode.

◆ fxn1306spi_reset

typedef void(* fxn1306spi_reset) (uint8_t Signal)

Function pointer to routine to control the Reset pin signal.

◆ fxn1306spi_write

typedef uint8_t(* fxn1306spi_write) (uint8_t *buff, uint32_t len)

Function pointer to routine to transmit packets to ST7920 over SPI.

Note
Used only in SPI mode.

◆ fxn7920_mtxLock

typedef void(* fxn7920_mtxLock) (void)

Function pointer to routine that waits for the mutex and lock it. It's useful on RTOS environments.

Note
If driver calls are made over multiple threads, do not omit this.

◆ fxn7920_mtxunlock

typedef void(* fxn7920_mtxunlock) (void)

Function pointer to routine that unlocks the mutex. It's useful on RTOS environments.

Note
If driver calls are made over multiple threads, do not omit this.

◆ fxnDelay_ms

typedef void(* fxnDelay_ms) (uint32_t ms)

Function pointer definition for milliseconds delay.

Parameters
msAmount of milliseconds to wait.

Enumeration Type Documentation

◆ st7920_mode_e

Set the Mode of ST7920 display. This device can work on 8bits, 4bits and spi mode, but, here, only the SPI method is implemented, for while.

Enumerator
ST7920_MODE_SPI 

Initialize ST7920 in SPI mode and serial communication.

Function Documentation

◆ ST7920_Fill()

uint8_t ST7920_Fill ( st7920_t * st7920,
uint8_t color )
Parameters
st7920
color
Returns
uint8_t

◆ ST7920_Init()

uint8_t ST7920_Init ( st7920_t * st7920,
st7920_params_t * params )
Parameters
st7920
params
Returns
uint8_t

◆ ST7920_Refresh()

uint8_t ST7920_Refresh ( st7920_t * st7920)
Parameters
st7920
Returns
uint8_t

◆ ST7920_SetFrameBuffer()

uint8_t ST7920_SetFrameBuffer ( st7920_t * st7920,
uint8_t * pu8FrameBuffer )
Parameters
st7920
pu8FrameBuffer
Returns
uint8_t

◆ ST7920_Write()

uint8_t ST7920_Write ( st7920_t * st7920,
uint32_t x,
uint32_t y,
bool color )
Parameters
st7920
x
y
color
Returns
uint8_t