Skip to main content

ariel_os_nrf/i2c/
mod.rs

1//! Provides support for the I2C communication bus.
2
3#[doc(alias = "master")]
4pub mod controller;
5
6#[doc(hidden)]
7pub fn init(peripherals: &mut crate::OptionalPeripherals) {
8    // Take all I2C peripherals and do nothing with them.
9    cfg_select! {
10        context = "nrf52833" => {
11            let _ = peripherals.TWISPI0.take().unwrap();
12            let _ = peripherals.TWISPI1.take().unwrap();
13        }
14        context = "nrf52840" => {
15            let _ = peripherals.TWISPI0.take().unwrap();
16            let _ = peripherals.TWISPI1.take().unwrap();
17        }
18        context = "nrf5340-app" => {
19            let _ = peripherals.SERIAL0.take().unwrap();
20            let _ = peripherals.SERIAL1.take().unwrap();
21        }
22        context = "nrf91" => {
23            let _ = peripherals.SERIAL0.take().unwrap();
24            let _ = peripherals.SERIAL1.take().unwrap();
25        }
26        _ => {
27            compile_error!("this nRF chip is not supported");
28        }
29    }
30}