New kernel drivers and more (#560)

- Added kernel base drivers for: display, pointer (touch, mouse, etc.), keyboard, adc, power supply and backlight
- Implement new kernel driver modules: `st7789-module` and `gt911-module`
- Implement ESP32 ADC "oneshot" kernel driver
- Implement ESP32  backlight kernel driver with ledc API
- Implemented `battery-sense` driver that allows for voltage measurement and creates a power supply child device
- Updated github actions
- Updated flash scripts
- Fix for esp32 legacy driver conflict with ADC
- Created separate `lilygo-tdeck` and `lilygo-tdeck-plus` devices
- Created `lilygo-module` with LilyGO kernel drivers
- Fix for intermittent errors in build related to code generation of `devicetree.c`
- `lvgl-module` can now map kernel drivers onto LVGL devices
- Created `KernelDisplayApp` as a mirror of `HalDisplayApp` (formerly `DisplayApp`)
- Removed `struct` and `enum` prefix in a lot of kernel driver cpp source files
- `lilygo-tdeck` and `lilygo-tdeck-plus` are now fully relying on kernel drivers and don't use any of the old HAL
This commit is contained in:
Ken Van Hoeylandt
2026-07-12 00:29:12 +02:00
committed by GitHub
parent c4406b24ba
commit 50c0a14a93
149 changed files with 5274 additions and 1266 deletions
@@ -2,13 +2,13 @@
#pragma once
#include <tactility/bindings/bindings.h>
#include <tactility/drivers/touch_placeholder.h>
#include <tactility/drivers/battery_sense.h>
#ifdef __cplusplus
extern "C" {
#endif
DEFINE_DEVICETREE(touch_placeholder, struct TouchPlaceholderConfig)
DEFINE_DEVICETREE(battery_sense, struct BatterySenseConfig)
#ifdef __cplusplus
}
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <tactility/bindings/bindings.h>
#include <tactility/drivers/pointer_placeholder.h>
#ifdef __cplusplus
extern "C" {
#endif
DEFINE_DEVICETREE(pointer_placeholder, struct PointerPlaceholderConfig)
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
struct Device;
#define ADC_CHANNEL_SPEC_NONE ((struct AdcChannelSpec) { NULL, 0 })
/** The index of a channel on an ADC controller */
typedef uint8_t adc_channel_index_t;
/**
* Specifies a channel on a specific ADC controller.
* Used by the devicetree, drivers and application code to refer to ADC channels.
*/
struct AdcChannelSpec {
/** ADC device controlling the channel */
struct Device* adc_controller;
/** The channel's index on the device */
adc_channel_index_t channel;
};
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "adc.h"
#include <tactility/freertos/freertos.h>
#include <tactility/error.h>
struct Device;
/**
* @brief API for ADC controller drivers.
*/
struct AdcControllerApi {
/**
* @brief Reads the raw conversion result of an ADC channel.
* @param[in] device the ADC controller device
* @param[in] channel the channel index to read
* @param[out] out_raw the raw conversion result
* @param[in] timeout the maximum time to wait for the operation to complete
* @retval ERROR_NONE when the read operation was successful
* @retval ERROR_OUT_OF_RANGE when the channel index is not configured
* @retval ERROR_TIMEOUT when the operation timed out
*/
error_t (*read_raw)(struct Device* device, uint8_t channel, int* out_raw, TickType_t timeout);
};
/**
* @brief Reads the raw conversion result of an ADC channel using the specified controller.
* @param[in] device the ADC controller device
* @param[in] channel the channel index to read
* @param[out] out_raw the raw conversion result
* @param[in] timeout the maximum time to wait for the operation to complete
* @retval ERROR_NONE when the read operation was successful
*/
error_t adc_controller_read_raw(struct Device* device, uint8_t channel, int* out_raw, TickType_t timeout);
/**
* @brief Reads the raw conversion result of the ADC channel described by the given spec.
* @param[in] spec the channel spec, as acquired from a devicetree phandle reference (e.g. `<&adc0 3>`)
* @param[out] out_raw the raw conversion result
* @param[in] timeout the maximum time to wait for the operation to complete
* @retval ERROR_NONE when the read operation was successful
*/
error_t adc_channel_read_raw(const struct AdcChannelSpec* spec, int* out_raw, TickType_t timeout);
extern const struct DeviceType ADC_CONTROLLER_TYPE;
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,96 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <tactility/device.h>
#include <tactility/error.h>
/**
* @brief Inclusive range of brightness levels accepted by a backlight driver.
*/
struct BrightnessLevelRange {
uint8_t min;
uint8_t max;
};
/**
* @brief API for backlight drivers.
*
* @note The minimum brightness level (see get_min_brightness()) turns the backlight fully off.
* There is no separate on/off control: to turn the backlight off, call set_brightness() with
* the minimum value; to turn it back on, set any value above the minimum.
*/
struct BacklightApi {
/**
* @brief Sets the backlight brightness.
* @param[in] device the backlight device
* @param[in] brightness the brightness level, expected to be within [get_min_brightness(), get_max_brightness()]
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_brightness)(struct Device* device, uint8_t brightness);
/**
* @brief Sets the backlight brightness to its devicetree-configured default level.
* @param[in] device the backlight device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_brightness_default)(struct Device* device);
/**
* @brief Gets the current backlight brightness.
* @param[in] device the backlight device
* @param[out] out_brightness the current brightness level
* @retval ERROR_NONE when the operation was successful
*/
error_t (*get_brightness)(struct Device* device, uint8_t* out_brightness);
/**
* @brief Gets the minimum brightness level. Setting the brightness to this value turns the backlight off.
* @param[in] device the backlight device
* @return the minimum brightness level
*/
uint8_t (*get_min_brightness)(struct Device* device);
/**
* @brief Gets the maximum (full-strength) brightness level.
* @param[in] device the backlight device
* @return the maximum brightness level
*/
uint8_t (*get_max_brightness)(struct Device* device);
};
/**
* @brief Sets the backlight brightness using the specified backlight device.
*/
error_t backlight_set_brightness(struct Device* device, uint8_t brightness);
/**
* @brief Sets the backlight brightness to its devicetree-configured default level using the specified backlight device.
*/
error_t backlight_set_brightness_default(struct Device* device);
/**
* @brief Gets the current backlight brightness using the specified backlight device.
*/
error_t backlight_get_brightness(struct Device* device, uint8_t* out_brightness);
/**
* @brief Gets the minimum brightness level using the specified backlight device. This level turns the backlight off.
*/
uint8_t backlight_get_min_brightness(struct Device* device);
/**
* @brief Gets the maximum brightness level using the specified backlight device.
*/
uint8_t backlight_get_max_brightness(struct Device* device);
extern const struct DeviceType BACKLIGHT_TYPE;
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <tactility/drivers/adc.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct BatterySenseConfig {
/** The ADC channel connected to the battery sense circuit */
struct AdcChannelSpec io_channel;
/** The ADC's effective full-scale reference voltage at the channel's configured attenuation, in mV */
uint32_t reference_voltage_mv;
/** Voltage divider correction factor, fixed-point with 3 decimals (1000 = 1.000, i.e. no division) */
uint32_t multiplier;
};
#ifdef __cplusplus
}
#endif
@@ -5,7 +5,253 @@
extern "C" {
#endif
#include <stdint.h>
#include <tactility/device.h>
#include <tactility/error.h>
/**
* @brief Pixel color formats supported by display panel drivers.
*/
enum DisplayColorFormat {
DISPLAY_COLOR_FORMAT_MONOCHROME = 0x0, // 1 bpp
DISPLAY_COLOR_FORMAT_BGR565 = 0x1,
DISPLAY_COLOR_FORMAT_BGR565_SWAPPED = 0x2,
DISPLAY_COLOR_FORMAT_RGB565 = 0x3,
DISPLAY_COLOR_FORMAT_RGB565_SWAPPED = 0x4,
DISPLAY_COLOR_FORMAT_RGB888 = 0x5,
};
/**
* @brief API for display panel drivers.
*/
struct DisplayApi {
/**
* @brief Performs a hardware reset of the panel (e.g. toggling a reset GPIO).
* @param[in] device the display device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*reset)(struct Device* device);
/**
* @brief Sends the panel's initialization command sequence. Call after reset().
* @param[in] device the display device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*init)(struct Device* device);
/**
* @brief Draws pixel data into the given rectangle.
* @param[in] device the display device
* @param[in] x_start left edge (inclusive)
* @param[in] y_start top edge (inclusive)
* @param[in] x_end right edge (exclusive)
* @param[in] y_end bottom edge (exclusive)
* @param[in] color_data pixel data in the panel's configured color format
* @retval ERROR_NONE when the operation was successful
*/
error_t (*draw_bitmap)(struct Device* device, int32_t x_start, int32_t y_start, int32_t x_end, int32_t y_end, const void* color_data);
/**
* @brief Mirrors the image along the X and/or Y axis.
* @param[in] device the display device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*mirror)(struct Device* device, bool x_axis, bool y_axis);
/**
* @brief Swaps the X and Y axes (rotates the coordinate system).
* @param[in] device the display device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*swap_xy)(struct Device* device, bool swap_axes);
/**
* @brief Gets whether the X and Y axes are currently swapped.
* @param[in] device the display device
* @return true if swapped
*/
bool (*get_swap_xy)(struct Device* device);
/**
* @brief Gets whether the X axis is currently mirrored.
* @param[in] device the display device
* @return true if mirrored
*/
bool (*get_mirror_x)(struct Device* device);
/**
* @brief Gets whether the Y axis is currently mirrored.
* @param[in] device the display device
* @return true if mirrored
*/
bool (*get_mirror_y)(struct Device* device);
/**
* @brief Sets a coordinate offset applied to all draw operations.
* @param[in] device the display device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_gap)(struct Device* device, int32_t x_gap, int32_t y_gap);
/**
* @brief Inverts the panel's color output.
* @param[in] device the display device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*invert_color)(struct Device* device, bool invert_color_data);
/**
* @brief Turns the panel's display output on or off.
* @param[in] device the display device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*disp_on_off)(struct Device* device, bool on_off);
/**
* @brief Puts the panel into or out of its low-power sleep mode.
* @param[in] device the display device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*disp_sleep)(struct Device* device, bool sleep);
/**
* @brief Gets the panel's pixel color format.
* @param[in] device the display device
* @return the color format
*/
enum DisplayColorFormat (*get_color_format)(struct Device* device);
/**
* @brief Gets the panel's horizontal resolution in pixels.
* @param[in] device the display device
* @return the horizontal resolution
*/
uint16_t (*get_resolution_x)(struct Device* device);
/**
* @brief Gets the panel's vertical resolution in pixels.
* @param[in] device the display device
* @return the vertical resolution
*/
uint16_t (*get_resolution_y)(struct Device* device);
/**
* @brief Gets a pointer to one of the panel's frame buffers, for panels that expose direct frame buffer access.
* @param[in] device the display device
* @param[in] index the frame buffer index (see get_frame_buffer_count())
* @param[out] out_buffer the buffer pointer
*/
void (*get_frame_buffer)(struct Device* device, uint8_t index, void** out_buffer);
/**
* @brief Gets the number of frame buffers exposed by the panel via get_frame_buffer(). 0 when unsupported.
* @param[in] device the display device
* @return the frame buffer count
*/
uint8_t (*get_frame_buffer_count)(struct Device* device);
/**
* @brief Gets the backlight device associated with this display, if any.
* @param[in] device the display device
* @param[out] backlight the associated backlight device
* @retval ERROR_NONE when a backlight is available and *backlight was set
* @retval ERROR_NOT_SUPPORTED when this display has no associated backlight
*/
error_t (*get_backlight)(struct Device* device, struct Device** backlight);
};
/**
* @brief Performs a hardware reset of the panel using the specified display.
*/
error_t display_reset(struct Device* device);
/**
* @brief Sends the panel's initialization command sequence using the specified display.
*/
error_t display_init(struct Device* device);
/**
* @brief Draws pixel data into the given rectangle using the specified display.
*/
error_t display_draw_bitmap(struct Device* device, int32_t x_start, int32_t y_start, int32_t x_end, int32_t y_end, const void* color_data);
/**
* @brief Mirrors the image along the X and/or Y axis using the specified display.
*/
error_t display_mirror(struct Device* device, bool x_axis, bool y_axis);
/**
* @brief Swaps the X and Y axes using the specified display.
*/
error_t display_swap_xy(struct Device* device, bool swap_axes);
/**
* @brief Gets whether the X and Y axes are currently swapped using the specified display.
*/
bool display_get_swap_xy(struct Device* device);
/**
* @brief Gets whether the X axis is currently mirrored using the specified display.
*/
bool display_get_mirror_x(struct Device* device);
/**
* @brief Gets whether the Y axis is currently mirrored using the specified display.
*/
bool display_get_mirror_y(struct Device* device);
/**
* @brief Sets a coordinate offset applied to all draw operations using the specified display.
*/
error_t display_set_gap(struct Device* device, int32_t x_gap, int32_t y_gap);
/**
* @brief Inverts the panel's color output using the specified display.
*/
error_t display_invert_color(struct Device* device, bool invert_color_data);
/**
* @brief Turns the panel's display output on or off using the specified display.
*/
error_t display_disp_on_off(struct Device* device, bool on_off);
/**
* @brief Puts the panel into or out of its low-power sleep mode using the specified display.
*/
error_t display_disp_sleep(struct Device* device, bool sleep);
/**
* @brief Gets the pixel color format using the specified display.
*/
enum DisplayColorFormat display_get_color_format(struct Device* device);
/**
* @brief Gets the horizontal resolution in pixels using the specified display.
*/
uint16_t display_get_resolution_x(struct Device* device);
/**
* @brief Gets the vertical resolution in pixels using the specified display.
*/
uint16_t display_get_resolution_y(struct Device* device);
/**
* @brief Gets a pointer to one of the panel's frame buffers using the specified display.
*/
void display_get_frame_buffer(struct Device* device, uint8_t index, void** out_buffer);
/**
* @brief Gets the number of frame buffers exposed by the panel using the specified display.
*/
uint8_t display_get_frame_buffer_count(struct Device* device);
/**
* @brief Gets the backlight device associated with the specified display, if any.
* @retval ERROR_NONE when a backlight is available and *backlight was set
* @retval ERROR_NOT_SUPPORTED when the display has no associated backlight
*/
error_t display_get_backlight(struct Device* device, struct Device** backlight);
extern const struct DeviceType DISPLAY_TYPE;
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include <tactility/device.h>
#include <tactility/error.h>
/**
* @brief A single key event read from a keyboard device.
*/
struct KeyboardKeyData {
/** @brief The key code. Driver-defined (e.g. ASCII/UTF-8 codepoint, scan code, or LVGL key code). */
uint32_t key;
/** @brief True if the key was pressed, false if released. */
bool pressed;
/**
* @brief True if another key event is already queued and read_key() should be called again
* immediately to drain it. False if this was the last pending event.
*/
bool continue_reading;
};
/**
* @brief API for keyboard drivers.
*/
struct KeyboardApi {
/**
* @brief Reads the next pending key event, if any.
* @param[in] device the keyboard device
* @param[out] data the key event data
* @retval ERROR_NONE when the operation was successful
*/
error_t (*read_key)(struct Device* device, struct KeyboardKeyData* data);
};
/**
* @brief Reads the next pending key event using the specified keyboard device.
*/
error_t keyboard_read_key(struct Device* device, struct KeyboardKeyData* data);
extern const struct DeviceType KEYBOARD_TYPE;
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,151 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <tactility/device.h>
#include <tactility/error.h>
#include <tactility/freertos/freertos.h>
/**
* @brief API for pointer controller drivers.
*/
struct PointerApi {
/**
* @brief Puts the pointer controller into its low-power sleep mode.
* @param[in] device the pointer device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*enter_sleep)(struct Device* device);
/**
* @brief Wakes the pointer controller from sleep mode.
* @param[in] device the pointer device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*exit_sleep)(struct Device* device);
/**
* @brief Performs a blocking read of the latest touch data from the controller into its internal state.
* Call this before get_touched_points().
* @param[in] device the pointer device
* @param[in] timeout the maximum time to wait for the operation to complete
* @retval ERROR_NONE when the read operation was successful
* @retval ERROR_TIMEOUT when the operation timed out
*/
error_t (*read_data)(struct Device* device, TickType_t timeout);
/**
* @brief Retrieves the coordinates most recently read by read_data().
* @param[in] device the pointer device
* @param[out] x array of X coordinates
* @param[out] y array of Y coordinates
* @param[out] strength optional array of touch strengths (nullable)
* @param[out] point_count the number of points currently touched
* @param[in] max_point_count the maximum number of points the arrays can hold
* @return true when touched and coordinates are available
*/
bool (*get_touched_points)(struct Device* device, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* point_count, uint8_t max_point_count);
/**
* @brief Sets whether the X and Y axes should be swapped.
* @param[in] device the pointer device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_swap_xy)(struct Device* device, bool swap);
/**
* @brief Gets whether the X and Y axes are swapped.
* @param[in] device the pointer device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*get_swap_xy)(struct Device* device, bool* swap);
/**
* @brief Sets whether the X axis should be mirrored.
* @param[in] device the pointer device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_mirror_x)(struct Device* device, bool mirror);
/**
* @brief Gets whether the X axis is mirrored.
* @param[in] device the pointer device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*get_mirror_x)(struct Device* device, bool* mirror);
/**
* @brief Sets whether the Y axis should be mirrored.
* @param[in] device the pointer device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_mirror_y)(struct Device* device, bool mirror);
/**
* @brief Gets whether the Y axis is mirrored.
* @param[in] device the pointer device
* @retval ERROR_NONE when the operation was successful
*/
error_t (*get_mirror_y)(struct Device* device, bool* mirror);
};
/**
* @brief Puts the pointer controller into its low-power sleep mode using the specified pointer device.
*/
error_t pointer_enter_sleep(struct Device* device);
/**
* @brief Wakes the pointer controller from sleep mode using the specified pointer device.
*/
error_t pointer_exit_sleep(struct Device* device);
/**
* @brief Performs a blocking read of the latest touch data using the specified pointer device.
*/
error_t pointer_read_data(struct Device* device, TickType_t timeout);
/**
* @brief Retrieves the coordinates most recently read using the specified pointer device.
*/
bool pointer_get_touched_points(struct Device* device, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* point_count, uint8_t max_point_count);
/**
* @brief Sets whether the X and Y axes should be swapped using the specified pointer device.
*/
error_t pointer_set_swap_xy(struct Device* device, bool swap);
/**
* @brief Gets whether the X and Y axes are swapped using the specified pointer device.
*/
error_t pointer_get_swap_xy(struct Device* device, bool* swap);
/**
* @brief Sets whether the X axis should be mirrored using the specified pointer device.
*/
error_t pointer_set_mirror_x(struct Device* device, bool mirror);
/**
* @brief Gets whether the X axis is mirrored using the specified pointer device.
*/
error_t pointer_get_mirror_x(struct Device* device, bool* mirror);
/**
* @brief Sets whether the Y axis should be mirrored using the specified pointer device.
*/
error_t pointer_set_mirror_y(struct Device* device, bool mirror);
/**
* @brief Gets whether the Y axis is mirrored using the specified pointer device.
*/
error_t pointer_get_mirror_y(struct Device* device, bool* mirror);
extern const struct DeviceType POINTER_TYPE;
#ifdef __cplusplus
}
#endif
@@ -7,7 +7,7 @@
extern "C" {
#endif
struct TouchPlaceholderConfig {
struct PointerPlaceholderConfig {
uint8_t _unused;
};
@@ -0,0 +1,163 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <stdint.h>
#include <tactility/device.h>
#include <tactility/error.h>
/**
* @brief Properties that a power supply device can report.
*/
enum PowerSupplyProperty {
/** [0, 1]: whether the battery is currently charging */
POWER_SUPPLY_PROP_IS_CHARGING,
/** mA: battery current, positive while charging, negative while discharging */
POWER_SUPPLY_PROP_CURRENT,
/** mV: battery voltage */
POWER_SUPPLY_PROP_VOLTAGE,
/** [0, 100]: battery charge level */
POWER_SUPPLY_PROP_CAPACITY,
};
/**
* @brief Holds the value of a single power supply property.
*/
union PowerSupplyPropertyValue {
int int_value;
};
/**
* @brief API for power supply drivers.
*
* @note supports_charge_control(), supports_quick_charge() and supports_power_off() gate
* their respective functions: when a capability is not supported, the driver's implementation
* of the related getter/setter is expected to be a NO-OP (getters returning false/0).
*/
struct PowerSupplyApi {
/**
* @brief Checks whether a property is supported by this device.
* @param[in] device the power supply device
* @param[in] property the property to check
* @return true if the property is supported
*/
bool (*supports_property)(struct Device* device, enum PowerSupplyProperty property);
/**
* @brief Gets the current value of a property.
* @param[in] device the power supply device
* @param[in] property the property to read
* @param[out] out_value the property value
* @retval ERROR_NOT_SUPPORTED when the property is not supported
* @retval ERROR_NOT_FOUND when the property is (temporarily) not available
* @retval ERROR_NONE when the operation was successful
*/
error_t (*get_property)(struct Device* device, enum PowerSupplyProperty property, union PowerSupplyPropertyValue* out_value);
/**
* @brief Checks whether this device supports enabling/disabling charging.
*/
bool (*supports_charge_control)(struct Device* device);
/**
* @brief Checks whether charging is currently allowed.
*/
bool (*is_allowed_to_charge)(struct Device* device);
/**
* @brief Enables or disables charging.
* @retval ERROR_NOT_SUPPORTED when charge control is not supported
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_allowed_to_charge)(struct Device* device, bool allowed);
/**
* @brief Checks whether this device supports quick charging.
*/
bool (*supports_quick_charge)(struct Device* device);
/**
* @brief Checks whether quick charging is currently enabled.
*/
bool (*is_quick_charge_enabled)(struct Device* device);
/**
* @brief Enables or disables quick charging.
* @retval ERROR_NOT_SUPPORTED when quick charging is not supported
* @retval ERROR_NONE when the operation was successful
*/
error_t (*set_quick_charge_enabled)(struct Device* device, bool enabled);
/**
* @brief Checks whether this device can power off the system.
*/
bool (*supports_power_off)(struct Device* device);
/**
* @brief Powers off the system.
* @retval ERROR_NOT_SUPPORTED when power off is not supported
* @retval ERROR_NONE when the operation was successful (this call typically does not return)
*/
error_t (*power_off)(struct Device* device);
};
/**
* @brief Checks whether a property is supported using the specified power supply device.
*/
bool power_supply_supports_property(struct Device* device, enum PowerSupplyProperty property);
/**
* @brief Gets the current value of a property using the specified power supply device.
*/
error_t power_supply_get_property(struct Device* device, enum PowerSupplyProperty property, union PowerSupplyPropertyValue* out_value);
/**
* @brief Checks whether the specified power supply device supports enabling/disabling charging.
*/
bool power_supply_supports_charge_control(struct Device* device);
/**
* @brief Checks whether charging is currently allowed on the specified power supply device.
*/
bool power_supply_is_allowed_to_charge(struct Device* device);
/**
* @brief Enables or disables charging on the specified power supply device.
*/
error_t power_supply_set_allowed_to_charge(struct Device* device, bool allowed);
/**
* @brief Checks whether the specified power supply device supports quick charging.
*/
bool power_supply_supports_quick_charge(struct Device* device);
/**
* @brief Checks whether quick charging is currently enabled on the specified power supply device.
*/
bool power_supply_is_quick_charge_enabled(struct Device* device);
/**
* @brief Enables or disables quick charging on the specified power supply device.
*/
error_t power_supply_set_quick_charge_enabled(struct Device* device, bool enabled);
/**
* @brief Checks whether the specified power supply device can power off the system.
*/
bool power_supply_supports_power_off(struct Device* device);
/**
* @brief Powers off the system using the specified power supply device.
*/
error_t power_supply_power_off(struct Device* device);
extern const struct DeviceType POWER_SUPPLY_TYPE;
#ifdef __cplusplus
}
#endif
@@ -1,14 +0,0 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <tactility/device.h>
extern const struct DeviceType TOUCH_TYPE;
#ifdef __cplusplus
}
#endif