HappyEyes
This commit is contained in:
parent
c90c10cf7a
commit
b9363f1c7d
5 changed files with 46 additions and 27 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
|
@ -765,7 +765,6 @@ dependencies = [
|
|||
"embedded-storage",
|
||||
"heapless",
|
||||
"mipidsi",
|
||||
"panic-probe",
|
||||
"rgb",
|
||||
"tinytga",
|
||||
]
|
||||
|
|
@ -888,16 +887,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "panic-probe"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a"
|
||||
dependencies = [
|
||||
"cortex-m",
|
||||
"defmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.5"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ bench = false
|
|||
[dependencies]
|
||||
defmt = "1.0"
|
||||
defmt-rtt = "1.1"
|
||||
panic-probe = { version = "1.0", features = ["print-defmt"] }
|
||||
|
||||
embedded-hal = "1.0.0"
|
||||
embedded-hal-async = "1.0.0"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,31 @@ impl Drawable for Hal {
|
|||
where
|
||||
D: DrawTarget<Color = Self::Color>,
|
||||
{
|
||||
Image::new(&self.image_data, Point::zero()).draw(target)
|
||||
self.image_data.draw(target)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct HappyEyes {
|
||||
image_data: Tga<'static, Rgb888>,
|
||||
}
|
||||
|
||||
impl HappyEyes {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
image_data: Tga::from_slice(include_bytes!("assets/eye1.tga")).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drawable for HappyEyes {
|
||||
type Color = Rgb888;
|
||||
|
||||
type Output = ();
|
||||
|
||||
fn draw<D>(&self, target: &mut D) -> Result<Self::Output, D::Error>
|
||||
where
|
||||
D: DrawTarget<Color = Self::Color>,
|
||||
{
|
||||
self.image_data.draw(target)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
firmware/src/assets/eye1.tga
Normal file
BIN
firmware/src/assets/eye1.tga
Normal file
Binary file not shown.
|
|
@ -4,6 +4,8 @@
|
|||
mod art;
|
||||
mod led_matrix;
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_futures::select::select_array;
|
||||
use embassy_rp::bind_interrupts;
|
||||
|
|
@ -13,28 +15,25 @@ use embassy_rp::pio::Pio;
|
|||
use embassy_rp::pio_programs::ws2812::{PioWs2812, PioWs2812Program};
|
||||
use embassy_rp::pwm::{self, Pwm};
|
||||
use embassy_rp::rom_data::reset_to_usb_boot;
|
||||
use embassy_rp::spi::{self, Blocking, Spi};
|
||||
use embassy_time::Delay;
|
||||
use embedded_graphics::image::{Image, ImageRawLE};
|
||||
use embedded_graphics::mono_font::MonoTextStyle;
|
||||
use embedded_graphics::mono_font::ascii::FONT_10X20;
|
||||
use embedded_graphics::pixelcolor::{Rgb565, Rgb888};
|
||||
use embedded_graphics::prelude::*;
|
||||
use embedded_graphics::primitives::{PrimitiveStyleBuilder, Rectangle};
|
||||
use embedded_graphics::text::Text;
|
||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||
use heapless::String;
|
||||
use mipidsi::interface::SpiInterface;
|
||||
use mipidsi::models::ST7789;
|
||||
use mipidsi::options::Orientation;
|
||||
|
||||
use crate::art::Hal;
|
||||
use crate::art::{Hal, HappyEyes};
|
||||
use crate::led_matrix::{LedMatrix, Serpentine};
|
||||
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
use embassy_rp::spi::{self, Blocking, Spi};
|
||||
use embedded_graphics::image::{Image, ImageRawLE};
|
||||
use embedded_graphics::mono_font::MonoTextStyle;
|
||||
use embedded_graphics::mono_font::ascii::FONT_10X20;
|
||||
use embedded_graphics::pixelcolor::{Rgb565, Rgb888};
|
||||
use embedded_graphics::prelude::*;
|
||||
use embedded_graphics::text::Text;
|
||||
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
use defmt_rtt as _;
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
PIO0_IRQ_0 => embassy_rp::pio::InterruptHandler<PIO0>;
|
||||
|
|
@ -143,8 +142,9 @@ async fn main(spawner: Spawner) -> ! {
|
|||
.draw(&mut led_surface)
|
||||
.ok();
|
||||
*/
|
||||
let hal = Hal::new();
|
||||
hal.draw(&mut led_surface).ok();
|
||||
// let hal = Hal::new();
|
||||
let eyes = HappyEyes::new();
|
||||
eyes.draw(&mut led_surface).ok();
|
||||
led_surface.sync().await;
|
||||
|
||||
let mut render = |f_keys: [bool; 4]| {
|
||||
|
|
@ -191,3 +191,9 @@ async fn dfu_button(mut btn_y: Input<'static>) {
|
|||
btn_y.wait_for_falling_edge().await;
|
||||
reset_to_usb_boot(0, 0);
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_info: &PanicInfo) -> ! {
|
||||
reset_to_usb_boot(0, 0);
|
||||
loop {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue