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<
is_shift_pressed(state),
);
rprint!("{}", keycode);
} else {
rprint!("\n({}, {})", x, y);
}
}
}
......
......@@ -28,7 +28,7 @@ mod app {
text::{Baseline, Text},
Drawable,
};
use embedded_hal::PwmPin;
use embedded_hal::{digital::v2::OutputPin, PwmPin};
use fugit::RateExtU32;
use hal::{
gpio::{
......@@ -36,12 +36,12 @@ mod app {
Gpio0, Gpio1, Gpio12, Gpio13, Gpio14, Gpio15, Gpio16, Gpio18, Gpio2, Gpio23,
Gpio24, Gpio3, Gpio4, Gpio6, Gpio7, Gpio8,
},
FunctionI2C, FunctionSio, FunctionSpi, Pin, PullDown, PullNone, PullUp, SioInput,
SioOutput,
FunctionI2C, FunctionSio, FunctionSpi, Pin, PinState, PullDown, PullNone, PullUp,
SioInput, SioOutput,
},
pac::{I2C1, SPI1},
pwm::{self, Channel, FreeRunning, Pwm4, Pwm5, Slice},
spi,
reset, spi,
timer::{monotonic::Monotonic, Timer},
Clock, I2C,
};
......@@ -49,7 +49,6 @@ mod app {
use mipidsi::{models::ST7789, Builder};
use rp2040_hal::{self as hal, timer::Alarm0};
use rtic_monotonics::rp2040::*;
use rtt_target::rprintln;
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
......@@ -171,6 +170,8 @@ mod app {
// 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
let mut pwm = pwm_slices.pwm5;
pwm.set_ph_correct();
......@@ -180,7 +181,9 @@ mod app {
display_bl.set_inverted();
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
let sda_pin: Pin<_, FunctionI2C, PullUp> = pins.gpio18.reconfigure();
......@@ -226,16 +229,15 @@ mod app {
let spi = spi.init(
&mut pac.RESETS,
clocks.peripheral_clock.freq(),
8.MHz(),
60.MHz(),
embedded_hal::spi::MODE_0,
);
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)
.with_display_size(320, 240)
.init(&mut delay, Some(disp_reset))
.init(&mut delay, None)
.unwrap();
display_update::spawn().unwrap();
......@@ -310,6 +312,7 @@ mod app {
*r %= 255;
*g %= 255;
*b %= 255;
display.clear(Rgb565::new(*r, *g, *b)).unwrap();
// 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