Skip to content
Snippets Groups Projects
Commit 569015f4 authored by Stephen D's avatar Stephen D
Browse files

it works!

parent 406be08f
No related branches found
No related tags found
No related merge requests found
...@@ -176,8 +176,6 @@ impl< ...@@ -176,8 +176,6 @@ impl<
is_shift_pressed(state), is_shift_pressed(state),
); );
rprint!("{}", keycode); rprint!("{}", keycode);
} else {
rprint!("\n({}, {})", x, y);
} }
} }
} }
......
...@@ -28,7 +28,7 @@ mod app { ...@@ -28,7 +28,7 @@ mod app {
text::{Baseline, Text}, text::{Baseline, Text},
Drawable, Drawable,
}; };
use embedded_hal::PwmPin; use embedded_hal::{digital::v2::OutputPin, PwmPin};
use fugit::RateExtU32; use fugit::RateExtU32;
use hal::{ use hal::{
gpio::{ gpio::{
...@@ -36,12 +36,12 @@ mod app { ...@@ -36,12 +36,12 @@ mod app {
Gpio0, Gpio1, Gpio12, Gpio13, Gpio14, Gpio15, Gpio16, Gpio18, Gpio2, Gpio23, Gpio0, Gpio1, Gpio12, Gpio13, Gpio14, Gpio15, Gpio16, Gpio18, Gpio2, Gpio23,
Gpio24, Gpio3, Gpio4, Gpio6, Gpio7, Gpio8, Gpio24, Gpio3, Gpio4, Gpio6, Gpio7, Gpio8,
}, },
FunctionI2C, FunctionSio, FunctionSpi, Pin, PullDown, PullNone, PullUp, SioInput, FunctionI2C, FunctionSio, FunctionSpi, Pin, PinState, PullDown, PullNone, PullUp,
SioOutput, SioInput, SioOutput,
}, },
pac::{I2C1, SPI1}, pac::{I2C1, SPI1},
pwm::{self, Channel, FreeRunning, Pwm4, Pwm5, Slice}, pwm::{self, Channel, FreeRunning, Pwm4, Pwm5, Slice},
spi, reset, spi,
timer::{monotonic::Monotonic, Timer}, timer::{monotonic::Monotonic, Timer},
Clock, I2C, Clock, I2C,
}; };
...@@ -49,7 +49,6 @@ mod app { ...@@ -49,7 +49,6 @@ mod app {
use mipidsi::{models::ST7789, Builder}; use mipidsi::{models::ST7789, Builder};
use rp2040_hal::{self as hal, timer::Alarm0}; use rp2040_hal::{self as hal, timer::Alarm0};
use rtic_monotonics::rp2040::*; use rtic_monotonics::rp2040::*;
use rtt_target::rprintln;
const XTAL_FREQ_HZ: u32 = 12_000_000u32; const XTAL_FREQ_HZ: u32 = 12_000_000u32;
...@@ -171,6 +170,8 @@ mod app { ...@@ -171,6 +170,8 @@ mod app {
// let mut vibrator = pins.gpio9.into_push_pull_output(); // let mut vibrator = pins.gpio9.into_push_pull_output();
let mut delay = Delay::new(ctx.core.SYST, clocks.system_clock.freq().to_Hz());
// Display backlight // Display backlight
let mut pwm = pwm_slices.pwm5; let mut pwm = pwm_slices.pwm5;
pwm.set_ph_correct(); pwm.set_ph_correct();
...@@ -180,7 +181,9 @@ mod app { ...@@ -180,7 +181,9 @@ mod app {
display_bl.set_inverted(); display_bl.set_inverted();
let tp_reset = pins.gpio3.into_push_pull_output(); let tp_reset = pins.gpio3.into_push_pull_output();
let disp_reset = pins.gpio4.into_push_pull_output(); let mut disp_reset = pins.gpio4.into_push_pull_output_in_state(PinState::Low);
delay.delay_us(10);
disp_reset.set_high().unwrap();
// Touchpad // Touchpad
let sda_pin: Pin<_, FunctionI2C, PullUp> = pins.gpio18.reconfigure(); let sda_pin: Pin<_, FunctionI2C, PullUp> = pins.gpio18.reconfigure();
...@@ -226,16 +229,15 @@ mod app { ...@@ -226,16 +229,15 @@ mod app {
let spi = spi.init( let spi = spi.init(
&mut pac.RESETS, &mut pac.RESETS,
clocks.peripheral_clock.freq(), clocks.peripheral_clock.freq(),
8.MHz(), 60.MHz(),
embedded_hal::spi::MODE_0, embedded_hal::spi::MODE_0,
); );
let spi_cs = SPIInterface::new(spi, display_dc, display_cs); let spi_cs = SPIInterface::new(spi, display_dc, display_cs);
let mut delay = Delay::new(ctx.core.SYST, clocks.system_clock.freq().to_Hz());
let display = Builder::st7789(spi_cs) let display = Builder::st7789(spi_cs)
.with_display_size(320, 240) .with_display_size(320, 240)
.init(&mut delay, Some(disp_reset)) .init(&mut delay, None)
.unwrap(); .unwrap();
display_update::spawn().unwrap(); display_update::spawn().unwrap();
...@@ -310,6 +312,7 @@ mod app { ...@@ -310,6 +312,7 @@ mod app {
*r %= 255; *r %= 255;
*g %= 255; *g %= 255;
*b %= 255; *b %= 255;
display.clear(Rgb565::new(*r, *g, *b)).unwrap(); display.clear(Rgb565::new(*r, *g, *b)).unwrap();
// Draw a smiley face with white eyes and a red mouth // Draw a smiley face with white eyes and a red mouth
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment