Remove some unused stuff
This commit is contained in:
parent
87ab09db96
commit
f12802eb3c
50
src/main.rs
50
src/main.rs
@ -4,62 +4,20 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::convert::Infallible;
|
||||
|
||||
use atmega_hal::{
|
||||
Spi, Usart,
|
||||
port::{self, Pin, PinOps, mode},
|
||||
prelude::_embedded_hal_blocking_spi_Write,
|
||||
spi::{self, ChipSelectPin, Settings},
|
||||
Usart,
|
||||
spi::{self, Settings},
|
||||
usart::Baudrate,
|
||||
};
|
||||
use embedded_hal::spi::{Operation, SpiBus};
|
||||
use embedded_hal::{delay::DelayNs, digital::OutputPin};
|
||||
use embedded_hal::delay::DelayNs;
|
||||
use panic_halt as _;
|
||||
|
||||
use crate::display::{Color, Display, Position, Rgb565};
|
||||
use crate::display::{Display, Position, Rgb565};
|
||||
|
||||
mod display;
|
||||
|
||||
type CoreClock = atmega_hal::clock::MHz8;
|
||||
|
||||
struct Device<T: DelayNs> {
|
||||
spi: Spi,
|
||||
delay: T,
|
||||
}
|
||||
|
||||
impl<T: DelayNs> embedded_hal::spi::ErrorType for Device<T> {
|
||||
type Error = Infallible;
|
||||
}
|
||||
|
||||
impl<T: DelayNs> embedded_hal::spi::SpiDevice for Device<T> {
|
||||
fn transaction(
|
||||
&mut self,
|
||||
operations: &mut [embedded_hal::spi::Operation<'_, u8>],
|
||||
) -> Result<(), Self::Error> {
|
||||
for op in operations {
|
||||
match op {
|
||||
Operation::Read(items) => {
|
||||
self.spi.read(*items)?;
|
||||
}
|
||||
Operation::Write(items) => {
|
||||
SpiBus::write(&mut self.spi, *items)?;
|
||||
}
|
||||
Operation::Transfer(read, write) => {
|
||||
self.spi.transfer(read, write)?;
|
||||
}
|
||||
Operation::TransferInPlace(items) => {
|
||||
self.spi.transfer_in_place(items)?;
|
||||
}
|
||||
Operation::DelayNs(time) => {
|
||||
self.delay.delay_ns(*time);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[avr_device::entry]
|
||||
fn main() -> ! {
|
||||
let dp = atmega_hal::Peripherals::take().unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user