0.17.0
Please note that only changes to the esp-hal package are tracked in these release notes. Read the full changelog entry for all the changes.
[email protected]
Migration Guide
This release changes interrupt handler binding from link-time binding to runtime-binding. This increases flexibility of how interrupts can be used, but the main reason is two allow mixing mixing async and non-async drivers in the same application.
Key changes
The biggest change is the removal of the #[interrupt]
macro. It has been replaced by the #[handler]
macro which works differently slightly differently.
Now you have to bind the interrupt handler explicitly. The supported peripheral drivers either take a new optional parameter to their constructor or it will offer a set_interrupt_handler
function. Don't worry, if you forget to do this, the compiler will emit an unused warning for the #[handler]
function.
The second change is that most drivers will now have a MODE
parameter with some new constructors to initialize a driver in Blocking
or Async
mode. You will need to account for this in your code.
Finally, most root level re-exports are now gone, instead, you should import from the specific module.
Below is a list of key changes you need to make to upgrade.
There is no longer a need to enable interrupts manually unless you are changing a priority later in the application. This change also means the interrupt is enabled once the interrupt is used, so please ensure that you have the proper ordering of initialization or critical sections to account for that.
- interrupt::enable(Interrupt::GPIO, Priority::Priority2).unwrap();
Use the new handler macro.
- #[interrupt]
+ #[handler]
Ensure you set the handler, depending on the peripheral this may be part of the constructor or a method such as the one below.
+ io.set_interrupt_handler(handler);
Interrupts are now tightly coupled to their priority, meaning you can pass a priority to the handler macro. The default unless specified is the lowest priority.
+ #[handler(priority = "Priority::max()")]