lcd *should* work?
This commit is contained in:
parent
4e1956f30d
commit
23369dcf9b
|
@ -16,6 +16,7 @@ panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
# We're using a Pico by default on this template
|
# We're using a Pico by default on this template
|
||||||
rp-pico = "0.8"
|
rp-pico = "0.8"
|
||||||
max31855 = "0.1.0"
|
max31855 = "0.1.0"
|
||||||
|
hd44780-driver = "0.4.0"
|
||||||
|
|
||||||
# cargo build/run
|
# cargo build/run
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|
|
@ -11,5 +11,5 @@ pid temperature controller using the pi pico.
|
||||||
|
|
||||||
## crates to use:
|
## crates to use:
|
||||||
[thermocouple chip](https://crates.io/crates/max31855)
|
[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)
|
[rotary encoder](https://crates.io/crates/rotary-encoder-embedded)
|
||||||
|
|
23
src/main.rs
23
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_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use core::fmt::Write;
|
|
||||||
use bsp::{
|
use bsp::{
|
||||||
entry,
|
entry,
|
||||||
hal::{
|
hal::{
|
||||||
|
@ -12,10 +8,10 @@ use bsp::{
|
||||||
uart::{UartConfig, UartPeripheral},
|
uart::{UartConfig, UartPeripheral},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use core::fmt::Write;
|
||||||
use defmt_rtt as _;
|
use defmt_rtt as _;
|
||||||
use embedded_hal::digital::v2::OutputPin;
|
use embedded_hal::digital::v2::OutputPin;
|
||||||
use embedded_hal::spi::MODE_0;
|
use embedded_hal::spi::MODE_0;
|
||||||
use max31855::{Max31855, Unit};
|
|
||||||
use panic_probe as _;
|
use panic_probe as _;
|
||||||
|
|
||||||
// Provide an alias for our BSP so we can switch targets quickly.
|
// Provide an alias for our BSP so we can switch targets quickly.
|
||||||
|
@ -31,6 +27,9 @@ use bsp::hal::{
|
||||||
watchdog::Watchdog,
|
watchdog::Watchdog,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use hd44780_driver as hd44780;
|
||||||
|
use max31855::{Max31855, Unit};
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
@ -99,6 +98,20 @@ fn main() -> ! {
|
||||||
MODE_0,
|
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 {
|
loop {
|
||||||
led_pin.set_high().unwrap();
|
led_pin.set_high().unwrap();
|
||||||
external_led_pin.set_low().unwrap();
|
external_led_pin.set_low().unwrap();
|
||||||
|
|
BIN
wiring.fzz
BIN
wiring.fzz
Binary file not shown.
Loading…
Reference in a new issue