aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/nrf5340/src/bin/nrf5340dk_internal_caps.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/nrf5340/src/bin/nrf5340dk_internal_caps.rs b/examples/nrf5340/src/bin/nrf5340dk_internal_caps.rs
new file mode 100644
index 000000000..0b1fb852e
--- /dev/null
+++ b/examples/nrf5340/src/bin/nrf5340dk_internal_caps.rs
@@ -0,0 +1,30 @@
1#![no_std]
2#![no_main]
3
4use defmt::info;
5use embassy_executor::Spawner;
6use embassy_nrf::config::{Config, HfclkSource, LfclkSource, LfxoCapacitance};
7use embassy_nrf::pac;
8use {defmt_rtt as _, panic_probe as _};
9
10fn print_xosc32mcaps() {
11 let value = pac::OSCILLATORS.xosc32mcaps().read();
12 info!("XOSC32MCAPS.ENABLE = {}", value.enable());
13 info!("XOSC32MCAPS.CAPVALUE = {}", value.capvalue());
14}
15
16#[embassy_executor::main]
17async fn main(_spawner: Spawner) {
18 info!("Before init:");
19 print_xosc32mcaps();
20
21 let mut config = Config::default();
22 config.hfclk_source = HfclkSource::Internal;
23 config.lfclk_source = LfclkSource::ExternalXtal;
24 config.internal_capacitors.hfxo = None; // keep the value from the FICR
25 config.internal_capacitors.lfxo = Some(LfxoCapacitance::_7pF);
26 let _p = embassy_nrf::init(config);
27
28 info!("After init:");
29 print_xosc32mcaps();
30}