Make screen color change be 10fps
This commit is contained in:
parent
854efe3d0f
commit
99d33fdcab
13
src/main.rs
13
src/main.rs
@ -15,7 +15,7 @@ use esp_hal::{
|
||||
gpio::{Level, Output, OutputConfig},
|
||||
main,
|
||||
spi::master::{Config, Spi},
|
||||
time::Rate,
|
||||
time::{Duration, Instant, Rate},
|
||||
};
|
||||
|
||||
use esp_backtrace as _;
|
||||
@ -69,7 +69,7 @@ fn main() -> ! {
|
||||
let spi = Spi::new(
|
||||
peripherals.SPI2,
|
||||
Config::default()
|
||||
.with_frequency(Rate::from_mhz(40))
|
||||
.with_frequency(Rate::from_mhz(80))
|
||||
.with_mode(esp_hal::spi::Mode::_2)
|
||||
.with_read_bit_order(esp_hal::spi::BitOrder::MsbFirst)
|
||||
.with_write_bit_order(esp_hal::spi::BitOrder::MsbFirst),
|
||||
@ -94,7 +94,7 @@ fn main() -> ! {
|
||||
color_order: display::ColorOrder::Bgr,
|
||||
..Default::default()
|
||||
});
|
||||
display.set_tearing(display::TearingMode::Horizontal);
|
||||
display.set_tearing(display::TearingMode::Off);
|
||||
|
||||
display.draw_rect(
|
||||
Position::new(0, 0),
|
||||
@ -107,6 +107,8 @@ fn main() -> ! {
|
||||
let mut color = 0;
|
||||
|
||||
loop {
|
||||
let delay_start = Instant::now();
|
||||
|
||||
log::info!("Hello world: {}", color);
|
||||
|
||||
color = (color + 50) % 200;
|
||||
@ -119,9 +121,8 @@ fn main() -> ! {
|
||||
},
|
||||
);
|
||||
|
||||
// let delay_start = Instant::now();
|
||||
// while delay_start.elapsed() < Duration::from_millis(500) {}
|
||||
test_delay.delay_millis(1000);
|
||||
while delay_start.elapsed() < Duration::from_millis(100) {}
|
||||
// test_delay.delay_millis(1);
|
||||
}
|
||||
|
||||
// for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.1.0/examples
|
||||
|
||||
Loading…
Reference in New Issue
Block a user