Skip to content

Commit

Permalink
Merge pull request #24 from Dicklessgreat:Dicklessgreat/issue21
Browse files Browse the repository at this point in the history
add codec_pins! macro wifh #[cfg] macro to fix #21
  • Loading branch information
Dicklessgreat authored Sep 8, 2024
2 parents 2b927f9 + 4a2f8e3 commit ff9cabe
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,36 @@ pub fn default_rcc() -> hal::Config {
config
}

#[cfg(feature = "seed_1_1")]
#[macro_export]
macro_rules! codec_pins {
($p:ident) => {
daisy_embassy::CodecPins {
// For audio, I2C only needed for WM8731
SCL: $p.PH4,
SDA: $p.PB11,

MCLK_A: $p.PE2,
SCK_A: $p.PE5,
FS_A: $p.PE4,
SD_A: $p.PE6,
SD_B: $p.PE3,
}
};
}
#[cfg(feature = "seed_1_2")]
#[macro_export]
macro_rules! codec_pins {
($p:ident) => {
daisy_embassy::CodecPins {
MCLK_A: $p.PE2,
SCK_A: $p.PE5,
FS_A: $p.PE4,
SD_A: $p.PE6,
SD_B: $p.PE3,
}
};
}
#[macro_export]
macro_rules! new_daisy_board {
($p:ident) => {
Expand Down Expand Up @@ -133,19 +163,7 @@ macro_rules! new_daisy_board {

audio_peripherals: daisy_embassy::audio::AudioPeripherals {
codec: daisy_embassy::Codec {},
codec_pins: daisy_embassy::CodecPins {
// For audio, I2C only needed for WM8731
#[cfg(feature = "seed_1_1")]
SCL: $p.PH4,
#[cfg(feature = "seed_1_1")]
SDA: $p.PB11,

MCLK_A: $p.PE2,
SCK_A: $p.PE5,
FS_A: $p.PE4,
SD_A: $p.PE6,
SD_B: $p.PE3,
},
codec_pins: daisy_embassy::codec_pins!($p),
sai1: $p.SAI1,
i2c2: $p.I2C2,
dma1_ch0: $p.DMA1_CH0,
Expand Down

0 comments on commit ff9cabe

Please sign in to comment.