blk_box_tc/main/drivers/char_lcd.h
2025-08-21 19:32:27 -05:00

72 lines
1.8 KiB
C++

#ifndef CHAR_LCD_H
#define CHAR_LCD_H
#include <cstdint>
#define CHAR_LCD_I2C_NUM I2C_NUM_0
#define LCD_ADDR 0x27
#define LCD_COLS 20
#define LCD_ROWS 4
/// Initializes the 2004 Character LCD
void init_lcd();
/// Clear the LCD
void lcd_clear();
/// Move cursor to home position
void lcd_cursor_home();
/// Set cursor position
void lcd_set_cursor_pos(uint8_t col, uint8_t row);
/// Turn the display on/off
void lcd_set_display(bool display);
/// Turn the cursor's visibility on/off
void lcd_set_cursor_vis(bool cursor);
/// Turn blinking cursor on/off
void lcd_set_cursor_blink(bool blink);
/// Scroll the display left
void lcd_scroll_display_left();
/// Scroll the display right
void lcd_scroll_display_right();
/// Set the text to flows automatically left to right
void lcd_left_to_right();
/// Set the text to flows automatically right to left
void lcd_right_to_left();
// Turn on/off autoscroll
void lcd_set_autoscroll(bool autoscroll);
// Set backlight brightness
void lcd_set_backlight(bool backlight);
// Create a custom character
void lcd_create_char(uint8_t location, const uint8_t charmap[]);
/// @brief Print a string to the LCD at a given pos.
/// @param col the column to print the string at.
/// @param row the row the print the string at.
/// @param str the string to print.
void lcd_print(uint8_t col, uint8_t row, const char* str);
/// @brief Enables or disables the header on the LCD.
/// @param enable `true` to enable the header, `false` to disable.
void set_lcd_header_enabled(bool enable);
/// @brief Returns weather or not the lcd_header is enabled.
/// @return `true` if the header is enabled, `false` otherwise.
bool lcd_header_enabled();
/// @brief Prints the header in the LCD.
void lcd_print_header();
/// @brief Prints the splash screen for the BLK_BOX.
void lcd_do_splash();
#endif /* CHAR_LCD_H */