Skip to content

rust-analyzer can not recognize peripherals.GPIO*. #3148

Closed
@traversebitree

Description

Bug description

rust-analyzer can not recognize peripherals.GPIO*. But the compilation was successful.

Image


Image

To Reproduce

  1. Generate codes using esp-generate
esp-generate --chip esp32s3 blinky
  1. Modify src/async_main.rs. My LED is at GPIO#48.
#![no_std]
#![no_main]

use esp_backtrace as _;
use esp_hal::{
    delay::Delay,
    gpio::{Level, Output},
    main,
};

use esp_println::println;

#[main]
fn main() -> ! {
    let peripherals = esp_hal::init(esp_hal::Config::default());

    println!("Hello world!");

    // Set GPIO7 as an output, and set its state high initially.
    let mut led = Output::new(peripherals.GPIO48, Level::Low);

    led.set_high();

    // Initialize the Delay peripheral, and use it to toggle the LED state in a
    // loop.
    let delay = Delay::new();

    loop {
        led.toggle();
        delay.delay_millis(500);
    }
}

Expected behavior

I expect when I typed peripherals.GP in VS Code. Then peripherals.GPIO48 can appear.

Environment

  • Target device: ESP32-S3]
PS C:\Users\xykon> espflash board-info
✔ Use serial port 'COM3' - USB 串行设备 (COM3)? · yes
✔ Remember this serial port for future use? · no
[2025-02-19T04:06:40Z INFO ] Serial port: 'COM3'
[2025-02-19T04:06:40Z INFO ] Connecting...
[2025-02-19T04:06:40Z INFO ] Using flash stub
Chip type:         esp32s3 (revision v0.2)
Crystal frequency: 40 MHz
Flash size:        32MB
Features:          WiFi, BLE
MAC address:       84:fc:e6:7e:4e:74
  • Crate name and version: esp-hal = { version = "0.23.1", features = ["esp32s3", "unstable"] }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status

      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions