VMT interface between upper and lower level HAL
Posted: Thu Apr 04, 2019 5:52 pm
I'm currently working on creating a driver for an external SPI to CAN device. I would like to use the hal_can abstraction, but the way HAL is currently designed is that it is directly linked to the hal_<device>_lld functions. I would like to use the HAL to be more than just bound to MCU built-in peripherals, and instead (or optionally extended?) to be able to use a virtual method table interface with the low level driver.
Calling LLD functions thru the VMT incurs extra redirection overhead which wouldn't always be desirable, so perhaps such an interface could be a compile time option?
Good candidates for this type of interface would be ADC, DAC, CAN, MAC, RTC. Those are commonly used external peripherals, which would be really cool if they could use the HAL API.
Calling LLD functions thru the VMT incurs extra redirection overhead which wouldn't always be desirable, so perhaps such an interface could be a compile time option?
Good candidates for this type of interface would be ADC, DAC, CAN, MAC, RTC. Those are commonly used external peripherals, which would be really cool if they could use the HAL API.