Skip to content

Commit

Permalink
feat(nrf52-embassy): allow accessing the internal temp sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMemories committed Feb 8, 2024
1 parent 68edf32 commit 1557e71
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/riot-rs-embassy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ time = ["dep:embassy-time", "embassy-executor/integrated-timers"]
usb = [ "dep:embassy-usb" ]
net = [ "dep:embassy-net" ]
usb_ethernet = [ "usb", "net" ]
internal-temp = []

wifi_cyw43 = [ "dep:cyw43", "dep:cyw43-pio", "dep:embassy-net-driver-channel", "net" ]

Expand Down
13 changes: 13 additions & 0 deletions src/riot-rs-embassy/src/arch/nrf52.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,16 @@ pub mod usb {
Driver::new(usbd, Irqs, HardwareVbusDetect::new(Irqs))
}
}

#[cfg(feature = "internal-temp")]
pub mod internal_temp {
use embassy_nrf::{peripherals, temp};

embassy_nrf::bind_interrupts!(struct TempIrqs {
TEMP => embassy_nrf::temp::InterruptHandler;
});

pub fn sensor(temp: peripherals::TEMP) -> temp::Temp<'static> {
temp::Temp::new(temp, TempIrqs)
}
}
1 change: 1 addition & 0 deletions src/riot-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ net = [ "riot-rs-embassy/net" ]
usb_ethernet = [ "riot-rs-embassy/usb_ethernet" ]
wifi_cyw43 = [ "riot-rs-embassy/wifi_cyw43" ]
override-network-config = ["riot-rs-embassy/override-network-config"]
internal-temp = ["riot-rs-embassy/internal-temp"]

0 comments on commit 1557e71

Please sign in to comment.