mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
make priority a const fn
This commit is contained in:
parent
aba9333799
commit
e56f8156bc
1 changed files with 2 additions and 2 deletions
|
@ -164,7 +164,7 @@ unsafe impl<T> Sync for Resource<T> {}
|
||||||
/// With NVIC priorities, `32` has LOWER priority than `16`. (Also, NVIC
|
/// With NVIC priorities, `32` has LOWER priority than `16`. (Also, NVIC
|
||||||
/// priorities encode the actual priority in the highest bits of a byte so
|
/// priorities encode the actual priority in the highest bits of a byte so
|
||||||
/// priorities like `1` and `2` aren't actually different)
|
/// priorities like `1` and `2` aren't actually different)
|
||||||
// TODO review the handling extreme value
|
// TODO review the handling of extreme values
|
||||||
pub fn priority(logical: u8) -> u8 {
|
pub const fn priority(logical: u8) -> u8 {
|
||||||
((1 << PRIORITY_BITS) - logical) << (8 - PRIORITY_BITS)
|
((1 << PRIORITY_BITS) - logical) << (8 - PRIORITY_BITS)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue