-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: DAC support with cs43l22 (for embedded-hal v0.2.x) #16
base: master
Are you sure you want to change the base?
Draft: DAC support with cs43l22 (for embedded-hal v0.2.x) #16
Conversation
632e2e5
to
5791e21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unable to get sound out of my board for your example, though I've got it to compile and run, and can hear sounds when I stop and start the code in gdb, is this change missing, or am I doing something wrong?
|
||
// Demonstrating decoupling of audio device and application code using the | ||
// embedded-hal trait for I2S. | ||
fn play_sawtooth(i2s: &mut impl Write<u16>) -> ! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a signed integer would make more sense here. I2s expects a signed integer, so a saw tooth happens to be the same, but it will be swapping to negative as it goes over 2^15 rather than when you're setting it back to 0, and other waves wont have the same shape.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can look into it, but I think the DAC expects unsigned data, and that audio data in general is unsigned. But I need to learn more about that to be sure.
} | ||
|
||
impl AudioOut { | ||
pub fn new<DELAY: DelayMs<u8>>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make more sense to pass the specific pins rather than the full gpio blocks. As it is all blocks get moved into the new method and then you can't any pins for anything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s done like this as that’s how it was done for the LED and accelerometer setup in this crate. I believe passing parts only moves the used pins after the function returns?
Hi, This is an interesting topic. I wonder how this is going? Are you still working on it? |
In the mean time I have published the traits as a separate crate: embedded-i2s |
Very nice @eldruin! |
@chaosprint Not much progress I’m afraid, been busy with other things. |
About VSCode:
|
Work in progress for the I2S embedded-hal trait (rust-embedded/embedded-hal#204). Just a sound playing demo using the I2S together with a driver for the DAC chip.