Skip to main content

Board

Struct Board 

Source
#[non_exhaustive]
pub struct Board {
Show 17 fields pub display: DisplayResources<'static>, pub backlight: BacklightResources<'static>, pub sys_i2c: SysI2cResources<'static>, pub keyboard: KeyboardResources<'static>, pub audio: AudioResources<'static>, pub spi_bus: SpiBusResources<'static>, pub ext: ExtResources<'static>, pub rmt: RmtResources<'static>, pub battery: BatteryResources<'static>, pub imu: ImuResources, pub button: GPIO0<'static>, pub grove: GroveResources<'static>, pub fpc_io1: GPIO7<'static>, pub radio: RadioResources<'static>, pub system: SystemResources<'static>, pub spare: SpareResources<'static>, pub raw: RawResources<'static>,
}
Expand description

Every peripheral of the chip, grouped by what the Cardputer ADV wires it to. Create it with crate::init or Board::new.

Each group’s init borrows the group, so take the board as mut and keep it for the life of the program; drivers are created from it and dropped as apps come and go.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§display: DisplayResources<'static>

ST7789V2 LCD (SPI3 + DMA channel 0).

§backlight: BacklightResources<'static>

LCD backlight, which also powers the RGB LED.

§sys_i2c: SysI2cResources<'static>

Internal I²C bus (keyboard, codec, IMU).

§keyboard: KeyboardResources<'static>

Keyboard scanner interrupt line (the scanner itself is on sys_i2c).

§audio: AudioResources<'static>

ES8311 codec I²S link.

§spi_bus: SpiBusResources<'static>

SPI bus shared by microSD and the EXT header.

§ext: ExtResources<'static>

EXT header control and UART lines.

§rmt: RmtResources<'static>

RMT pulse generator with the RGB LED and IR LED it drives.

§battery: BatteryResources<'static>

Battery voltage sense.

§imu: ImuResources

BMI270 IMU (on sys_i2c).

§button: GPIO0<'static>

G0 button (active low). Read it with Input::new(board.button.reborrow(), InputConfig::default().with_pull(Pull::Up)).

§grove: GroveResources<'static>

Grove port.

§fpc_io1: GPIO7<'static>

Spare line on the internal FPC connector.

§radio: RadioResources<'static>

Wi-Fi and Bluetooth radio.

§system: SystemResources<'static>

Peripherals not tied to a board function.

§spare: SpareResources<'static>

GPIOs and UART0 that the board leaves unrouted.

§raw: RawResources<'static>

Register-block peripherals for low-level or unsafe work.

Implementations§

Source§

impl Board

Source

pub fn new(p: Peripherals) -> (Self, RtosResources)

Splits esp_hal::init’s peripherals into board resource groups.

Peripherals tokens can’t be recovered once dropped (short of unsafe stealing), so every peripheral is forwarded except exactly three: SPI0/SPI1, which serve the flash cache (using them would crash execution), and PSRAM, which the ESP32-S3FN8 does not have.

Auto Trait Implementations§

§

impl Freeze for Board

§

impl RefUnwindSafe for Board

§

impl Send for Board

§

impl Sync for Board

§

impl Unpin for Board

§

impl UnsafeUnpin for Board

§

impl !UnwindSafe for Board

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,