Skip to content

Commit 3efd854

Browse files
committed
Adds examples/secrets.rs to store ssid, passphrase for use in any example application.
1 parent 3ead44b commit 3efd854

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

examples/join.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ use hal::pac;
3030

3131
use embedded_hal::delay::blocking::DelayUs;
3232

33+
include!("secrets.rs");
34+
3335
/// The linker will place this boot block at the start of our program image. We
3436
/// need this to help the ROM bootloader get our code up and running.
3537
#[link_section = ".boot2"]
@@ -127,11 +129,9 @@ fn main() -> ! {
127129
// ACK on pin x (GPIO10)
128130
ack: pins.gpio10.into_mode::<hal::gpio::FloatingInput>(),
129131
};
130-
let ssid: &str = "SSID";
131-
let passphrase: &str = "Passphrase";
132132

133133
let mut wifi = esp32_wroom_rp::wifi::Wifi::init(spi, esp_pins, &mut delay).unwrap();
134-
let result = wifi.join(ssid, passphrase);
134+
let result = wifi.join(SSID, PASSPHRASE);
135135
defmt::info!("Join Result: {:?}", result);
136136

137137
defmt::info!("Entering main loop");

examples/secrets.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// secrets.rs - stores WiFi secrets like SSID, passphrase, etc shared across
3+
// all example applications
4+
//
5+
6+
use heapless::String;
7+
8+
const SSID: &str = "ssid";
9+
const PASSPHRASE: &str = "passphrase";

0 commit comments

Comments
 (0)