imxrt-rs / imxrt-iomuxc

Pin definitions, configurations, and multiplexing API
Apache License 2.0
1 stars 14 forks source link

Add I2S/SAI pad info #3

Closed lkolbly closed 3 years ago

lkolbly commented 3 years ago

This adds traits and impls for the SAI peripherals. (also, it updates the Cargo.toml to point at this repo)

This is very 106x-specific, should I wrap it in a cfg(feature = "imxrt106x")? That's the only feature in the crate (on the v0.1 branch), so I'm not sure. The 1010 I believe does have some (2?) SAI peripherals, and the pads are almost certainly not the same.

SAI3 overlaps on several pins with SAI1, so adding it complains about re-implementing a few traits. There may be a clever way around this (in particular, the traits could be split into separate e.g. RxSyncPin and RxBclkPin traits), I can do that if we want but I don't feel a pressing need to do so right now. Also the daisy names are different for some reason.

Testing-wise, I've only tested this with SAI1 in one-bit TX mode, with a specific set of pins. I tried to copy the table as closely as possible.

teburd commented 3 years ago

Really happy to see this happening!

lkolbly commented 3 years ago

I need to look closer at the SAI pads and alts from the reference doc

Please do and take your time, the 3s and the 8s blend together on my screen. :D

lkolbly commented 3 years ago

I took your branch and started playing around with these ideas. Check out the sai-i2s branch if you want to see what it looks like.

Awesome, that branch looks pretty reasonable to me! I agree that the macro is cleaner than a build script.

I think we will need associated types for the indexes though, rather than consts.

mciantyre commented 3 years ago

Agreed on keeping typenums for data line indices! Pushed a corresponding commit to the sai-i2s branch in this remote.