This PR mimics the approach followed in cortex-m. The idea is to isolate those traits that must be implemented by PACs from other parts of our ecosystem that use them.
In the (very) near future, I plan to move the riscv-peripheral crate here for standard peripherals. These will rely on the traits of riscv-pac to provide functionality. In this way, it will be less harmful to add breaking changes to the peripherals.
So far, I added three main traits:
InterruptNumber: for external interrupts
PriorityNumber: for encoding valid priorities
HartIdNumber: for enumerating the HARTs of the RISC-V target
All these traits expect PACs to i) provide conversions to/from numbers and ii) specify the greatest expected value. The latter will help third-party tools such as RTIC to provide support for RISC-V targets.
This PR mimics the approach followed in
cortex-m
. The idea is to isolate those traits that must be implemented by PACs from other parts of our ecosystem that use them.In the (very) near future, I plan to move the
riscv-peripheral
crate here for standard peripherals. These will rely on the traits ofriscv-pac
to provide functionality. In this way, it will be less harmful to add breaking changes to the peripherals.So far, I added three main traits:
InterruptNumber
: for external interruptsPriorityNumber
: for encoding valid prioritiesHartIdNumber
: for enumerating the HARTs of the RISC-V targetAll these traits expect PACs to i) provide conversions to/from numbers and ii) specify the greatest expected value. The latter will help third-party tools such as RTIC to provide support for RISC-V targets.