Skip to content
Discussion options

You must be logged in to vote

Hi! First of all, welcome here :)

You've taken up quite the challenge, these generic safety-through-typing abstractions are really hard to get right and require a lot of Rust and Rust macro wizardry...

If you just care about your specific application, I think it would be entirely reasonable to just wrap your code into a struct and be done with it:

pub struct PwmServoMotor {
    pin: Pin<Output, PB5>,
    timer: TC1,
}

The next step up is making this work for all timers and output pins. The code skeleton you've shown in your second method goes into the right direction. But you will need to implement this for a ton of timer/pin combinations so there really isn't much choice but to write a m…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mocrsteel
Comment options

@Rahix
Comment options

Answer selected by mocrsteel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants