mciantyre / teensy4-rs

Rust support for the Teensy 4
Apache License 2.0
291 stars 32 forks source link

Add FlexIO registers to Resources object #140

Closed Finomnis closed 1 year ago

Finomnis commented 1 year ago

All three FlexIO drivers are connected to pins that are available on the Teensy4.0.

Examples:

This change is related to https://github.com/imxrt-rs/imxrt-iomuxc/pull/37.

A driver in imxrt-hal does not exist yet and most likely never will, because FlexIO is just simply too generic. So most likely there will be usecase-specific drivers in separate crates.

Like my usecase; I am in the process of writing a ws2812-flexio driver crate for Neopixel LED Strips.

mciantyre commented 1 year ago

Now that we have clock gates available in imxrt-hal, should we ensure that the FlexIO clock gates are on? This would be consistent with the board's clock policy.

I agree that this peripheral is flexible, so I'm indifferent about making board choose the root clocks and FlexIO input clock frequencies. If we want to skip this, we could document an exception for the FlexIO peripheral. Otherwise, we could choose default clocks and frequencies. It's OK to use imxrt-ral for clock changes until there's corresponding APIs in imxrt-hal.

https://github.com/mciantyre/teensy4-rs/blob/e6eb36d5e73cb018209a9836bd3da32a6c4dd4ef/src/board.rs#L54-L62

Finomnis commented 1 year ago

Now that we have clock gates available in imxrt-hal, should we ensure that the FlexIO clock gates are on? This would be consistent with the board's clock policy.

That would make sense. FlexIO does have default clock frequencies which are specified in the documentation. (see the black dot next to the muxes)

Finomnis commented 1 year ago

@mciantyre Done :)

Finomnis commented 1 year ago

@mciantyre Any news on this? :)

Finomnis commented 1 year ago

@mciantyre Great! Thanks a lot for your collaboration. I highly appreciate the work you do for this community.