LibDriver ST7920
Loading...
Searching...
No Matches
st7920 basic driver function

st7920 basic driver modules More...

Collaboration diagram for st7920 basic driver function:

Data Structures

struct  st7920_handle_s
 st7920 handle structure definition More...
struct  st7920_info_s
 st7920 information structure definition More...

Macros

#define ST7920_COMMAND_CMD_DELAY   100
 st7920 command cmd delay definition
#define ST7920_COMMAND_DATA_DELAY   10
 st7920 command data delay definition

Typedefs

typedef struct st7920_handle_s st7920_handle_t
 st7920 handle structure definition
typedef struct st7920_info_s st7920_info_t
 st7920 information structure definition

Enumerations

enum  st7920_bool_t { ST7920_BOOL_FALSE = 0x00 , ST7920_BOOL_TRUE = 0x01 }
 st7920 bool enumeration definition More...
enum  st7920_address_counter_mode_t { ST7920_ADDRESS_COUNTER_MODE_DECREASE = 0x00 , ST7920_ADDRESS_COUNTER_MODE_INCREASE = 0x01 }
 st7920 address counter mode enumeration definition More...
enum  st7920_display_shift_t { ST7920_DISPLAY_SHIFT_RIGHT = 0x00 , ST7920_DISPLAY_SHIFT_LEFT = 0x01 }
 st7920 display shift enumeration definition More...
enum  st7920_display_shift_mode_t { ST7920_DISPLAY_SHIFT_MODE_LL = 0x00 , ST7920_DISPLAY_SHIFT_MODE_LH = 0x01 , ST7920_DISPLAY_SHIFT_MODE_HL = 0x02 , ST7920_DISPLAY_SHIFT_MODE_HH = 0x03 }
 st7920 display shift mode enumeration definition More...
enum  st7920_interface_bus_bit_t { ST7920_INTERFACE_BUS_BIT_4 = 0x00 , ST7920_INTERFACE_BUS_BIT_8 = 0x01 }
 st7920 interface bus bit enumeration definition More...
enum  st7920_command_mode_t { ST7920_COMMAND_MODE_BASIC = 0x00 , ST7920_COMMAND_MODE_EXTENDED = 0x01 }
 st7920 command mode enumeration definition More...

Functions

uint8_t st7920_info (st7920_info_t *info)
 get chip's information
uint8_t st7920_init (st7920_handle_t *handle)
 initialize the chip
uint8_t st7920_deinit (st7920_handle_t *handle)
 close the chip
uint8_t st7920_write_string (st7920_handle_t *handle, uint8_t x, uint8_t y, char *str)
 show a string
uint8_t st7920_display_clear (st7920_handle_t *handle)
 clear the display
uint8_t st7920_return_home (st7920_handle_t *handle)
 return the home
uint8_t st7920_set_entry_mode (st7920_handle_t *handle, st7920_display_shift_t shift, st7920_address_counter_mode_t mode)
 set the entry mode
uint8_t st7920_set_display_control (st7920_handle_t *handle, st7920_bool_t display_on, st7920_bool_t cursor_on, st7920_bool_t character_blink_on)
 set the display control
uint8_t st7920_set_display_shift_mode (st7920_handle_t *handle, st7920_display_shift_mode_t mode)
 set the display shift mode
uint8_t st7920_set_function (st7920_handle_t *handle, st7920_interface_bus_bit_t bus_bit, st7920_command_mode_t mode)
 set the function
uint8_t st7920_set_cgram_address (st7920_handle_t *handle, uint8_t addr)
 set the cgram address
uint8_t st7920_set_ddram_address (st7920_handle_t *handle, uint8_t addr)
 set the ddram address
uint8_t st7920_write_ram (st7920_handle_t *handle, uint8_t *data, uint8_t len)
 write the ram

Detailed Description

st7920 basic driver modules

Macro Definition Documentation

◆ ST7920_COMMAND_CMD_DELAY

#define ST7920_COMMAND_CMD_DELAY   100

st7920 command cmd delay definition

100us

Definition at line 63 of file driver_st7920.h.

◆ ST7920_COMMAND_DATA_DELAY

#define ST7920_COMMAND_DATA_DELAY   10

st7920 command data delay definition

10us

Definition at line 70 of file driver_st7920.h.

Typedef Documentation

◆ st7920_handle_t

st7920 handle structure definition

◆ st7920_info_t

typedef struct st7920_info_s st7920_info_t

st7920 information structure definition

Enumeration Type Documentation

◆ st7920_address_counter_mode_t

st7920 address counter mode enumeration definition

Enumerator
ST7920_ADDRESS_COUNTER_MODE_DECREASE 

decrease

ST7920_ADDRESS_COUNTER_MODE_INCREASE 

increase

Definition at line 85 of file driver_st7920.h.

◆ st7920_bool_t

st7920 bool enumeration definition

Enumerator
ST7920_BOOL_FALSE 

false

ST7920_BOOL_TRUE 

true

Definition at line 76 of file driver_st7920.h.

◆ st7920_command_mode_t

st7920 command mode enumeration definition

Enumerator
ST7920_COMMAND_MODE_BASIC 

basic mode

ST7920_COMMAND_MODE_EXTENDED 

extended mode

Definition at line 123 of file driver_st7920.h.

◆ st7920_display_shift_mode_t

st7920 display shift mode enumeration definition

Enumerator
ST7920_DISPLAY_SHIFT_MODE_LL 

cursor moves left by 1 position

ST7920_DISPLAY_SHIFT_MODE_LH 

cursor moves right by 1 position

ST7920_DISPLAY_SHIFT_MODE_HL 

display shift left by 1, cursor also follows to shift

ST7920_DISPLAY_SHIFT_MODE_HH 

