Skip to content

Commit

Permalink
possible fix for embassy-rs#2951
Browse files Browse the repository at this point in the history
  • Loading branch information
peter9477 committed May 17, 2024
1 parent fa94b5c commit 786a3b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions embassy-nrf/src/chips/nrf52840.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ pub const FLASH_SIZE: usize = 1024 * 1024;
pub const RESET_PIN: u32 = 18;
pub const APPROTECT_MIN_BUILD_CODE: u8 = b'F';

pub(crate) type TimerRegisterBlock = pac::timer3::RegisterBlock;

embassy_hal_internal::peripherals! {
// USB
USBD,
Expand Down
8 changes: 4 additions & 4 deletions embassy-nrf/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
use embassy_hal_internal::{into_ref, PeripheralRef};

use crate::ppi::{Event, Task};
use crate::{pac, Peripheral};
use crate::{pac, Peripheral, chip};

pub(crate) trait SealedInstance {
/// The number of CC registers this instance has.
const CCS: usize;
fn regs() -> &'static pac::timer0::RegisterBlock;
fn regs() -> &'static chip::TimerRegisterBlock;
}

/// Basic Timer instance.
Expand All @@ -31,8 +31,8 @@ macro_rules! impl_timer {
($type:ident, $pac_type:ident, $irq:ident, $ccs:literal) => {
impl crate::timer::SealedInstance for peripherals::$type {
const CCS: usize = $ccs;
fn regs() -> &'static pac::timer0::RegisterBlock {
unsafe { &*(pac::$pac_type::ptr() as *const pac::timer0::RegisterBlock) }
fn regs() -> &'static chip::TimerRegisterBlock {
unsafe { &*(pac::$pac_type::ptr() as *const chip::TimerRegisterBlock) }
}
}
impl crate::timer::Instance for peripherals::$type {
Expand Down

0 comments on commit 786a3b5

Please sign in to comment.