1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/disp_dev: use struct to store display area coordinates

This commit is contained in:
Alexandre Abadie 2022-04-12 14:30:11 +02:00
parent 32ac29bd98
commit 36211f3fae
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 16 additions and 12 deletions

View File

@ -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)

View File

@ -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);
/**