2 Commits

Author SHA1 Message Date
e172d045a6 feat: added cursor operations 2026-01-26 15:54:23 +03:00
79f5ed0ad8 doc: updated readme 2026-01-25 21:30:04 +03:00
4 changed files with 48 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
## Tested on ## Tested on
1. [ESP32 ESP-IDF v5.5.1](https://docs.espressif.com/projects/esp-idf/en/v5.5.1/esp32/index.html) 1. [ESP32 ESP-IDF v5.5.2](https://docs.espressif.com/projects/esp-idf/en/v5.5.2/esp32/index.html)
## SAST Tools ## SAST Tools
@@ -25,8 +25,8 @@
## Dependencies ## Dependencies
1. [zh_vector](http://git.zh.com.ru/alexey.zholtikov/zh_vector) 1. [zh_vector](http://git.zh.com.ru/esp_components/zh_vector)
2. [zh_pcf8574](http://git.zh.com.ru/alexey.zholtikov/zh_pcf8574) 2. [zh_pcf8574](http://git.zh.com.ru/esp_components/zh_pcf8574)
## Using ## Using
@@ -34,9 +34,9 @@ In an existing project, run the following command to install the components:
```text ```text
cd ../your_project/components cd ../your_project/components
git clone http://git.zh.com.ru/alexey.zholtikov/zh_160x_i2c git clone http://git.zh.com.ru/esp_components/zh_160x_i2c
git clone http://git.zh.com.ru/alexey.zholtikov/zh_pcf8574 git clone http://git.zh.com.ru/esp_components/zh_pcf8574
git clone http://git.zh.com.ru/alexey.zholtikov/zh_vector git clone http://git.zh.com.ru/esp_components/zh_vector
``` ```
In the application, add the component: In the application, add the component:

View File

@@ -96,6 +96,25 @@ extern "C"
*/ */
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);
/**
* @brief Enable the cursor.
*
* @param[in] handle Pointer to unique PCF8574 handle.
* @param[in] blink Blink mode.
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_160x_on_cursor(zh_pcf8574_handle_t *handle, bool blink);
/**
* @brief Disable the cursor.
*
* @param[in] handle Pointer to unique PCF8574 handle.
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_160x_off_cursor(zh_pcf8574_handle_t *handle);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -1 +1 @@
4.0.0 4.1.0

View File

@@ -139,6 +139,28 @@ esp_err_t zh_160x_clear_row(zh_pcf8574_handle_t *handle, uint8_t row)
return ESP_OK; return ESP_OK;
} }
esp_err_t zh_160x_on_cursor(zh_pcf8574_handle_t *handle, bool blink)
{
ZH_LOGI("160X enable cursor started.");
ZH_ERROR_CHECK(handle != NULL, ESP_ERR_INVALID_ARG, NULL, "160X enable cursor failed. Invalid argument.");
ZH_ERROR_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, NULL, "160X enable cursor failed. PCF8574 not initialized.");
esp_err_t err = _zh_160x_send_command(handle, (blink == true) ? 0x0f : 0x0e);
ZH_ERROR_CHECK(err == ESP_OK, err, NULL, "160X enable cursor failed. PCF8574 error.");
ZH_LOGI("160X enable cursor completed successfully.");
return ESP_OK;
}
esp_err_t zh_160x_off_cursor(zh_pcf8574_handle_t *handle)
{
ZH_LOGI("160X disable cursor started.");
ZH_ERROR_CHECK(handle != NULL, ESP_ERR_INVALID_ARG, NULL, "160X disable cursor failed. Invalid argument.");
ZH_ERROR_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, NULL, "160X disable cursor failed. PCF8574 not initialized.");
esp_err_t err = _zh_160x_send_command(handle, 0x0c);
ZH_ERROR_CHECK(err == ESP_OK, err, NULL, "160X disable cursor failed. PCF8574 error.");
ZH_LOGI("160X disable cursor completed successfully.");
return ESP_OK;
}
static esp_err_t _zh_160x_lcd_init(zh_pcf8574_handle_t *handle) static esp_err_t _zh_160x_lcd_init(zh_pcf8574_handle_t *handle)
{ {
vTaskDelay(20 / portTICK_PERIOD_MS); vTaskDelay(20 / portTICK_PERIOD_MS);