Version 0.2 of lpc82x-hal, the Hardware Abstraction Layer for NXP’s LPC82x family of ARM Cortex-M0+ microcontrollers, is now available. lpc82x-hal is a high-level, but largely zero-cost, API for controlling LPC82x systems. It is a (partial) implementation of embedded-hal.
The focus of this release has been a radical simplification of the API, specifically the way that hardware state is tracked at compile-time. The project’s primary goal is to provide a safe API that guarantees correct use of the hardware at compile-time. Mistakes, like forgetting to initialize a peripheral before trying to use it, or attempting to use a pin that already has another function assigned to it, should always lead to compile-time errors.
These compile-time guarantees come at the cost of increased API complexity. Version 0.2 has done a lot to limit this complexity, making the API much more practical to use. I believe that choosing a correctness-focused API like this should be a no-brainer, and this version is a step in that direction.
Other improvements made for version 0.2 include a basic I2C API, improved support for low-power modes, and more. For more information, please check out the changelog or the list of pull requests. As always, I’d love the hear everyone’s feedback, here or on the issue tracker.