Skip to content

Commit

Permalink
Add full duplex I2S trait
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed Jul 14, 2020
1 parent 3f3f848 commit 2ed300c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/i2s.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! I2S - Inter-IC Sound Interface
use nb;

/// Full duplex
pub trait FullDuplex<Word> {
/// Error type
type Error;

/// Reads the left word and right word available.
///
/// The order is in the result is `(left_word, right_word)`
fn try_read(&mut self) -> nb::Result<(Word, Word), Self::Error>;

/// Sends a left word and a right word to the slave.
fn try_send(&mut self, left_word: Word, right_word: Word) -> nb::Result<(), Self::Error>;
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ pub mod blocking;
pub mod capture;
pub mod digital;
pub mod fmt;
pub mod i2s;
pub mod prelude;
pub mod pwm;
pub mod qei;
Expand Down
1 change: 1 addition & 0 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub use crate::digital::InputPin as _embedded_hal_digital_InputPin;
pub use crate::digital::OutputPin as _embedded_hal_digital_OutputPin;
pub use crate::digital::StatefulOutputPin as _embedded_hal_digital_StatefulOutputPin;
pub use crate::digital::ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin;
pub use crate::i2s::FullDuplex as _embedded_hal_i2s_FullDuplex;
pub use crate::pwm::Pwm as _embedded_hal_Pwm;
pub use crate::pwm::PwmPin as _embedded_hal_PwmPin;
pub use crate::qei::Qei as _embedded_hal_Qei;
Expand Down

0 comments on commit 2ed300c

Please sign in to comment.