A personal rust firmware for the Badger 2040 W

Clean up and nice readme

Changed files
+26 -12
src
+5 -2
.env.save
··· 1 - NAME="Bailey Townsend" 2 - DETAILS="Software Dev" 1 + NAME="Your name" 2 + DETAILS="A fun fact aboutyou" 3 + WIFI_SSID="Your wifi" 4 + WIFI_PASSWORD="or someone elses" 5 + TIME_API="http://worldtimeapi.org/api/timezone/America/Chicago"
+19 -7
README.md
··· 1 - ## Raspberry Pico W Embassy Template 1 + # Badger 2040 W written in rust 2 2 3 - This is just a simple template for setting up a project using [embassy_rp](https://github.com/embassy-rs/embassy/tree/2d678d695637ed1023fd80fea482d60a288e4343/embassy-rp). This currently pulls all dependencies from the embassy repo because I found some of the examples not working with the latest versions of the dependencies on crates.io. Currently pulling commit `2b031756c6d705f58de972de48f7300b4fdc673c` of the embassy repo. Also will notice the `cargo.toml` has everything including the kitchen sink. Trim what you don't need, this is mostly for beginners(me) to get started with. 3 + A rust controlled Badge for a conferences or anywhere else you want to be extra 4 4 5 - Will notice this is the Wifi Blinky example. I did this so I can include the cyw43 firmware and an example of how to load it onto the pico. 5 + ## Features 6 + * Display some text to the left like name and job title 7 + * Display a small bmp image, can alternate images by pressing the c button. This example has Ferris with a knife and a QR code that links to this repo 8 + * Connects to a [Adafruit Sensirion SHTC3](https://www.adafruit.com/product/4636) via STEMMA QT / Qwiic to get real time temperature and humidity 9 + * If you set a wifi network in [.env](.env) the badge will set the pico's RTC and display the time one the display. 10 + * Counts unique wifi bssid's it comes across and keeps those counts unique across reboots by writing to flash. 6 11 7 - ## Setup 8 12 9 - Refer to [embassy](https://github.com/embassy-rs/embassy). Feel free to leave a issue though if you would like help setting up. 13 + ## Timings 14 + The project is a mosh posh of things to get it ready for an event I am going to this weekend, so it is not always the best code or well thought out. Especially timings, I did not want to always refresh everything as fast as possible for battery and Eink constraints. 15 + * roughly every 5 mins it checks for new wifi networks 16 + * roughly every 30 seconds it takes a new temp/humidity reading 17 + * roughly every min it updates the time display, altho the RTC should keep pretty accurate timing 18 + * roughly every 30 seconds it updates the top bar that holds wifi count as well as sensor data 10 19 11 - ## How do I do xyz? 12 20 13 - Check the the [embassy_rp examples](https://github.com/embassy-rs/embassy/tree/2d678d695637ed1023fd80fea482d60a288e4343/examples/rp). Should ideally be able to take any of those and run it inside of this template, this is what it is based off of. 21 + ## This project would not be possible without.. 22 + * [trvswgnr](https://github.com/trvswgnr) for their amazing ferris with a knife image. All i did was badly convert it to grayscale and scaled it down. 23 + * embassy framework and their great [examples](https://github.com/embassy-rs/embassy/tree/main/examples/rp). Exactly zero chance I would have any of this written without this directory. 24 + * the [uc8151-rs](https://crates.io/crates/uc8151) crate. Would not be able to write to the e ink display without this great crate. 25 + * And every other single crate found in [Cargo.toml](./Cargo.toml). None of it would be possible with out those packages and maintainers.
+2 -2
src/main.rs
··· 19 19 use embassy_rp::flash::Async; 20 20 use embassy_rp::gpio; 21 21 use embassy_rp::gpio::Input; 22 - use embassy_rp::peripherals::{DMA_CH0, PIO0, SPI0}; 22 + use embassy_rp::peripherals::SPI0; 23 23 use embassy_rp::rtc::{DateTime, DayOfWeek}; 24 24 use embassy_rp::spi::Spi; 25 25 use embassy_rp::spi::{self}; 26 26 use embassy_sync::blocking_mutex::raw::NoopRawMutex; 27 27 use embassy_sync::mutex::Mutex; 28 28 use embassy_time::{Duration, Timer}; 29 - use embedded_hal_1::digital::OutputPin; 30 29 use env::env_value; 31 30 use gpio::{Level, Output, Pull}; 32 31 use heapless::{String, Vec}; ··· 283 282 } 284 283 285 284 if btn_b.is_high() { 285 + info!("Button B pressed"); 286 286 user_led.toggle(); 287 287 Timer::after(Duration::from_millis(500)).await; 288 288 current_cycle += 500;
-1
src/temp_sensor.rs
··· 1 - use bt_hci::cmd::info; 2 1 use defmt::*; 3 2 use embassy_rp::i2c::{I2c, SclPin, SdaPin}; 4 3 use embassy_rp::peripherals::I2C0;