display shift right by 1, cursor also follows to shift

Definition at line 103 of file driver_st7920.h.

◆ st7920_display_shift_t

st7920 display shift enumeration definition

Enumerator
ST7920_DISPLAY_SHIFT_RIGHT 

cursor moves right

ST7920_DISPLAY_SHIFT_LEFT 

cursor moves left

Definition at line 94 of file driver_st7920.h.

◆ st7920_interface_bus_bit_t

st7920 interface bus bit enumeration definition

Enumerator
ST7920_INTERFACE_BUS_BIT_4 

4 bit

ST7920_INTERFACE_BUS_BIT_8 

8 bit

Definition at line 114 of file driver_st7920.h.

Function Documentation

◆ st7920_deinit()

uint8_t st7920_deinit ( st7920_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an st7920 handle structure
Returns
status code
  • 0 success
  • 1 deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 337 of file driver_st7920.c.

◆ st7920_display_clear()

uint8_t st7920_display_clear ( st7920_handle_t * handle)

clear the display

Parameters
[in]*handlepointer to an st7920 handle structure
Returns
status code
  • 0 success
  • 1 display clear failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1107 of file driver_st7920.c.

◆ st7920_info()

uint8_t st7920_info ( st7920_info_t * info)

get chip's information

Parameters
[out]*infopointer to an st7920 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 1914 of file driver_st7920.c.

◆ st7920_init()

uint8_t st7920_init ( st7920_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an st7920 handle structure
Returns
status code
  • 0 success
  • 1 gpio initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 214 of file driver_st7920.c.

◆ st7920_return_home()

uint8_t st7920_return_home ( st7920_handle_t * handle)

return the home

Parameters
[in]*handlepointer to an st7920 handle structure
Returns
status code
  • 0 success
  • 1 return home failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 this command must be run in basic command mode
Note
none

Definition at line 1228 of file driver_st7920.c.

◆ st7920_set_cgram_address()

uint8_t st7920_set_cgram_address ( st7920_handle_t * handle,
uint8_t addr )

set the cgram address

Parameters
[in]*handlepointer to an st7920 handle structure
[in]addrcgram address
Returns
status code
  • 0 success
  • 1 set cgram address failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 this command must be run in basic command mode
  • 5 addr is over 0x3F
Note
0 <= addr <= 0x3F

Definition at line 1434 of file driver_st7920.c.

◆ st7920_set_ddram_address()

uint8_t st7920_set_ddram_address ( st7920_handle_t * handle,
uint8_t addr )

set the ddram address

Parameters
[in]*handlepointer to an st7920 handle structure
[in]addrddram address
Returns
status code
  • 0 success
  • 1 set ddram address failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 this command must be run in basic command mode
  • 5 addr is over 0x3F
Note
0 <= addr <= 0x7F

Definition at line 1482 of file driver_st7920.c.

◆ st7920_set_display_control()

uint8_t st7920_set_display_control ( st7920_handle_t * handle,
st7920_bool_t display_on,
st7920_bool_t cursor_on,
st7920_bool_t character_blink_on )

set the display control

Parameters
[in]*handlepointer to an st7920 handle structure
[in]display_onbool value
[in]cursor_onbool value
[in]character_blink_onbool value
Returns
status code
  • 0 success
  • 1 set display control failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 this command must be run in basic command mode
Note
none

Definition at line 1313 of file driver_st7920.c.

◆ st7920_set_display_shift_mode()

uint8_t st7920_set_display_shift_mode ( st7920_handle_t * handle,
st7920_display_shift_mode_t mode )

set the display shift mode

Parameters
[in]*handlepointer to an st7920 handle structure
[in]modedisplay shift mode
Returns
status code
  • 0 success
  • 1 set display shift mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 this command must be run in basic command mode
Note
none

Definition at line 1355 of file driver_st7920.c.

◆ st7920_set_entry_mode()

uint8_t st7920_set_entry_mode ( st7920_handle_t * handle,
st7920_display_shift_t shift,
st7920_address_counter_mode_t mode )

set the entry mode

Parameters
[in]*handlepointer to an st7920 handle structure
[in]shiftdisplay shift
[in]modeaddress counter mode
Returns
status code
  • 0 success
  • 1 set entry mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 this command must be run in basic command mode
Note
none

Definition at line 1269 of file driver_st7920.c.

◆ st7920_set_function()

uint8_t st7920_set_function ( st7920_handle_t * handle,
st7920_interface_bus_bit_t bus_bit,
st7920_command_mode_t mode )

set the function

Parameters
[in]*handlepointer to an st7920 handle structure
[in]bus_bitbus bit
[in]modecommand mode
Returns
status code
  • 0 success
  • 1 set function failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1397 of file driver_st7920.c.

◆ st7920_write_ram()

uint8_t st7920_write_ram ( st7920_handle_t * handle,
uint8_t * data,
uint8_t len )

write the ram

Parameters
[in]*handlepointer to an st7920 handle structure
[in]*datapointer to a data buffer
[in]lendata length
Returns
status code
  • 0 success
  • 1 write ram failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 this command must be run in basic command mode
Note
none

Definition at line 1530 of file driver_st7920.c.

◆ st7920_write_string()

uint8_t st7920_write_string ( st7920_handle_t * handle,
uint8_t x,
uint8_t y,
char * str )

show a string

Parameters
[in]*handlepointer to an st7920 handle structure
[in]xcoordinate x
[in]ycoordinate y
[in]*strpointer to a write string address
Returns
status code
  • 0 success
  • 1 write string failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 this command must be run in basic command mode
  • 5 x is over 3
  • 6 y is over 7
Note
0 <= x <= 3 0 <= y <= 7

Definition at line 548 of file driver_st7920.c.