Hello,
I'm new to Nordic and I'm currently learning rust on an nRF7002 DK. I know that the LED0 of the nRF7002 connects to the GPIO1.06 of the nRF5340. However, when importing the rust library of nrf5340_app_hal, it doesn't seem to contain the GPIO1 listed in the GPIO list. Can I know what I'm supposed to do to toggle the LED using the HAL provided in the Rust ecosystem? The code I currently have is as follows. I tried p0 and p0_s but both failed to turn on the LED.
#![no_std]
#![no_main]
use cortex_m::asm::nop;
use cortex_m_rt::entry;
use embedded_hal::digital::{OutputPin, PinState};
use hal::{gpio::Level, pac};
use nrf5340_app_hal as hal;
use panic_halt as _;
use rtt_target::{rprintln, rtt_init_print};
#[entry]
fn main() -> ! {
rtt_init_print!();
rprintln!("Initializing...");
let p = pac::Peripherals::take().unwrap();
let port1 = hal::gpio::p0_s::Parts::new(p.P0_S);
let mut led0 = port1.p0_06.into_push_pull_output(Level::Low);
let mut is_on: bool = false;
loop {
let _ = led0.set_state(PinState::from(is_on));
for _ in 0..100_000 {
nop();
}
is_on = !is_on;
}
}
Any help is appreciated. Thank you.