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},
|
gpio::{Level, Output, OutputConfig},
|
||||||
main,
|
main,
|
||||||
spi::master::{Config, Spi},
|
spi::master::{Config, Spi},
|
||||||
time::Rate,
|
time::{Duration, Instant, Rate},
|
||||||
};
|
};
|
||||||
|
|
||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
@ -69,7 +69,7 @@ fn main() -> ! {
|
|||||||
let spi = Spi::new(
|
let spi = Spi::new(
|
||||||
peripherals.SPI2,
|
peripherals.SPI2,
|
||||||
Config::default()
|
Config::default()
|
||||||
.with_frequency(Rate::from_mhz(40))
|
.with_frequency(Rate::from_mhz(80))
|
||||||
.with_mode(esp_hal::spi::Mode::_2)
|
.with_mode(esp_hal::spi::Mode::_2)
|
||||||
.with_read_bit_order(esp_hal::spi::BitOrder::MsbFirst)
|
.with_read_bit_order(esp_hal::spi::BitOrder::MsbFirst)
|
||||||
.with_write_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,
|
color_order: display::ColorOrder::Bgr,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
display.set_tearing(display::TearingMode::Horizontal);
|
display.set_tearing(display::TearingMode::Off);
|
||||||
|
|
||||||
display.draw_rect(
|
display.draw_rect(
|
||||||
Position::new(0, 0),
|
Position::new(0, 0),
|
||||||
@ -107,6 +107,8 @@ fn main() -> ! {
|
|||||||
let mut color = 0;
|
let mut color = 0;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
let delay_start = Instant::now();
|
||||||
|
|
||||||
log::info!("Hello world: {}", color);
|
log::info!("Hello world: {}", color);
|
||||||
|
|
||||||
color = (color + 50) % 200;
|
color = (color + 50) % 200;
|
||||||
@ -119,9 +121,8 @@ fn main() -> ! {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// let delay_start = Instant::now();
|
while delay_start.elapsed() < Duration::from_millis(100) {}
|
||||||
// while delay_start.elapsed() < Duration::from_millis(500) {}
|
// test_delay.delay_millis(1);
|
||||||
test_delay.delay_millis(1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.1.0/examples
|
// 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