mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
cargo +nightly fmt
This commit is contained in:
parent
fc978c2ee9
commit
c7f7728eb1
@ -1,15 +1,13 @@
|
|||||||
//! Pio backed I2s output
|
//! Pio backed I2s output
|
||||||
|
|
||||||
use crate::{
|
|
||||||
dma::{AnyChannel, Channel, Transfer},
|
|
||||||
into_ref,
|
|
||||||
pio::{
|
|
||||||
Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
|
|
||||||
},
|
|
||||||
Peripheral, PeripheralRef,
|
|
||||||
};
|
|
||||||
use fixed::traits::ToFixed;
|
use fixed::traits::ToFixed;
|
||||||
|
|
||||||
|
use crate::dma::{AnyChannel, Channel, Transfer};
|
||||||
|
use crate::pio::{
|
||||||
|
Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
|
||||||
|
};
|
||||||
|
use crate::{into_ref, Peripheral, PeripheralRef};
|
||||||
|
|
||||||
/// This struct represents an i2s output driver program
|
/// This struct represents an i2s output driver program
|
||||||
pub struct PioI2sOutProgram<'a, PIO: Instance> {
|
pub struct PioI2sOutProgram<'a, PIO: Instance> {
|
||||||
prg: LoadedProgram<'a, PIO>,
|
prg: LoadedProgram<'a, PIO>,
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
|
|
||||||
use crate::{
|
|
||||||
clocks,
|
|
||||||
gpio::Level,
|
|
||||||
pio::{Common, Config, Direction, Instance, LoadedProgram, PioPin, StateMachine},
|
|
||||||
};
|
|
||||||
use pio::InstructionOperands;
|
use pio::InstructionOperands;
|
||||||
|
|
||||||
|
use crate::clocks;
|
||||||
|
use crate::gpio::Level;
|
||||||
|
use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, PioPin, StateMachine};
|
||||||
|
|
||||||
fn to_pio_cycles(duration: Duration) -> u32 {
|
fn to_pio_cycles(duration: Duration) -> u32 {
|
||||||
(clocks::clk_sys_freq() / 1_000_000) / 3 * duration.as_micros() as u32 // parentheses are required to prevent overflow
|
(clocks::clk_sys_freq() / 1_000_000) / 3 * duration.as_micros() as u32 // parentheses are required to prevent overflow
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
//! PIO backed quadrature encoder
|
//! PIO backed quadrature encoder
|
||||||
|
|
||||||
|
use fixed::traits::ToFixed;
|
||||||
|
|
||||||
use crate::gpio::Pull;
|
use crate::gpio::Pull;
|
||||||
use crate::pio::{self, Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine};
|
use crate::pio::{self, Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine};
|
||||||
use fixed::traits::ToFixed;
|
|
||||||
|
|
||||||
/// This struct represents an Encoder program loaded into pio instruction memory.
|
/// This struct represents an Encoder program loaded into pio instruction memory.
|
||||||
pub struct PioEncoderProgram<'a, PIO: Instance> {
|
pub struct PioEncoderProgram<'a, PIO: Instance> {
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
use core::mem::{self, MaybeUninit};
|
use core::mem::{self, MaybeUninit};
|
||||||
|
|
||||||
use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine};
|
|
||||||
use fixed::traits::ToFixed;
|
use fixed::traits::ToFixed;
|
||||||
use fixed::types::extra::U8;
|
use fixed::types::extra::U8;
|
||||||
use fixed::FixedU32;
|
use fixed::FixedU32;
|
||||||
|
|
||||||
|
use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine};
|
||||||
|
|
||||||
/// This struct represents a Stepper driver program loaded into pio instruction memory.
|
/// This struct represents a Stepper driver program loaded into pio instruction memory.
|
||||||
pub struct PioStepperProgram<'a, PIO: Instance> {
|
pub struct PioStepperProgram<'a, PIO: Instance> {
|
||||||
prg: LoadedProgram<'a, PIO>,
|
prg: LoadedProgram<'a, PIO>,
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
//! Pio backed uart drivers
|
//! Pio backed uart drivers
|
||||||
|
|
||||||
use crate::{
|
|
||||||
clocks::clk_sys_freq,
|
|
||||||
gpio::Level,
|
|
||||||
pio::{
|
|
||||||
Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection,
|
|
||||||
StateMachine,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
use core::convert::Infallible;
|
use core::convert::Infallible;
|
||||||
|
|
||||||
use embedded_io_async::{ErrorType, Read, Write};
|
use embedded_io_async::{ErrorType, Read, Write};
|
||||||
use fixed::traits::ToFixed;
|
use fixed::traits::ToFixed;
|
||||||
|
|
||||||
|
use crate::clocks::clk_sys_freq;
|
||||||
|
use crate::gpio::Level;
|
||||||
|
use crate::pio::{
|
||||||
|
Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine,
|
||||||
|
};
|
||||||
|
|
||||||
/// This struct represents a uart tx program loaded into pio instruction memory.
|
/// This struct represents a uart tx program loaded into pio instruction memory.
|
||||||
pub struct PioUartTxProgram<'a, PIO: Instance> {
|
pub struct PioUartTxProgram<'a, PIO: Instance> {
|
||||||
prg: LoadedProgram<'a, PIO>,
|
prg: LoadedProgram<'a, PIO>,
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
//! [ws2812](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf)
|
//! [ws2812](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf)
|
||||||
|
|
||||||
use crate::{
|
|
||||||
clocks::clk_sys_freq,
|
|
||||||
dma::{AnyChannel, Channel},
|
|
||||||
into_ref,
|
|
||||||
pio::{Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine},
|
|
||||||
Peripheral, PeripheralRef,
|
|
||||||
};
|
|
||||||
use embassy_time::Timer;
|
use embassy_time::Timer;
|
||||||
use fixed::types::U24F8;
|
use fixed::types::U24F8;
|
||||||
use smart_leds::RGB8;
|
use smart_leds::RGB8;
|
||||||
|
|
||||||
|
use crate::clocks::clk_sys_freq;
|
||||||
|
use crate::dma::{AnyChannel, Channel};
|
||||||
|
use crate::pio::{
|
||||||
|
Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
|
||||||
|
};
|
||||||
|
use crate::{into_ref, Peripheral, PeripheralRef};
|
||||||
|
|
||||||
const T1: u8 = 2; // start bit
|
const T1: u8 = 2; // start bit
|
||||||
const T2: u8 = 5; // data bit
|
const T2: u8 = 5; // data bit
|
||||||
const T3: u8 = 3; // stop bit
|
const T3: u8 = 3; // stop bit
|
||||||
|
Loading…
Reference in New Issue
Block a user