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_if::cfg_if! {
10        if #[cfg(context = "nrf52833")] {
11            let _ = peripherals.TWISPI0.take().unwrap();
12            let _ = peripherals.TWISPI1.take().unwrap();
13        } else if #[cfg(context = "nrf52840")] {
14            let _ = peripherals.TWISPI0.take().unwrap();
15            let _ = peripherals.TWISPI1.take().unwrap();
16        } else if #[cfg(context = "nrf5340")] {
17            let _ = peripherals.SERIAL0.take().unwrap();
18            let _ = peripherals.SERIAL1.take().unwrap();
19        } else if #[cfg(context = "nrf91")] {
20            let _ = peripherals.SERIAL0.take().unwrap();
21            let _ = peripherals.SERIAL1.take().unwrap();
22        } else {
23            compile_error!("this nRF chip is not supported");
24        }
25    }
26}