mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 02:45:05 +00:00
- Create `USB_HOST_TYPE` base driver in TactilityKernel - Refactor esp32_usbhost dts format, and create child devices dynamically - Use PSRAM for task stacks where possible: saving 20 kB from just the task stacks, but roughly 30 kB when nothing is connected. - Allow the user to disable USB host interface in the USB settings app, saving an additionaly 20 kB of IRAM when nothing was connected. - Change listener-based APIs to subscribe and poll/await pattern. This avoids callstacks of apps and services leaking into the USB API This results in big IRAM savings: 30 kB when USB host is on and nothing is connected, and 50 kB total when USB host is disabled. This brings the total free IRAM after boot from roughly 170 kB to 200 kB (host enabled) or 220 kB (host disabled).
26 lines
858 B
C++
26 lines
858 B
C++
#include <tactility/drivers/usb_host.h>
|
|
#include <tactility/device.h>
|
|
#include <tactility/driver.h>
|
|
|
|
#define USB_HOST_API(driver) ((struct UsbHostApi*)(driver)->api)
|
|
|
|
extern "C" {
|
|
|
|
const struct DeviceType USB_HOST_TYPE = {
|
|
.name = "usb-host",
|
|
};
|
|
|
|
error_t usb_host_is_class_supported(struct Device* host, enum UsbClass usb_class, bool* supported) {
|
|
return USB_HOST_API(device_get_driver(host))->is_class_supported(host, usb_class, supported);
|
|
}
|
|
|
|
error_t usb_host_set_class_enabled(struct Device* host, enum UsbClass usb_class, bool enabled) {
|
|
return USB_HOST_API(device_get_driver(host))->set_class_enabled(host, usb_class, enabled);
|
|
}
|
|
|
|
error_t usb_host_is_class_enabled(struct Device* host, enum UsbClass usb_class, bool* enabled) {
|
|
return USB_HOST_API(device_get_driver(host))->is_class_enabled(host, usb_class, enabled);
|
|
}
|
|
|
|
} // extern "C"
|