feat: added display cleaning

This commit is contained in:
aZholtikov committed 2026-05-16 07:33:07 +03:00
1 parent ff3f404bb5
commit 765a962466
4 files changed
+24 -5

No files matched your search

+1 -4
View File
@@ -74,10 +74,7 @@ void app_main(void)
config.dio_gpio = GPIO_NUM_26;
zh_tm1637_init(&config, &tm1637_handle);
zh_tm1637_set_brightness(&tm1637_handle, 7); // Set brightness.
for (uint8_t i = 0; i < 6; ++i) // Clear LCD.
{
zh_tm1637_print(&tm1637_handle, i, 0x00);
};
zh_tm1637_clear(&tm1637_handle);
vTaskDelay(1000 / portTICK_PERIOD_MS);
zh_tm1637_print(&tm1637_handle, 0, 0x4F); // 3 on C0H address.
vTaskDelay(1000 / portTICK_PERIOD_MS);
+9
View File
@@ -109,6 +109,15 @@ extern "C"
*/
void zh_tm1637_reset_stats(void);
/**
* @brief Clear the LEDs.
*
* @param[in] handle Pointer to unique TM1637 handle.
*
* @return ESP_OK if success or an error code otherwise.
*/
esp_err_t zh_tm1637_clear(zh_tm1637_handle_t *handle);
#ifdef __cplusplus
}
#endif
+1 -1
View File
@@ -1 +1 @@
2.0.0
2.1.0
+13
View File
@@ -89,6 +89,19 @@ void zh_tm1637_reset_stats(void)
ZH_LOGI("Error statistic reset successfully.");
}
esp_err_t zh_tm1637_clear(zh_tm1637_handle_t *handle)
{
ZH_LOGI("Led drive clear started.");
ZH_ERROR_CHECK(handle != NULL, ESP_ERR_INVALID_ARG, NULL, "Led drive clear failed. Invalid argument.");
ZH_ERROR_CHECK(handle->is_initialized == true, ESP_FAIL, NULL, "Led drive clear failed. Led drive not initialized.");
for (uint8_t i = 0; i < 6; ++i)
{
ZH_ERROR_CHECK(zh_tm1637_print(handle, i, 0x00) == ESP_OK, ESP_FAIL, NULL, "Led drive clear failed. RMT driver error.");
};
ZH_LOGI("Led drive clear completed successfully.");
return ESP_OK;
}
static esp_err_t _zh_tm1637_validate_config(const zh_tm1637_init_config_t *config, zh_tm1637_handle_t *handle)
{
ZH_ERROR_CHECK(config->clk_gpio < GPIO_NUM_MAX && config->dio_gpio < GPIO_NUM_MAX, ESP_ERR_INVALID_ARG, NULL, "Invalid GPIO number.")