Device migrations, new drivers, cleanup (#567)
* **New Features** * Added native display support for ST7796, ILI9341, and ST7789 panels across supported boards. * Added FT5x06 and FT6x36 touchscreen support. * Generic PWM driver * ESP32 PWM driver * Generic RGB LED driver * RGB PWM LED driver * RGB GPIO LED driver * Implementation of RGB LED for various boards * **Improvements** * Updated board hardware descriptions to use explicit display/touch/backlight device-tree bindings and disabled deprecated HAL usage. * Improved display and touch-driver cleanup to prevent stale resources and improve shutdown reliability. * Pinned esp-hosted library to a fixed version * **Deletions** * Obsolete placeholder display * Legacy ILI9488 support. * ESP32-specific LEDC PWM implementation
This commit is contained in:
committed by
GitHub
parent
6fb2bb736c
commit
3b5a401594
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <tactility/bindings/bindings.h>
|
||||
#include <tactility/drivers/gpio_backlight.h>
|
||||
|
||||
DEFINE_DEVICETREE(gpio_backlight, struct GpioBacklightConfig)
|
||||
@@ -1,15 +0,0 @@
|
||||
// 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,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <tactility/bindings/bindings.h>
|
||||
#include <tactility/drivers/pwm_backlight.h>
|
||||
|
||||
DEFINE_DEVICETREE(pwm_backlight, struct PwmBacklightConfig)
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <tactility/bindings/bindings.h>
|
||||
#include <tactility/drivers/rgb_led_gpio.h>
|
||||
|
||||
DEFINE_DEVICETREE(rgb_led_gpio, struct RgbLedGpioConfig)
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <tactility/bindings/bindings.h>
|
||||
#include <tactility/drivers/rgb_led_pwm.h>
|
||||
|
||||
DEFINE_DEVICETREE(rgb_led_pwm, struct RgbLedPwmConfig)
|
||||
@@ -1,15 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <tactility/bindings/bindings.h>
|
||||
#include <tactility/drivers/spi_peripheral.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DEFINE_DEVICETREE(spi_peripheral, struct SpiPeripheralConfig)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <tactility/drivers/gpio.h>
|
||||
|
||||
/**
|
||||
* @brief Devicetree configuration for a GPIO-driven on/off backlight.
|
||||
*/
|
||||
struct GpioBacklightConfig {
|
||||
/** Backlight enable output pin */
|
||||
struct GpioPinSpec pin;
|
||||
/** Whether the backlight is turned on by set_brightness_default() */
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct PointerPlaceholderConfig {
|
||||
uint8_t _unused;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,150 @@
|
||||
// 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 Devicetree configuration for a PWM device.
|
||||
*/
|
||||
struct PwmConfig {
|
||||
/** The PWM period, in nanoseconds */
|
||||
uint32_t period_ns;
|
||||
/** The PWM duty cycle (active time within one period), in nanoseconds */
|
||||
uint32_t duty_ns;
|
||||
/** Whether the output polarity is inverted */
|
||||
bool inverted;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief API for PWM drivers.
|
||||
*/
|
||||
struct PwmApi {
|
||||
/**
|
||||
* @brief Sets the PWM period.
|
||||
* @param[in] device the PWM device
|
||||
* @param[in] period_ns the period, in nanoseconds
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*set_period)(struct Device* device, uint32_t period_ns);
|
||||
|
||||
/**
|
||||
* @brief Gets the PWM period.
|
||||
* @param[in] device the PWM device
|
||||
* @param[out] period_ns the period, in nanoseconds
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*get_period)(struct Device* device, uint32_t* period_ns);
|
||||
|
||||
/**
|
||||
* @brief Sets the PWM duty cycle.
|
||||
* @param[in] device the PWM device
|
||||
* @param[in] duty_ns the active time within one period, in nanoseconds
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*set_duty)(struct Device* device, uint32_t duty_ns);
|
||||
|
||||
/**
|
||||
* @brief Gets the PWM duty cycle.
|
||||
* @param[in] device the PWM device
|
||||
* @param[out] duty_ns the active time within one period, in nanoseconds
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*get_duty)(struct Device* device, uint32_t* duty_ns);
|
||||
|
||||
/**
|
||||
* @brief Sets whether the output polarity is inverted.
|
||||
* @param[in] device the PWM device
|
||||
* @param[in] inverted true to invert the output polarity
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*set_inverted)(struct Device* device, bool inverted);
|
||||
|
||||
/**
|
||||
* @brief Gets whether the output polarity is inverted.
|
||||
* @param[in] device the PWM device
|
||||
* @param[out] inverted true when the output polarity is inverted
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*is_inverted)(struct Device* device, bool* inverted);
|
||||
|
||||
/**
|
||||
* @brief Enables the PWM output.
|
||||
* @param[in] device the PWM device
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*enable)(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Disables the PWM output.
|
||||
* @param[in] device the PWM device
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*disable)(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Gets whether the PWM output is enabled.
|
||||
* @param[in] device the PWM device
|
||||
* @param[out] enabled true when the output is enabled
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*is_enabled)(struct Device* device, bool* enabled);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Sets the PWM period using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_set_period(struct Device* device, uint32_t period_ns);
|
||||
|
||||
/**
|
||||
* @brief Gets the PWM period using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_get_period(struct Device* device, uint32_t* period_ns);
|
||||
|
||||
/**
|
||||
* @brief Sets the PWM duty cycle using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_set_duty(struct Device* device, uint32_t duty_ns);
|
||||
|
||||
/**
|
||||
* @brief Gets the PWM duty cycle using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_get_duty(struct Device* device, uint32_t* duty_ns);
|
||||
|
||||
/**
|
||||
* @brief Sets whether the output polarity is inverted using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_set_inverted(struct Device* device, bool inverted);
|
||||
|
||||
/**
|
||||
* @brief Gets whether the output polarity is inverted using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_is_inverted(struct Device* device, bool* inverted);
|
||||
|
||||
/**
|
||||
* @brief Enables the PWM output using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_enable(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Disables the PWM output using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_disable(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Gets whether the PWM output is enabled using the specified PWM device.
|
||||
*/
|
||||
error_t pwm_is_enabled(struct Device* device, bool* enabled);
|
||||
|
||||
extern const struct DeviceType PWM_TYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/backlight.h>
|
||||
|
||||
/**
|
||||
* @brief Devicetree configuration for a PWM-driven backlight.
|
||||
*/
|
||||
struct PwmBacklightConfig {
|
||||
/** The PWM device driving the backlight */
|
||||
struct Device* pwm;
|
||||
/** Inclusive [min,max] brightness range. The minimum value turns the backlight off. */
|
||||
struct BrightnessLevelRange brightness_range;
|
||||
/** Default brightness level, applied by set_brightness_default() */
|
||||
uint8_t brightness_default;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
// 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 An RGB color value.
|
||||
*/
|
||||
struct RgbLedColor {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief API for RGB LED drivers.
|
||||
*/
|
||||
struct RgbLedApi {
|
||||
/**
|
||||
* @brief Sets the LED color.
|
||||
* @param[in] device the RGB LED device
|
||||
* @param[in] color the color to set
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*set_color)(struct Device* device, const struct RgbLedColor color);
|
||||
|
||||
/**
|
||||
* @brief Gets the LED color.
|
||||
* @param[in] device the RGB LED device
|
||||
* @param[out] out_color the current color
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*get_color)(struct Device* device, struct RgbLedColor* out_color);
|
||||
|
||||
/**
|
||||
* @brief Enables the LED output.
|
||||
* @param[in] device the RGB LED device
|
||||
* @retval ERROR_NONE when the operation was successful
|
||||
*/
|
||||
error_t (*enable)(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Disables the LED output.
|
||||
* @param[in] device the RGB LED device
|
||||
*/
|
||||
void (*disable)(struct Device* device);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Sets the LED color using the specified RGB LED device.
|
||||
*/
|
||||
error_t rgb_led_set_color(struct Device* device, struct RgbLedColor color);
|
||||
|
||||
/**
|
||||
* @brief Gets the LED color using the specified RGB LED device.
|
||||
*/
|
||||
error_t rgb_led_get_color(struct Device* device, struct RgbLedColor* out_color);
|
||||
|
||||
/**
|
||||
* @brief Enables the LED output using the specified RGB LED device.
|
||||
*/
|
||||
error_t rgb_led_enable(struct Device* device);
|
||||
|
||||
/**
|
||||
* @brief Disables the LED output using the specified RGB LED device.
|
||||
*/
|
||||
void rgb_led_disable(struct Device* device);
|
||||
|
||||
extern const struct DeviceType RGB_LED_TYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <tactility/drivers/gpio.h>
|
||||
#include <tactility/drivers/rgb_led.h>
|
||||
|
||||
/**
|
||||
* @brief Devicetree configuration for the GPIO-driven RGB LED.
|
||||
*/
|
||||
struct RgbLedGpioConfig {
|
||||
/** Red channel output pin */
|
||||
struct GpioPinSpec pin_red;
|
||||
/** Green channel output pin */
|
||||
struct GpioPinSpec pin_green;
|
||||
/** Blue channel output pin */
|
||||
struct GpioPinSpec pin_blue;
|
||||
/** Whether the LED is turned on by default */
|
||||
bool enabled;
|
||||
/** Color applied when the LED is turned on by default */
|
||||
struct RgbLedColor default_color;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/rgb_led.h>
|
||||
|
||||
/**
|
||||
* @brief Devicetree configuration for the PWM-driven RGB LED.
|
||||
*/
|
||||
struct RgbLedPwmConfig {
|
||||
/** PWM device driving the red channel */
|
||||
struct Device* pwm_red;
|
||||
/** PWM device driving the green channel */
|
||||
struct Device* pwm_green;
|
||||
/** PWM device driving the blue channel */
|
||||
struct Device* pwm_blue;
|
||||
/** Whether the LED is turned on by default */
|
||||
bool enabled;
|
||||
/** Color applied when the LED is turned on by default */
|
||||
struct RgbLedColor default_color;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,19 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tactility/device.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct SpiPeripheralConfig {
|
||||
uint8_t _unused;
|
||||
};
|
||||
|
||||
extern const struct DeviceType SPI_PERIPHERAL_TYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user