Merge pull request #112 from lvgl/feat-add_busy_signal_handler_to_generic_driver

feat(lv_port): Add abstraction for busy signal
This commit is contained in:
Carlos Diaz 2021-10-01 15:11:47 -05:00 committed by GitHub
commit f6999a52fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View file

@ -39,3 +39,19 @@ void display_port_gpio_rst(lv_disp_drv_t *drv, uint8_t state)
gpio_set_level(CONFIG_LV_DISP_PIN_RST, state); gpio_set_level(CONFIG_LV_DISP_PIN_RST, state);
#endif #endif
} }
bool display_port_gpio_is_busy(lv_disp_drv_t *drv)
{
(void) drv;
bool device_busy = false;
#ifdef CONFIG_LV_DISP_PIN_BUSY
/* FIXME Assuming the busy signal in logic 1 means the device is busy */
if (gpio_get_level(CONFIG_LV_DISP_PIN_BUSY) == 1) {
device_busy = true;
}
#endif
return device_busy;
}

View file

@ -12,6 +12,9 @@ extern "C"
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
#endif #endif
#include <stdint.h>
#include <stdbool.h>
/** /**
* Busy wait delay port * Busy wait delay port
* *
@ -44,6 +47,15 @@ void display_port_gpio_dc(lv_disp_drv_t *drv, uint8_t state);
*/ */
void display_port_gpio_rst(lv_disp_drv_t *drv, uint8_t state); void display_port_gpio_rst(lv_disp_drv_t *drv, uint8_t state);
/**
* Display is busy port
*
* @param drv Pointer to driver See @ref lv_disp_drv_t
*
* @retval Returns false when display is not busy, true otherwise.
*/
bool display_port_gpio_is_busy(lv_disp_drv_t *drv);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif