Skip to content

Commit

Permalink
add switch for RP2040 && PRO_MICRO_RP2040
Browse files Browse the repository at this point in the history
  • Loading branch information
sndnvaps committed Jun 2, 2024
1 parent 29bd805 commit 8c2bf98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ debug-assertions = false
incremental = false
lto = 'fat'
opt-level = 3

[features]
default = ["pro_micro_rp2040"]
rp2040 = []
pro_micro_rp2040 = []
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ fn main() -> ! {
// If you have a Pico W and want to toggle a LED with a simple GPIO output pin, you can connect an external
// LED to one of the GPIO pins, and reference that pin here. Don't forget adding an appropriate resistor
// in series with the LED.
// let mut led_pin = pins.led.into_push_pull_output();
#[cfg(feature = "rp2040")]
let mut led_pin = pins.led.into_push_pull_output();
// In this case gpio17 is the led pin(for Pro Micro RP2040 16MB)
#[cfg(feature = "pro_micro_rp2040")]
let mut led_pin = pins.gpio17.into_push_pull_output();

loop {
info!("on!");
led_pin.set_high().unwrap();
Expand Down

0 comments on commit 8c2bf98

Please sign in to comment.