diff --git a/Cargo.toml b/Cargo.toml index 7d71645..435cb3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ panic-probe = { version = "0.3", features = ["print-defmt"] } # We're using a Pico by default on this template rp-pico = "0.8" max31855 = "0.1.0" +hd44780-driver = "0.4.0" # cargo build/run [profile.dev] diff --git a/README.md b/README.md index bf9c416..3ee132d 100644 --- a/README.md +++ b/README.md @@ -11,5 +11,5 @@ pid temperature controller using the pi pico. ## crates to use: [thermocouple chip](https://crates.io/crates/max31855) -[lcd](https://crates.io/crates/lcd) +[lcd](https://crates.io/crates/hd44780-driver) [rotary encoder](https://crates.io/crates/rotary-encoder-embedded) diff --git a/src/main.rs b/src/main.rs index fae0a32..1b82560 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,6 @@ -//! Blinks the LED on a Pico board -//! -//! This will blink an LED attached to GP25, which is the pin the Pico uses for the on-board LED. #![no_std] #![no_main] -use core::fmt::Write; use bsp::{ entry, hal::{ @@ -12,10 +8,10 @@ use bsp::{ uart::{UartConfig, UartPeripheral}, }, }; +use core::fmt::Write; use defmt_rtt as _; use embedded_hal::digital::v2::OutputPin; use embedded_hal::spi::MODE_0; -use max31855::{Max31855, Unit}; use panic_probe as _; // Provide an alias for our BSP so we can switch targets quickly. @@ -31,6 +27,9 @@ use bsp::hal::{ watchdog::Watchdog, }; +use hd44780_driver as hd44780; +use max31855::{Max31855, Unit}; + #[entry] fn main() -> ! { let mut pac = pac::Peripherals::take().unwrap(); @@ -99,6 +98,20 @@ fn main() -> ! { MODE_0, ); + let mut lcd = hd44780::HD44780::new_4bit( + pins.gpio16.into_push_pull_output(), //rs + pins.gpio17.into_push_pull_output(), // enable + pins.gpio18.into_push_pull_output(), //d4 + pins.gpio19.into_push_pull_output(), //d5 + pins.gpio20.into_push_pull_output(), //d6 + pins.gpio21.into_push_pull_output(), //d6 + &mut delay, + ).unwrap(); + + lcd.reset(&mut delay).unwrap(); + lcd.clear(&mut delay).unwrap(); + lcd.write_str("lcd initalized", &mut delay).unwrap(); + loop { led_pin.set_high().unwrap(); external_led_pin.set_low().unwrap(); diff --git a/wiring.fzz b/wiring.fzz index 9926363..c8fdb59 100644 Binary files a/wiring.fzz and b/wiring.fzz differ