14#ifndef ZEPHYR_INCLUDE_DRIVERS_DISPLAY_H_
15#define ZEPHYR_INCLUDE_DRIVERS_DISPLAY_H_
233#define DISPLAY_BITS_PER_PIXEL(fmt) \
234 ((((fmt & PIXEL_FORMAT_RGB_888) >> 0) * 24U) + \
235 (((fmt & PIXEL_FORMAT_MONO01) >> 1) * 1U) + \
236 (((fmt & PIXEL_FORMAT_MONO10) >> 2) * 1U) + \
237 (((fmt & PIXEL_FORMAT_ARGB_8888) >> 3) * 32U) + \
238 (((fmt & PIXEL_FORMAT_RGB_565) >> 4) * 16U) + \
239 (((fmt & PIXEL_FORMAT_RGB_565X) >> 5) * 16U) + \
240 (((fmt & PIXEL_FORMAT_L_8) >> 6) * 8U) + \
241 (((fmt & PIXEL_FORMAT_AL_88) >> 7) * 16U) + \
242 (((fmt & PIXEL_FORMAT_XRGB_8888) >> 8) * 32U) + \
243 (((fmt & PIXEL_FORMAT_BGR_888) >> 9) * 24U) + \
244 (((fmt & PIXEL_FORMAT_ABGR_8888) >> 10) * 32U) + \
245 (((fmt & PIXEL_FORMAT_RGBA_8888) >> 11) * 32U) + \
246 (((fmt & PIXEL_FORMAT_BGRA_8888) >> 12) * 32U))
416typedef void *(*display_get_framebuffer_api)(
const struct device *dev);
551 return api->
write(dev, x, y, desc, buf);
578 return api->
read(dev, x, y, desc, buf);
598 return api->
clear(dev);
824 return api->
register_event_cb(dev, cb, user_data, event_mask, in_isr, out_reg_handle);
int(* display_set_pixel_format_api)(const struct device *dev, const enum display_pixel_format pixel_format)
Callback API to set pixel format used by the display.
Definition display.h:444
void(* display_get_capabilities_api)(const struct device *dev, struct display_capabilities *capabilities)
Callback API to get display capabilities.
Definition display.h:436
int(* display_write_api)(const struct device *dev, const uint16_t x, const uint16_t y, const struct display_buffer_descriptor *desc, const void *buf)
Callback API for writing data to the display.
Definition display.h:392
int(* display_set_brightness_api)(const struct device *dev, const uint8_t brightness)
Callback API to set display brightness.
Definition display.h:422
void *(* display_get_framebuffer_api)(const struct device *dev)
Callback API to get framebuffer pointer.
Definition display.h:416
int(* display_read_api)(const struct device *dev, const uint16_t x, const uint16_t y, const struct display_buffer_descriptor *desc, void *buf)
Callback API for reading data from the display.
Definition display.h:401
int(* display_blanking_off_api)(const struct device *dev)
Callback API to turn off display blanking.
Definition display.h:386
int(* display_register_event_cb_api)(const struct device *dev, display_event_cb_t cb, void *user_data, uint32_t event_mask, bool in_isr, uint32_t *out_reg_handle)
Callback API to register display event callback.
Definition display.h:460
int(* display_blanking_on_api)(const struct device *dev)
Callback API to turn on display blanking.
Definition display.h:380
int(* display_unregister_event_cb_api)(const struct device *dev, uint32_t reg_handle)
Callback API to unregister display event callback.
Definition display.h:469
int(* display_set_contrast_api)(const struct device *dev, const uint8_t contrast)
Callback API to set display contrast.
Definition display.h:429
int(* display_clear_api)(const struct device *dev)
Callback API for clearing the screen of the display.
Definition display.h:410
int(* display_set_orientation_api)(const struct device *dev, const enum display_orientation orientation)
Callback API to set orientation used by the display.
Definition display.h:452
display_event
Display event types.
Definition display.h:331
display_screen_info
Display screen information.
Definition display.h:250
static int display_write(const struct device *dev, const uint16_t x, const uint16_t y, const struct display_buffer_descriptor *desc, const void *buf)
Write data to display.
Definition display.h:543
static int display_read(const struct device *dev, const uint16_t x, const uint16_t y, const struct display_buffer_descriptor *desc, void *buf)
Read data from display.
Definition display.h:566
static void * display_get_framebuffer(const struct device *dev)
Get pointer to framebuffer for direct access.
Definition display.h:610
static int display_blanking_off(const struct device *dev)
Turn display blanking off.
Definition display.h:665
static int display_set_orientation(const struct device *dev, const enum display_orientation orientation)
Set display orientation.
Definition display.h:774
display_event_result
Display event callback return flags.
Definition display.h:341
static int display_clear(const struct device *dev)
Clear the screen of the display device.
Definition display.h:589
static void display_get_capabilities(const struct device *dev, struct display_capabilities *capabilities)
Get display capabilities.
Definition display.h:732
static int display_set_pixel_format(const struct device *dev, const enum display_pixel_format pixel_format)
Set pixel format used by the display.
Definition display.h:752
static int display_set_contrast(const struct device *dev, uint8_t contrast)
Set the contrast of the display.
Definition display.h:714
static int display_register_event_cb(const struct device *dev, display_event_cb_t cb, void *user_data, uint32_t event_mask, bool in_isr, uint32_t *out_reg_handle)
Register event callback for a display device.
Definition display.h:813
static int display_unregister_event_cb(const struct device *dev, uint32_t reg_handle)
Unregister event callback for a display device.
Definition display.h:838
display_pixel_format
Display pixel formats.
Definition display.h:49
display_orientation
Enumeration with possible display orientation.
Definition display.h:278
static int display_blanking_on(const struct device *dev)
Turn display blanking on.
Definition display.h:641
static int display_set_brightness(const struct device *dev, uint8_t brightness)
Set the brightness of the display.
Definition display.h:689
enum display_event_result(* display_event_cb_t)(const struct device *dev, uint32_t evt, const struct display_event_data *data, void *user_data)
Called either in ISR context (if arg in_isr=true at register time, see display_register_event_cb ) or...
Definition display.h:366
@ DISPLAY_EVENT_LINE_INT
Fired when controller reaches a configured scanline.
Definition display.h:333
@ DISPLAY_EVENT_FRAME_DONE
Fired when a frame transfer to the panel or frame buffer update completes.
Definition display.h:337
@ DISPLAY_EVENT_VSYNC
Fired at vertical sync / start of new frame.
Definition display.h:335
@ SCREEN_INFO_X_ALIGNMENT_WIDTH
Screen has x alignment constrained to width.
Definition display.h:272
@ SCREEN_INFO_EPD
Electrophoretic Display.
Definition display.h:264
@ SCREEN_INFO_DOUBLE_BUFFER
Screen has two alternating ram buffers.
Definition display.h:268
@ SCREEN_INFO_MONO_VTILED
If selected, one octet represents 8 pixels ordered vertically, otherwise ordered horizontally.
Definition display.h:255
@ SCREEN_INFO_MONO_MSB_FIRST
If selected, the MSB represents the first pixel, otherwise MSB represents the last pixel.
Definition display.h:260
@ DISPLAY_EVENT_RESULT_CONTINUE
Let the driver execute its default handling.
Definition display.h:343
@ DISPLAY_EVENT_RESULT_HANDLED
The callback handled the event and the driver should skip its default processing for that event.
Definition display.h:347
@ PIXEL_FORMAT_ABGR_8888
32-bit BGR format with 8 bits per component and 8 bits for alpha.
Definition display.h:188
@ PIXEL_FORMAT_RGB_565X
16-bit RGB format packed into two bytes.
Definition display.h:119
@ PIXEL_FORMAT_BGRA_8888
32-bit BGR format with 8 bits per component and 8 bits for alpha.
Definition display.h:216
@ PIXEL_FORMAT_L_8
8-bit Greyscale format
Definition display.h:132
@ PIXEL_FORMAT_XRGB_8888
32-bit RGB format with 8 bits per component and 8 bits unused.
Definition display.h:160
@ PIXEL_FORMAT_BGR_888
24-bit BGR format with 8 bits per component.
Definition display.h:174
@ PIXEL_FORMAT_MONO10
Monochrome (1=Black 0=White).
Definition display.h:78
@ PIXEL_FORMAT_ARGB_8888
32-bit RGB format with 8 bits per component and 8 bits for alpha.
Definition display.h:92
@ PIXEL_FORMAT_AL_88
16-bit Greyscale format with 8-bit luminance and 8-bit for alpha
Definition display.h:146
@ PIXEL_FORMAT_RGBA_8888
32-bit RGB format with 8 bits per component and 8 bits for alpha.
Definition display.h:202
@ PIXEL_FORMAT_PRIV_START
This and higher values are display specific.
Definition display.h:222
@ PIXEL_FORMAT_MONO01
1-bit monochrome format with 1 bit per pixel, thus each byte represent 8 pixels Two variants,...
Definition display.h:77
@ PIXEL_FORMAT_RGB_565
16-bit RGB format packed into two bytes: 5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0].
Definition display.h:107
@ PIXEL_FORMAT_RGB_888
24-bit RGB format with 8 bits per component.
Definition display.h:62
@ DISPLAY_ORIENTATION_ROTATED_90
Rotated 90 degrees clockwise.
Definition display.h:280
@ DISPLAY_ORIENTATION_ROTATED_180
Rotated 180 degrees clockwise.
Definition display.h:281
@ DISPLAY_ORIENTATION_NORMAL
No rotation.
Definition display.h:279
@ DISPLAY_ORIENTATION_ROTATED_270
Rotated 270 degrees clockwise.
Definition display.h:282
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
#define ENOSYS
Function not implemented.
Definition errno.h:82
#define NULL
Definition iar_missing_defs.h:20
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:519
Structure to describe display data buffer layout.
Definition display.h:302
uint16_t pitch
Number of pixels between consecutive rows in the data buffer.
Definition display.h:310
bool frame_incomplete
Indicates that this is not the last write buffer of the frame.
Definition display.h:312
uint16_t height
Data buffer column height in pixels.
Definition display.h:308
uint16_t width
Data buffer row width in pixels.
Definition display.h:306
uint32_t buf_size
Data buffer size in bytes.
Definition display.h:304
Structure holding display capabilities.
Definition display.h:286
uint32_t supported_pixel_formats
Bitwise or of pixel formats supported by the display.
Definition display.h:292
uint16_t x_resolution
Display resolution in the X direction.
Definition display.h:288
enum display_orientation current_orientation
Current display orientation.
Definition display.h:298
uint16_t y_resolution
Display resolution in the Y direction.
Definition display.h:290
uint32_t screen_info
Information about display panel.
Definition display.h:294
enum display_pixel_format current_pixel_format
Currently active pixel format for the display.
Definition display.h:296
<span class="mlabel">Driver Operations</span> Display driver operations
Definition display.h:474
display_blanking_off_api blanking_off
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:482
display_register_event_cb_api register_event_cb
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:522
display_set_pixel_format_api set_pixel_format
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:514
display_read_api read
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:490
display_set_orientation_api set_orientation
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:518
display_write_api write
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition display.h:486
display_unregister_event_cb_api unregister_event_cb
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:526
display_clear_api clear
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:494
display_set_brightness_api set_brightness
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:502
display_get_framebuffer_api get_framebuffer
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:498
display_blanking_on_api blanking_on
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:478
display_get_capabilities_api get_capabilities
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition display.h:510
display_set_contrast_api set_contrast
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition display.h:506
Display event payload.
Definition display.h:316
uint64_t timestamp
Timestamp to differentiate between events of the same type.
Definition display.h:320
union display_event_data::@254130275177060223307037326371161170306162100075 info
Event info passed by driver to callback.
int buffer_id
For DISPLAY_EVENT_FRAME_DONE events, set to -1 if unavailable.
Definition display.h:326
int line
For DISPLAY_EVENT_LINE_INT events, set to -1 if unavailable.
Definition display.h:324