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,58 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <tactility/drivers/pwm.h>
|
||||
#include <tactility/device.h>
|
||||
|
||||
#define PWM_DRIVER_API(driver) ((struct PwmApi*)driver->api)
|
||||
|
||||
extern "C" {
|
||||
|
||||
error_t pwm_set_period(Device* device, uint32_t period_ns) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->set_period(device, period_ns);
|
||||
}
|
||||
|
||||
error_t pwm_get_period(Device* device, uint32_t* period_ns) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->get_period(device, period_ns);
|
||||
}
|
||||
|
||||
error_t pwm_set_duty(Device* device, uint32_t duty_ns) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->set_duty(device, duty_ns);
|
||||
}
|
||||
|
||||
error_t pwm_get_duty(Device* device, uint32_t* duty_ns) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->get_duty(device, duty_ns);
|
||||
}
|
||||
|
||||
error_t pwm_set_inverted(Device* device, bool inverted) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->set_inverted(device, inverted);
|
||||
}
|
||||
|
||||
error_t pwm_is_inverted(Device* device, bool* inverted) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->is_inverted(device, inverted);
|
||||
}
|
||||
|
||||
error_t pwm_enable(Device* device) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->enable(device);
|
||||
}
|
||||
|
||||
error_t pwm_disable(Device* device) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->disable(device);
|
||||
}
|
||||
|
||||
error_t pwm_is_enabled(Device* device, bool* enabled) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return PWM_DRIVER_API(driver)->is_enabled(device, enabled);
|
||||
}
|
||||
|
||||
const DeviceType PWM_TYPE {
|
||||
.name = "pwm"
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user