Files
tactility/TactilityKernel/source/drivers/adc_controller.cpp
T
Ken Van Hoeylandt 50c0a14a93 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
2026-07-12 00:29:12 +02:00

23 lines
735 B
C++

// SPDX-License-Identifier: Apache-2.0
#include <tactility/drivers/adc_controller.h>
#include <tactility/device.h>
#define ADC_CONTROLLER_DRIVER_API(driver) ((struct AdcControllerApi*)driver->api)
extern "C" {
error_t adc_controller_read_raw(Device* device, uint8_t channel, int* out_raw, TickType_t timeout) {
const auto* driver = device_get_driver(device);
return ADC_CONTROLLER_DRIVER_API(driver)->read_raw(device, channel, out_raw, timeout);
}
error_t adc_channel_read_raw(const struct AdcChannelSpec* spec, int* out_raw, TickType_t timeout) {
return adc_controller_read_raw(spec->adc_controller, spec->channel, out_raw, timeout);
}
const struct DeviceType ADC_CONTROLLER_TYPE {
.name = "adc-controller"
};
}