Graphic LCD

Graphic LCD Overview

  • This is the grahic lcd implementation with fixed size of user initialization.

  • The main buffer structure variable and the internal data buffer both should be declared on the application side and the pointers of the variables are used in the module.

Usage

  1. All API functions have the first argument as the buffer instance.

  2. Internal data buffer size and pointer are initialized with module init function.

  3. Graphic LCD Module writes LCD string data.

  4. Return codes of API functions are defined in header file.

Grpahic LCD calls

Function

Description

rs_graphic_lcd_open

Function to open the graphic lcd

rs_graphic_lcd_process

Function to process the graphic lcd

rs_graphic_lcd_write_string

Function to process the lcd string

Using these ‘rs’ calls to initialize the graphic lcd and process the lcd data string.

Error Code

  • Every API’s for the graphic LCD module returns some success or failure values. Please refer below section,

Graphic LCD Header Details

Documentation from the relevant header as follows:

Graphic LCD Module.

This file contains the APIs for Graphic LCD module

Author

Embien RAPIDSEA Team

Copyright

Embien Technologies India Pvt. Ltd.

Defines

RS_GRAPHIC_LCD_MAX_NUM_DATA_PINS

Maximum number of data pins used by the graphic LCD.

RS_GRAPHIC_LCD_MAX_NUM_COLS

Maximum number of columns on the graphic LCD.

RS_GRAPHIC_LCD_MAX_NUM_ROWS

Maximum number of rows on the graphic LCD

Typedefs

typedef struct tag_rs_graphic_lcd_data_info rs_graphic_lcd_data_info_t

Contains information about graphic LCD port&pin.

typedef struct tag_rs_graphic_lcd_config rs_graphic_lcd_config_t

Contains information about graphic lCD config.

typedef struct tag_rs_graphic_lcd_inst rs_graphic_lcd_inst_t

Contains information about graphic LCD instance.

Functions

rs_handle_t rs_graphic_lcd_open(rs_graphic_lcd_inst_t *ptr_lcd_inst, rs_graphic_lcd_config_t *ptr_config)

Function declaration.

Initializes and opens the graphic LCD for operation.

This function sets up the graphic LCD based on the provided configuration settings. It allocates necessary resources and returns a handle that can be used for further operations with the LCD.

Parameters:
  • ptr_lcd_inst[in] - Pointer to the LCD instance structure.

  • ptr_config[in] - Pointer to the configuration structure containing settings like dimensions, communication parameters, etc.

Returns:

Handle to the graphic LCD on success, or an error code if the initialization fails.

rs_ret_val_t rs_graphic_lcd_process(rs_handle_t handle)

Processes any pending operations for the graphic LCD.

This function handles the processing of queued commands or updates required by the graphic LCD. It is typically called in the main loop or at regular intervals to ensure the LCD is updated and functioning correctly.

Parameters:

handle[in] - Handle to the graphic LCD, obtained from the rs_graphic_lcd_open function.

Returns:

0 on success or an error code if the processing fails.

rs_ret_val_t rs_graphic_lcd_write_string(rs_handle_t handle, uint16_t u16_x_axis, uint16_t u16_y_axis, int8_t s8_cursor_pos, uint8_t *ptr_text)

Writes a string to the graphic LCD at the specified coordinates.

This function allows you to display a string of text on the graphic LCD at a specific (x, y) position. The coordinates represent the starting position of the text on the screen.

Parameters:
  • handle[in] - Handle to the graphic LCD, obtained from the rs_graphic_lcd_open function.

  • x[in] - The X-coordinate (horizontal position) on the LCD where the text should start.

  • y[in] - The Y-coordinate (vertical position) on the LCD where the text should start.

  • cursor_pos[in] - position of the cursor if cursor is enabled

  • ptr_text[in] - Pointer to the string to be displayed on the LCD.

Returns:

0 on success or an error code if the text could not be written.

rs_ret_val_t rs_graphic_lcd_cursor_on(rs_handle_t handle)

Enables the cursor on the graphic LCD.

This function turns on the cursor display on the graphic LCD. The cursor will be visible at its current position on the screen and may blink depending on the LCD configuration.

Parameters:

handle[in] - Handle to the graphic LCD, obtained from the rs_graphic_lcd_open function.

Returns:

0 on success or an error code if the cursor could not be enabled.

rs_ret_val_t rs_graphic_lcd_cursor_off(rs_handle_t handle)

Disables the cursor on the graphic LCD.

This function turns off the cursor display on the graphic LCD, making it invisible on the screen.

Parameters:

handle[in] - Handle to the graphic LCD, obtained from the rs_graphic_lcd_open function.

Returns:

0 on success or an error code if the cursor could not be disabled.

struct tag_rs_graphic_lcd_data_info
#include <rs_graphic_lcd.h>

Contains information about graphic LCD port&pin.

Public Members

uint16_t port_id_key

Port ID associated with the key.

uint16_t pin_id_key

Pin ID associated with the key.

struct tag_rs_graphic_lcd_config
#include <rs_graphic_lcd.h>

Contains information about graphic lCD config.

Public Members

uint16_t width

Width of the graphic lcd.

uint16_t height

Height of the graphic lcd.

uint8_t type

Type of the graphic lcd (8 bit)

uint16_t port_id_cs1

Port ID of the chip select1.

uint16_t pin_id_cs1

Pin ID of the chip select1.

uint16_t port_id_cs2

Port ID of the chip select2.

uint16_t pin_id_cs2

Pin ID of the chip select2.

uint16_t port_id_rw

Port ID of the read write.

uint16_t pin_id_rw

Pin ID of the read write.

uint16_t port_id_en

Port ID of the enable.

uint16_t pin_id_en

Pin ID of the enable.

uint16_t port_id_di

Port ID of the data pin.

uint16_t pin_id_di

Pin ID of the data pin.

uint16_t port_id_rst

Port ID of the reset.

uint16_t pin_id_rst

Pin ID of the reset.

uint8_t cursor_state

Cursor on/off.

int8_t cursor_pos

Position of the cursor.

rs_graphic_lcd_data_info_t data_info[RS_GRAPHIC_LCD_MAX_NUM_DATA_PINS]

array of lcd pins

struct tag_rs_graphic_lcd_inst
#include <rs_graphic_lcd.h>

Contains information about graphic LCD instance.

Public Members

rs_graphic_lcd_config_t *ptr_config

Pointer to the graphic lcd configuration structure.

uint8_t lcd_data[RS_GRAPHIC_LCD_MAX_NUM_ROWS / 16][RS_GRAPHIC_LCD_MAX_NUM_COLS / 8]

LCD Data to be shown.