Device Drivers
This module summarizes LibXR's abstract interfaces for common hardware peripherals.
The common properties of these device interfaces are:
- Platform Independent: Abstract interfaces use unified naming and behavior, independent of low-level hardware registers or driver structures.
- Asynchronous Operation Support: The common operation model is based on
ReadPort/WritePort, and fits interrupt- and DMA-driven implementations. - Type Safety: Interface parameters and configuration structures use strong typing.
- Minimal Dependencies: Core modules rely only on C++17 features and basic LibXR components.
- Flexible Extension: Each peripheral can be implemented according to platform capabilities, including shared-resource cases such as shared buses.
Contents
- GPIO (General Purpose Input/Output)
- UART (Serial Communication)
- I2C (I2C Bus)
- SPI (SPI Interface)
- CAN / FDCAN (Controller Area Network)
- ADC (Analog-to-Digital Conversion)
- DAC (Digital-to-Analog Conversion)
- PWM (Pulse-Width Modulation)
- Flash (Flash Interface)
- Power (Power Management)
- Timebase (Time Base)
- Watchdog (Watchdog Timer)
- USB (Universal Serial Bus)
Interface structure
Each peripheral abstraction class typically includes:
- a
Configurationstructure - a
SetConfig()interface Read()/Write()data transfer interfacesEnable()/Disable()control interfaces, when applicableCallbackregistration for event handling, such as interrupts
Users do not need to care whether the backend is STM32UART, ESP32UART, or LinuxUART. Use the base class interface directly.