mikroSDK Reference Manual
lcd.h File Reference

Go to the source code of this file.

Data Structures

struct  lcd_config
 
struct  lcd_handle
 

Macros

#define LCD_CMD_FUNCTION_SET   ((uint8_t)0x20)
 LCD commands.
 
#define LCD_CMD_CLEAR   ((uint8_t)0x1)
 
#define LCD_CMD_RETURN_HOME   ((uint8_t)0x2)
 
#define LCD_CMD_CURSOR_OFF   ((uint8_t)0xC)
 
#define LCD_CMD_UNDERLINE_ON   ((uint8_t)0xE)
 
#define LCD_CMD_BLINK_CURSOR_ON   ((uint8_t)0xF)
 
#define LCD_CMD_MOVE_CURSOR_LEFT   ((uint8_t)0x10)
 
#define LCD_CMD_MOVE_CURSOR_RIGHT   ((uint8_t)0x14)
 
#define LCD_CMD_TURN_OFF   ((uint8_t)0x8)
 
#define LCD_CMD_TURN_ON   ((uint8_t)0xC)
 
#define LCD_CMD_SHIFT_LEFT   ((uint8_t)0x18)
 
#define LCD_CMD_SHIFT_RIGHT   ((uint8_t)0x1C)
 
#define LCD_CMD_MODE_4BIT   ((uint8_t)0x08)
 
#define LCD_MAP_PINS(lcd_cfg)   LCD_MAP_PINS_4BIT(lcd_cfg)
 Mapping default LCD control and data pins. More...
 
#define LCD_MAP_PINS_4BIT(lcd_cfg)
 Mapping 4-bit LCD control and data pins. More...
 
#define LCD_MAP_PINS_8BIT(lcd_cfg)
 Mapping 8-bit LCD control and data pins. More...
 

Typedefs

typedef struct lcd_config lcd_config_t
 
typedef void(* init_sequence_ptr) (uint32_t)
 Init sequence prototype. More...
 
typedef struct lcd_handle lcd_handle_t
 

Enumerations

enum  lcd_err_t
 
enum  lcd_select_t
 
enum  lcd_mode_t
 
enum  lcd_row_t
 

Functions

void lcd_configure_default (lcd_config_t *config)
 Configure LCD configuration structure. More...
 
lcd_err_t lcd_configure (lcd_handle_t *lcd_handle, lcd_config_t *config)
 Configures LCD handle with passed configuration structure. More...
 
void lcd_init (lcd_handle_t lcd_handle, init_sequence_ptr init_sequence)
 Initializes LCD. More...
 
void lcd_write (lcd_handle_t lcd_handle, char lcd_cmd_data, lcd_select_t cmd_or_data)
 Writes data to LCD. More...
 
void lcd_write_text (lcd_handle_t lcd_handle, char *lcd_data, lcd_row_t row)
 Writes text to LCD. More...
 
void lcd_shift_right (lcd_handle_t lcd_handle)
 Shifts data currently on LCD. More...
 
void lcd_shift_left (lcd_handle_t lcd_handle)
 Shifts data currently on LCD. More...
 
void lcd_set_row (lcd_handle_t lcd_handle, lcd_row_t row)
 Sets current active row on LCD. More...
 
void lcd_turn_on (lcd_handle_t lcd_handle)
 Turns LCD ON. More...
 
void lcd_turn_off (lcd_handle_t lcd_handle)
 Turns LCD OFF. More...
 
void lcd_clear (lcd_handle_t lcd_handle)
 Clears LCD. More...
 
void lcd_cursor_move_home (lcd_handle_t lcd_handle)
 Moves cursor to first position. More...
 
void lcd_cursor_move_left (lcd_handle_t lcd_handle)
 Moves cursor position. More...
 
void lcd_cursor_move_right (lcd_handle_t lcd_handle)
 Moves cursor position. More...
 
void lcd_cursor_off (lcd_handle_t lcd_handle)
 Removes cursor. More...
 
void lcd_cursor_on (lcd_handle_t lcd_handle)
 Shows cursor. More...
 
void lcd_backlight_off (lcd_handle_t lcd_handle)
 Turns LCD backlight OFF. More...
 
void lcd_backlight_on (lcd_handle_t lcd_handle)
 Turns LCD backlight ON. More...
 

Macro Definition Documentation

◆ LCD_MAP_PINS

#define LCD_MAP_PINS (   lcd_cfg)    LCD_MAP_PINS_4BIT(lcd_cfg)
Attention
This API is called by default in LCD code initialization.

◆ LCD_MAP_PINS_4BIT

#define LCD_MAP_PINS_4BIT (   lcd_cfg)
Value:
lcd_cfg.pin_cs = TFT_CS; \
lcd_cfg.pin_rst = TFT_RST; \
lcd_cfg.pin_backlight = TFT_BPWM; \
lcd_cfg.pin_d4 = TFT_D4; \
lcd_cfg.pin_d5 = TFT_D5; \
lcd_cfg.pin_d6 = TFT_D6; \
lcd_cfg.pin_d7 = TFT_D7;

◆ LCD_MAP_PINS_8BIT

#define LCD_MAP_PINS_8BIT (   lcd_cfg)
Value:
lcd_cfg.pin_cs = TFT_CS; \
lcd_cfg.pin_rst = TFT_RST; \
lcd_cfg.pin_backlight = TFT_BPWM; \
lcd_cfg.pin_d0 = TFT_D0; \
lcd_cfg.pin_d1 = TFT_D1; \
lcd_cfg.pin_d2 = TFT_D2; \
lcd_cfg.pin_d3 = TFT_D3; \
lcd_cfg.pin_d4 = TFT_D4; \
lcd_cfg.pin_d5 = TFT_D5; \
lcd_cfg.pin_d6 = TFT_D6; \
lcd_cfg.pin_d7 = TFT_D7;

Typedef Documentation

◆ lcd_config_t

typedef struct lcd_config lcd_config_t

Main cofiguration structure.

◆ init_sequence_ptr

typedef void(* init_sequence_ptr) (uint32_t)
Note
Expected from user to provide valid routine address.

◆ lcd_handle_t

typedef struct lcd_handle lcd_handle_t

Main handle for LCD operations.

Enumeration Type Documentation

◆ lcd_err_t

enum lcd_err_t

Return values.

Enumerator
LCD_SUCCESS 

Success.

LCD_ERROR 

Error.

◆ lcd_select_t

Selects type of data passed to LCD.

Enumerator
LCD_SELECT_CMD 

Select command.

LCD_SELECT_DATA 

Select data.

◆ lcd_mode_t

enum lcd_mode_t

Selects LCD data mode.

Enumerator
LCD_MODE_BIT_4 

4 bit data mode.

LCD_MODE_BIT_8 

8 bit data mode.

◆ lcd_row_t

enum lcd_row_t

Selects desired row on initialized LCD.

Enumerator
LCD_ROW_1 

First row.

LCD_ROW_2 

Second row.

LCD_ROW_3 

Third row.

LCD_ROW_4 

Fourth row.