mikroSDK Reference Manual
|
Generic liquid crystal display APIs. More...
Topics | |
LCD Controller | |
Generic liquid crystal display controller specific APIs. | |
LCD Commands | |
LCD commands. | |
Data Structures | |
struct | lcd_config |
struct | lcd_handle |
Macros | |
#define | LCD_MAP_PINS(lcd_cfg) LCD_MAP_PINS_4BIT(lcd_cfg) |
Mapping default LCD control and data pins. | |
#define | LCD_MAP_PINS_4BIT(lcd_cfg) |
Mapping 4-bit LCD control and data pins. | |
#define | LCD_MAP_PINS_8BIT(lcd_cfg) |
Mapping 8-bit LCD control and data pins. | |
Typedefs | |
typedef struct lcd_config | lcd_config_t |
typedef void(* | init_sequence_ptr) (uint32_t) |
Init sequence prototype. | |
typedef struct lcd_handle | lcd_handle_t |
Enumerations | |
enum | lcd_err_t { LCD_SUCCESS = 0 , LCD_ERROR = (-1) } |
enum | lcd_select_t { LCD_SELECT_CMD = 0 , LCD_SELECT_DATA } |
enum | lcd_mode_t { LCD_MODE_BIT_4 = 0 , LCD_MODE_BIT_8 } |
enum | lcd_row_t { LCD_ROW_1 = 0x80 , LCD_ROW_2 = 0xC0 , LCD_ROW_3 = 0x94 , LCD_ROW_4 = 0xD4 } |
Functions list | |
void | lcd_configure_default (lcd_config_t *config) |
Configure LCD configuration structure. | |
lcd_err_t | lcd_configure (lcd_handle_t *lcd_handle, lcd_config_t *config) |
Configures LCD handle with passed configuration structure. | |
void | lcd_init (lcd_handle_t lcd_handle, init_sequence_ptr init_sequence) |
Initializes LCD. | |
void | lcd_write (lcd_handle_t lcd_handle, char lcd_cmd_data, lcd_select_t cmd_or_data) |
Writes data to LCD. | |
void | lcd_write_text (lcd_handle_t lcd_handle, char *lcd_data, lcd_row_t row) |
Writes text to LCD. | |
void | lcd_shift_right (lcd_handle_t lcd_handle) |
Shifts data currently on LCD. | |
void | lcd_shift_left (lcd_handle_t lcd_handle) |
Shifts data currently on LCD. | |
void | lcd_set_row (lcd_handle_t lcd_handle, lcd_row_t row) |
Sets current active row on LCD. | |
void | lcd_turn_on (lcd_handle_t lcd_handle) |
Turns LCD ON. | |
void | lcd_turn_off (lcd_handle_t lcd_handle) |
Turns LCD OFF. | |
void | lcd_clear (lcd_handle_t lcd_handle) |
Clears LCD. | |
void | lcd_cursor_move_home (lcd_handle_t lcd_handle) |
Moves cursor to first position. | |
void | lcd_cursor_move_left (lcd_handle_t lcd_handle) |
Moves cursor position. | |
void | lcd_cursor_move_right (lcd_handle_t lcd_handle) |
Moves cursor position. | |
void | lcd_cursor_off (lcd_handle_t lcd_handle) |
Removes cursor. | |
void | lcd_cursor_on (lcd_handle_t lcd_handle) |
Shows cursor. | |
void | lcd_backlight_off (lcd_handle_t lcd_handle) |
Turns LCD backlight OFF. | |
void | lcd_backlight_on (lcd_handle_t lcd_handle) |
Turns LCD backlight ON. | |
#define LCD_MAP_PINS | ( | lcd_cfg | ) | LCD_MAP_PINS_4BIT(lcd_cfg) |
#define LCD_MAP_PINS_4BIT | ( | lcd_cfg | ) |
#define LCD_MAP_PINS_8BIT | ( | lcd_cfg | ) |
typedef void(* init_sequence_ptr) (uint32_t) |
typedef struct lcd_config lcd_config_t |
Main cofiguration structure.
typedef struct lcd_handle lcd_handle_t |
Main handle for LCD operations.
enum lcd_err_t |
enum lcd_mode_t |
enum lcd_row_t |
enum lcd_select_t |
void lcd_backlight_off | ( | lcd_handle_t | lcd_handle | ) |
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_backlight_on | ( | lcd_handle_t | lcd_handle | ) |
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_clear | ( | lcd_handle_t | lcd_handle | ) |
Clears all characters on LCD.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
lcd_err_t lcd_configure | ( | lcd_handle_t * | lcd_handle, |
lcd_config_t * | config ) |
Configures LCD handle to values set in passed configuration structure. Additionaly will initialize all provided pins.
[in,out] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
[in] | config | LCD driver configuration structure. See lcd_config_t structure definition for detailed explanation. |
Example
void lcd_configure_default | ( | lcd_config_t * | config | ) |
Configures LCD structure to default initialization values. Take into consideration that this is just structure variable initial values setting. Values need to be redefined by user.
[in,out] | config | LCD driver configuration structure. See lcd_config_t structure definition for detailed explanation. |
Default values:
Function | Default value |
---|---|
PIN_CS | HAL_PIN_NC |
PIN_RST | HAL_PIN_NC |
PIN_BACKLIGHT | HAL_PIN_NC |
PIN_D0 | HAL_PIN_NC |
PIN_D1 | HAL_PIN_NC |
PIN_D2 | HAL_PIN_NC |
PIN_D3 | HAL_PIN_NC |
PIN_D4 | HAL_PIN_NC |
PIN_D5 | HAL_PIN_NC |
PIN_D6 | HAL_PIN_NC |
PIN_D7 | HAL_PIN_NC |
MODE | LCD_MODE_BIT_4 |
WAITBETWEENWRITES | 1000 |
Example
void lcd_cursor_move_home | ( | lcd_handle_t | lcd_handle | ) |
Moves current cursor position back to the home position.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_cursor_move_left | ( | lcd_handle_t | lcd_handle | ) |
Moves current cursor position one column to the left.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_cursor_move_right | ( | lcd_handle_t | lcd_handle | ) |
Moves current cursor position one column to the right.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_cursor_off | ( | lcd_handle_t | lcd_handle | ) |
Removes cursor from current position on the display.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_cursor_on | ( | lcd_handle_t | lcd_handle | ) |
Shows current cursor position on the display.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_init | ( | lcd_handle_t | lcd_handle, |
init_sequence_ptr | init_sequence ) |
Initializes LCD with default values.
[in] | lcd_handle | LCD handle. |
[in] | init_sequence_ptr | Pointer to init sequence API. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_set_row | ( | lcd_handle_t | lcd_handle, |
lcd_row_t | row ) |
Sets active row on the LCD where data is to be output.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
[in] | row | Desired row. Takes lcd_row_t values. |
Example
void lcd_shift_left | ( | lcd_handle_t | lcd_handle | ) |
Shifts the data on all rows on LCD one character at a time.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_shift_right | ( | lcd_handle_t | lcd_handle | ) |
Shifts the data on all rows on LCD one character at a time.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_turn_off | ( | lcd_handle_t | lcd_handle | ) |
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_turn_on | ( | lcd_handle_t | lcd_handle | ) |
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
Example
void lcd_write | ( | lcd_handle_t | lcd_handle, |
char | lcd_cmd_data, | ||
lcd_select_t | cmd_or_data ) |
Writes either commands or data to LCD lines.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
[in] | lcd_cmd_data | Data or command. |
[in] | cmd_or_data | Selector for pulse signaling. See lcd_select_t enum definition for detailed explanation. |
Example
void lcd_write_text | ( | lcd_handle_t | lcd_handle, |
char * | lcd_data, | ||
lcd_row_t | row ) |
Writes array of characters to LCD lines one by one.
[in] | lcd_handle | LCD handle. See lcd_handle_t structure definition for detailed explanation. |
[in] | lcd_data | Data. |
[in] | row | Selects row to write to. See lcd_row_t enum definition for detailed explanation. |
Example