wip:
This commit is contained in:
BIN
ds/Liquid crystal display module 1602A.pdf
Normal file
BIN
ds/Liquid crystal display module 1602A.pdf
Normal file
Binary file not shown.
BIN
ds/Liquid crystal display module 1604A.pdf
Normal file
BIN
ds/Liquid crystal display module 1604A.pdf
Normal file
Binary file not shown.
@ -54,10 +54,11 @@ esp_err_t zh_160x_lcd_clear(zh_pcf8574_handle_t *handle)
|
|||||||
esp_err_t zh_160x_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)
|
||||||
{
|
{
|
||||||
ZH_160X_I2C_LOGI("160X set cursor started.");
|
ZH_160X_I2C_LOGI("160X set cursor started.");
|
||||||
ZH_160X_I2C_CHECK(row < 2 && col < 16 && handle != NULL, ESP_ERR_INVALID_ARG, "160X set cursor failed. Invalid argument.");
|
ZH_160X_I2C_CHECK(row < ((handle->system == ZH_LCD_16X2) ? 2 : 4) && col < 16 && handle != NULL, ESP_ERR_INVALID_ARG, "160X set cursor failed. Invalid argument.");
|
||||||
ZH_160X_I2C_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, "160X set cursor failed. PCF8574 not initialized.");
|
ZH_160X_I2C_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, "160X set cursor failed. PCF8574 not initialized.");
|
||||||
uint8_t address = (row == 0) ? col : (0x40 + col);
|
_zh_160x_send_command(handle, 0x80 | ((row == 0) ? col : (row == 1) ? (0x40 + col)
|
||||||
_zh_160x_send_command(handle, 0x80 | address);
|
: (row == 2) ? (0x10 + col)
|
||||||
|
: (0x50 + col)));
|
||||||
ZH_160X_I2C_LOGI("160X set cursor completed successfully.");
|
ZH_160X_I2C_LOGI("160X set cursor completed successfully.");
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ esp_err_t zh_160x_print_float(zh_pcf8574_handle_t *handle, float num, uint8_t pr
|
|||||||
esp_err_t zh_160x_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)
|
||||||
{
|
{
|
||||||
ZH_160X_I2C_LOGI("160X print progress bar started.");
|
ZH_160X_I2C_LOGI("160X print progress bar started.");
|
||||||
ZH_160X_I2C_CHECK(row < 2 && progress <= 100 && handle != NULL, ESP_ERR_INVALID_ARG, "160X print progress bar failed. Invalid argument.");
|
ZH_160X_I2C_CHECK(row < ((handle->system == ZH_LCD_16X2) ? 2 : 4) && progress <= 100 && handle != NULL, ESP_ERR_INVALID_ARG, "160X print progress bar failed. Invalid argument.");
|
||||||
ZH_160X_I2C_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, "160X print progress bar failed. PCF8574 not initialized.");
|
ZH_160X_I2C_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, "160X print progress bar failed. PCF8574 not initialized.");
|
||||||
uint8_t blocks = (progress * 16) / 100;
|
uint8_t blocks = (progress * 16) / 100;
|
||||||
zh_160x_set_cursor(handle, row, 0);
|
zh_160x_set_cursor(handle, row, 0);
|
||||||
@ -124,7 +125,7 @@ esp_err_t zh_160x_print_progress_bar(zh_pcf8574_handle_t *handle, uint8_t row, u
|
|||||||
esp_err_t zh_160x_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)
|
||||||
{
|
{
|
||||||
ZH_160X_I2C_LOGI("160X clear row started.");
|
ZH_160X_I2C_LOGI("160X clear row started.");
|
||||||
ZH_160X_I2C_CHECK(row < 2 && handle != NULL, ESP_ERR_INVALID_ARG, "160X clear row failed. Invalid argument.");
|
ZH_160X_I2C_CHECK(row < ((handle->system == ZH_LCD_16X2) ? 2 : 4) && handle != NULL, ESP_ERR_INVALID_ARG, "160X clear row failed. Invalid argument.");
|
||||||
ZH_160X_I2C_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, "160X clear row failed. PCF8574 not initialized.");
|
ZH_160X_I2C_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, "160X clear row failed. PCF8574 not initialized.");
|
||||||
zh_160x_set_cursor(handle, row, 0);
|
zh_160x_set_cursor(handle, row, 0);
|
||||||
for (uint8_t i = 0; i < 16; ++i)
|
for (uint8_t i = 0; i < 16; ++i)
|
||||||
|
Reference in New Issue
Block a user