feat(lv_port): Add abstraction for busy signal

This signal can be used when driving eink displays
This commit is contained in:
C47D 2021-09-18 20:14:35 -05:00
parent 2006d5e449
commit 3c5a4061d9
2 changed files with 34 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);
#endif
}
display_port_busy_t display_port_gpio_is_busy(lv_disp_drv_t *drv)
{
(void) drv;
display_port_busy_t device_busy = DISPLAY_PORT_DEVICE_NOT_BUSY;
#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 = DISPLAY_PORT_DEVICE_IS_BUSY;
}
#endif
return device_busy;
}

View file

@ -12,6 +12,14 @@ extern "C"
#include "lvgl/lvgl.h"
#endif
/** Display is busy port
* Useful for eink displays that need to poll their BUSY signal */
typedef enum {
DISPLAY_PORT_DEVICE_NOT_BUSY,
DISPLAY_PORT_DEVICE_IS_BUSY,
/* NOTE Operation should not be interrupted when the device is busy */
} display_port_busy_t;
/**
* Busy wait delay port
*
@ -44,6 +52,16 @@ 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);
/**
* Display is busy port
*
* @param drv Pointer to driver See @ref lv_disp_drv_t
*
* @retval Returns DISPLAY_PORT_DEVICE_NOT_BUSY when display is not busy,
* DISPLAY_PORT_DEVICE_IS_BUSY otherwise.
*/
display_port_busy_t display_port_gpio_is_busy(lv_disp_drv_t *drv);
#ifdef __cplusplus
} /* extern "C" */
#endif