Module gpio

Source
Expand description

GPIO pin control interface of a connected ESP32-WROOM target WiFi board.

§Usage

use esp32_wroom_rp::gpio::*;

let mut pac = pac::Peripherals::take().unwrap();

// The single-cycle I/O block controls our GPIO pins
let sio = hal::Sio::new(pac.SIO);

// Set the pins to their default state
let pins = hal::gpio::Pins::new(
    pac.IO_BANK0,
    pac.PADS_BANK0,
    sio.gpio_bank0,
    &mut pac.RESETS,
);

let esp_pins = esp32_wroom_rp::gpio::EspControlPins {
    // CS on pin x (GPIO7)
    cs: pins.gpio7.into_mode::<hal::gpio::PushPullOutput>(),
    // GPIO0 on pin x (GPIO2)
    gpio0: pins.gpio2.into_mode::<hal::gpio::PushPullOutput>(),
    // RESETn on pin x (GPIO11)
    resetn: pins.gpio11.into_mode::<hal::gpio::PushPullOutput>(),
    // ACK on pin x (GPIO10)
    ack: pins.gpio10.into_mode::<hal::gpio::FloatingInput>(),
};

Structs§

EspControlPins
A structured representation of all GPIO pins that control a ESP32-WROOM NINA firmware-based device outside of commands sent over the SPI/I²C bus. Pass a single instance of this struct into Wifi::init().

Traits§

EspControlInterface
Provides an internal pin interface that abstracts the extra control lines that are separate from a data bus (e.g. SPI/I2C).