This commit is contained in:
2025-05-30 17:43:32 +03:00
parent 68ee6431fc
commit ab9505ff8a
5 changed files with 221 additions and 212 deletions

View File

@ -2,28 +2,32 @@
#include "zh_pcf8574.h"
#define ZH_LCD_16X2 1
#define ZH_LCD_16X4 0
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @brief Initializes the LCD 1602A.
* @brief Initializes the LCD 160X.
*
* @param[in] handle Pointer to unique PCF8574 handle.
* @param[in] size LCD size (ZH_LCD_16X2 or ZH_LCD_16X4).
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_1602a_init(zh_pcf8574_handle_t *handle);
esp_err_t zh_160x_init(zh_pcf8574_handle_t *handle, bool size);
/**
* @brief Clears the LCD screen.
*
* @param[in] handle Pointer to unique PCF8574 handle.
*
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_1602a_lcd_clear(zh_pcf8574_handle_t *handle);
esp_err_t zh_160x_lcd_clear(zh_pcf8574_handle_t *handle);
/**
* @brief Sets the cursor to a specific position on the LCD.
@ -34,7 +38,7 @@ extern "C"
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_1602a_set_cursor(zh_pcf8574_handle_t *handle, uint8_t row, uint8_t col);
esp_err_t zh_160x_set_cursor(zh_pcf8574_handle_t *handle, uint8_t row, uint8_t col);
/**
* @brief Prints a string to the LCD.
@ -44,7 +48,7 @@ extern "C"
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_1602a_print_char(zh_pcf8574_handle_t *handle, const char *str);
esp_err_t zh_160x_print_char(zh_pcf8574_handle_t *handle, const char *str);
/**
* @brief Prints an integer to the LCD.
@ -54,7 +58,7 @@ extern "C"
*
* @return ESP_OK if success or an error code otherwise..
*/
esp_err_t zh_1602a_print_int(zh_pcf8574_handle_t *handle, int num);
esp_err_t zh_160x_print_int(zh_pcf8574_handle_t *handle, int num);
/**
* @brief Prints a floating-point number to the LCD.
@ -65,7 +69,7 @@ extern "C"
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_1602a_print_float(zh_pcf8574_handle_t *handle, float num, uint8_t precision);
esp_err_t zh_160x_print_float(zh_pcf8574_handle_t *handle, float num, uint8_t precision);
/**
* @brief Displays a progress bar on a specific row of the LCD.
@ -76,7 +80,7 @@ extern "C"
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_1602a_print_progress_bar(zh_pcf8574_handle_t *handle, uint8_t row, uint8_t progress);
esp_err_t zh_160x_print_progress_bar(zh_pcf8574_handle_t *handle, uint8_t row, uint8_t progress);
/**
* @brief Clears a specific row on the LCD.
@ -86,7 +90,7 @@ extern "C"
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_1602a_clear_row(zh_pcf8574_handle_t *handle, uint8_t row);
esp_err_t zh_160x_clear_row(zh_pcf8574_handle_t *handle, uint8_t row);
#ifdef __cplusplus
}