From 36211f3fae469c179535da7417118bdd076c4d1b Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Tue, 12 Apr 2022 14:30:11 +0200 Subject: [PATCH] drivers/disp_dev: use struct to store display area coordinates --- drivers/disp_dev/disp_dev.c | 4 ++-- drivers/include/disp_dev.h | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/disp_dev/disp_dev.c b/drivers/disp_dev/disp_dev.c index daaeb001cd..6ae23c8562 100644 --- a/drivers/disp_dev/disp_dev.c +++ b/drivers/disp_dev/disp_dev.c @@ -63,12 +63,12 @@ disp_dev_reg_t *disp_dev_reg_find_screen(uint8_t screen_id) } void disp_dev_map(const disp_dev_t *dev, - uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2, + const disp_dev_area_t *area, const uint16_t *color) { assert(dev); - dev->driver->map(dev, x1, x2, y1, y2, color); + dev->driver->map(dev, area, color); } uint16_t disp_dev_height(const disp_dev_t *dev) diff --git a/drivers/include/disp_dev.h b/drivers/include/disp_dev.h index a2d8e680b4..51fafcdf68 100644 --- a/drivers/include/disp_dev.h +++ b/drivers/include/disp_dev.h @@ -42,6 +42,16 @@ extern "C" { */ typedef struct disp_dev disp_dev_t; +/** + * @brief Display area coordinates + */ +typedef struct { + uint16_t x1; /**< Horizontal start position (included) */ + uint16_t x2; /**< Horizontal end position (included) */ + uint16_t y1; /**< Vertical start position (included) */ + uint16_t y2; /**< Vertical end position (included) */ +} disp_dev_area_t; + /** * @brief Generic type for a display driver */ @@ -50,14 +60,11 @@ typedef struct { * @brief Map an area to display on the device * * @param[in] dev Pointer to the display device - * @param[in] x1 Left coordinate - * @param[in] x2 Right coordinate - * @param[in] y1 Top coordinate - * @param[in] y2 Bottom coordinate + * @param[in] area Coordinates of display area * @param[in] color Array of color to map to the display */ void (*map)(const disp_dev_t *dev, - uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2, + const disp_dev_area_t *area, const uint16_t *color); /** @@ -139,14 +146,11 @@ disp_dev_reg_t *disp_dev_reg_find_screen(uint8_t screen_id); * @brief Map an area to display on the device * * @param[in] dev Pointer to the display device - * @param[in] x1 Left coordinate - * @param[in] x2 Right coordinate - * @param[in] y1 Top coordinate - * @param[in] y2 Bottom coordinate + * @param[in] area Coordinates of display area * @param[in] color Array of color to map to the display */ void disp_dev_map(const disp_dev_t *dev, - uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2, + const disp_dev_area_t *area, const uint16_t *color); /**