12#ifndef ZEPHYR_INCLUDE_DRIVERS_AUXDISPLAY_H_
13#define ZEPHYR_INCLUDE_DRIVERS_AUXDISPLAY_H_
34#define AUXDISPLAY_LIGHT_NOT_SUPPORTED 0
147typedef int (*auxdisplay_display_on_t)(
const struct device *dev);
154typedef int (*auxdisplay_display_off_t)(
const struct device *dev);
161typedef int (*auxdisplay_cursor_set_enabled_t)(
const struct device *dev,
bool enabled);
168typedef int (*auxdisplay_position_blinking_set_enabled_t)(
const struct device *dev,
176typedef int (*auxdisplay_cursor_shift_set_t)(
const struct device *dev,
uint8_t direction,
184typedef int (*auxdisplay_cursor_position_set_t)(
const struct device *dev,
193typedef int (*auxdisplay_cursor_position_get_t)(
const struct device *dev,
int16_t *x,
201typedef int (*auxdisplay_display_position_set_t)(
const struct device *dev,
210typedef int (*auxdisplay_display_position_get_t)(
const struct device *dev,
int16_t *x,
218typedef int (*auxdisplay_capabilities_get_t)(
const struct device *dev,
226typedef int (*auxdisplay_clear_t)(
const struct device *dev);
234typedef int (*auxdisplay_brightness_get_t)(
const struct device *dev,
uint8_t *brightness);
241typedef int (*auxdisplay_brightness_set_t)(
const struct device *dev,
uint8_t brightness);
249typedef int (*auxdisplay_backlight_get_t)(
const struct device *dev,
uint8_t *backlight);
256typedef int (*auxdisplay_backlight_set_t)(
const struct device *dev,
uint8_t backlight);
263typedef int (*auxdisplay_is_busy_t)(
const struct device *dev);
270typedef int (*auxdisplay_custom_character_set_t)(
const struct device *dev,
285typedef int (*auxdisplay_custom_command_t)(
const struct device *dev,
288__subsystem
struct auxdisplay_driver_api {
289 auxdisplay_display_on_t display_on;
290 auxdisplay_display_off_t display_off;
291 auxdisplay_cursor_set_enabled_t cursor_set_enabled;
292 auxdisplay_position_blinking_set_enabled_t position_blinking_set_enabled;
293 auxdisplay_cursor_shift_set_t cursor_shift_set;
294 auxdisplay_cursor_position_set_t cursor_position_set;
295 auxdisplay_cursor_position_get_t cursor_position_get;
296 auxdisplay_display_position_set_t display_position_set;
297 auxdisplay_display_position_get_t display_position_get;
298 auxdisplay_capabilities_get_t capabilities_get;
299 auxdisplay_clear_t clear;
300 auxdisplay_brightness_get_t brightness_get;
301 auxdisplay_brightness_set_t brightness_set;
302 auxdisplay_backlight_get_t backlight_get;
303 auxdisplay_backlight_set_t backlight_set;
304 auxdisplay_is_busy_t is_busy;
305 auxdisplay_custom_character_set_t custom_character_set;
306 auxdisplay_write_t write;
307 auxdisplay_custom_command_t custom_command;
325static inline int z_impl_auxdisplay_display_on(
const struct device *dev)
327 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
329 if (!api->display_on) {
333 return api->display_on(dev);
347static inline int z_impl_auxdisplay_display_off(
const struct device *dev)
349 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
351 if (!api->display_off) {
355 return api->display_off(dev);
371static inline int z_impl_auxdisplay_cursor_set_enabled(
const struct device *dev,
374 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
376 if (!api->cursor_set_enabled) {
380 return api->cursor_set_enabled(dev, enabled);
396static inline int z_impl_auxdisplay_position_blinking_set_enabled(
const struct device *dev,
399 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
401 if (!api->position_blinking_set_enabled) {
405 return api->position_blinking_set_enabled(dev, enabled);
422 uint8_t direction,
bool display_shift);
424static inline int z_impl_auxdisplay_cursor_shift_set(
const struct device *dev,
428 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
430 if (!api->cursor_shift_set) {
438 return api->cursor_shift_set(dev, direction, display_shift);
458static inline int z_impl_auxdisplay_cursor_position_set(
const struct device *dev,
462 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
464 if (!api->cursor_position_set) {
472 return api->cursor_position_set(dev, type, x, y);
490static inline int z_impl_auxdisplay_cursor_position_get(
const struct device *dev,
493 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
495 if (!api->cursor_position_get) {
499 return api->cursor_position_get(dev, x, y);
519static inline int z_impl_auxdisplay_display_position_set(
const struct device *dev,
523 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
525 if (!api->display_position_set) {
533 return api->display_position_set(dev, type, x, y);
551static inline int z_impl_auxdisplay_display_position_get(
const struct device *dev,
554 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
556 if (!api->display_position_get) {
560 return api->display_position_get(dev, x, y);
575static inline int z_impl_auxdisplay_capabilities_get(
const struct device *dev,
578 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
580 return api->capabilities_get(dev, capabilities);
595static inline int z_impl_auxdisplay_clear(
const struct device *dev)
597 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
599 return api->clear(dev);
615static inline int z_impl_auxdisplay_brightness_get(
const struct device *dev,
618 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
620 if (!api->brightness_get) {
624 return api->brightness_get(dev, brightness);
641static inline int z_impl_auxdisplay_brightness_set(
const struct device *dev,
644 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
646 if (!api->brightness_set) {
650 return api->brightness_set(dev, brightness);
666static inline int z_impl_auxdisplay_backlight_get(
const struct device *dev,
669 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
671 if (!api->backlight_get) {
675 return api->backlight_get(dev, backlight);
692static inline int z_impl_auxdisplay_backlight_set(
const struct device *dev,
695 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
697 if (!api->backlight_set) {
701 return api->backlight_set(dev, backlight);
716static inline int z_impl_auxdisplay_is_busy(
const struct device *dev)
718 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
724 return api->is_busy(dev);
750static inline int z_impl_auxdisplay_custom_character_set(
const struct device *dev,
753 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
755 if (!api->custom_character_set) {
759 return api->custom_character_set(dev, character);
776static inline int z_impl_auxdisplay_write(
const struct device *dev,
779 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
781 return api->write(dev, data, len);
798static inline int z_impl_auxdisplay_custom_command(
const struct device *dev,
801 struct auxdisplay_driver_api *api = (
struct auxdisplay_driver_api *)dev->
api;
803 if (!api->custom_command) {
807 return api->custom_command(dev, data);
818#include <zephyr/syscalls/auxdisplay.h>
int auxdisplay_display_position_set(const struct device *dev, enum auxdisplay_position type, int16_t x, int16_t y)
Set display position on an auxiliary display.
int auxdisplay_brightness_get(const struct device *dev, uint8_t *brightness)
Get the current brightness level of an auxiliary display.
int auxdisplay_display_position_get(const struct device *dev, int16_t *x, int16_t *y)
Get current display position on an auxiliary display.
int auxdisplay_write(const struct device *dev, const uint8_t *data, uint16_t len)
Write data to auxiliary display screen at current position.
int auxdisplay_backlight_set(const struct device *dev, uint8_t backlight)
Update the backlight level of an auxiliary display.
int auxdisplay_is_busy(const struct device *dev)
Check if an auxiliary display driver is busy.
int auxdisplay_brightness_set(const struct device *dev, uint8_t brightness)
Update the brightness level of an auxiliary display.
int auxdisplay_cursor_position_get(const struct device *dev, int16_t *x, int16_t *y)
Get current cursor on an auxiliary display.
int auxdisplay_capabilities_get(const struct device *dev, struct auxdisplay_capabilities *capabilities)
Fetch capabilities (and details) of auxiliary display.
auxdisplay_direction
Used for setting character append position.
Definition: auxdisplay.h:58
int auxdisplay_display_off(const struct device *dev)
Turn display off.
int auxdisplay_position_blinking_set_enabled(const struct device *dev, bool enabled)
Set cursor blinking status on an auxiliary display.
int auxdisplay_cursor_set_enabled(const struct device *dev, bool enabled)
Set cursor enabled status on an auxiliary display.
uint32_t auxdisplay_mode_t
Used to describe the mode of an auxiliary (text) display.
Definition: auxdisplay.h:37
int auxdisplay_custom_command(const struct device *dev, struct auxdisplay_custom_data *data)
Send a custom command to the display (if supported by driver)
auxdisplay_position
Used for moving the cursor or display position.
Definition: auxdisplay.h:40
int auxdisplay_cursor_position_set(const struct device *dev, enum auxdisplay_position type, int16_t x, int16_t y)
Set cursor (and write position) on an auxiliary display.
int auxdisplay_clear(const struct device *dev)
Clear display of auxiliary display and return to home position (note that this does not reset the dis...
int auxdisplay_custom_character_set(const struct device *dev, struct auxdisplay_character *character)
Sets a custom character in the display, the custom character struct must contain the pixel data for t...
int auxdisplay_backlight_get(const struct device *dev, uint8_t *backlight)
Get the backlight level details of an auxiliary display.
int auxdisplay_cursor_shift_set(const struct device *dev, uint8_t direction, bool display_shift)
Set cursor shift after character write and display shift.
int auxdisplay_display_on(const struct device *dev)
Turn display on.
@ AUXDISPLAY_DIRECTION_LEFT
Each character will be placed to the left of existing characters.
Definition: auxdisplay.h:63
@ AUXDISPLAY_DIRECTION_COUNT
Definition: auxdisplay.h:65
@ AUXDISPLAY_DIRECTION_RIGHT
Each character will be placed to the right of existing characters.
Definition: auxdisplay.h:60
@ AUXDISPLAY_POSITION_COUNT
Definition: auxdisplay.h:54
@ AUXDISPLAY_POSITION_ABSOLUTE
Moves to specified X,Y position.
Definition: auxdisplay.h:42
@ AUXDISPLAY_POSITION_RELATIVE
Shifts current position by +/- X,Y position, does not take display direction into consideration.
Definition: auxdisplay.h:47
@ AUXDISPLAY_POSITION_RELATIVE_DIRECTION
Shifts current position by +/- X,Y position, takes display direction into consideration.
Definition: auxdisplay.h:52
#define EINVAL
Invalid argument.
Definition: errno.h:60
#define ENOSYS
Function not implemented.
Definition: errno.h:82
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
__INT16_TYPE__ int16_t
Definition: stdint.h:73
Structure holding display capabilities.
Definition: auxdisplay.h:80
struct auxdisplay_light brightness
Brightness details for display (if supported)
Definition: auxdisplay.h:91
uint8_t custom_characters
Number of custom characters supported by display (0 if unsupported)
Definition: auxdisplay.h:97
auxdisplay_mode_t mode
Display-specific data (e.g.
Definition: auxdisplay.h:88
uint16_t columns
Number of character columns.
Definition: auxdisplay.h:82
struct auxdisplay_light backlight
Backlight details for display (if supported)
Definition: auxdisplay.h:94
uint8_t custom_character_width
Width (in pixels) of a custom character, supplied custom characters should match.
Definition: auxdisplay.h:100
uint8_t custom_character_height
Height (in pixels) of a custom character, supplied custom characters should match.
Definition: auxdisplay.h:103
uint16_t rows
Number of character rows.
Definition: auxdisplay.h:85
Structure for a custom character.
Definition: auxdisplay.h:119
uint8_t character_code
Will be updated with custom character index to use in the display write function to disaplay this cus...
Definition: auxdisplay.h:133
uint8_t * data
Custom character pixel data, a character must be valid for a display consisting of a uint8 array of s...
Definition: auxdisplay.h:128
uint8_t index
Custom character index on the display.
Definition: auxdisplay.h:121
Structure for a custom command.
Definition: auxdisplay.h:107
uint32_t options
Display-driver specific options for command.
Definition: auxdisplay.h:115
uint16_t len
Length of supplied data.
Definition: auxdisplay.h:112
uint8_t * data
Raw command data to be sent.
Definition: auxdisplay.h:109
Light levels for brightness and/or backlight.
Definition: auxdisplay.h:71
uint8_t minimum
Minimum light level supported.
Definition: auxdisplay.h:73
uint8_t maximum
Maximum light level supported.
Definition: auxdisplay.h:76
Runtime device structure (in ROM) per driver instance.
Definition: device.h:403
void * data
Address of the device instance private data.
Definition: device.h:413
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:409