- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
This tracking issue covers the integration of the crate with various embedded-hal
traits.
Current state of embedded_hal
in relation to what this crate needs:
- PWM:
embedded_hal::pwm::SetDutyCycle
- ADC: Tracking issue for ADC trait rust-embedded/embedded-hal#377
- Encoders
- For quadrature encoders: RFC: Introducing a common interface for counters. rust-embedded/wg#762
- For analog encoders - same as ADC.
- For digital encoders, various SPI/I2C implementations but all would require a separate crate for the driver.
Activity
Ben-PH commentedon Jun 5, 2024
With respect to the common interface for counters, I'm not so confident in that RFC anymore. The concept I had in mind when bringing it up was that there is a common notion of counting, and it applies to many things: time-passage, pulses, etc. basically, anything that exists as a count of discrete measures (clock ticks, angle measured by encoders, etc) could be counted, but rust-embedded has dictated that no generic assosciated types are allowed.
This means that if there was to be a common interface, there cannot be an assosciated type that describes what you are counting. it has to be u32 or u64, which in my mind, completely contradicts the notion of portability.
I think what I'll do is just make a generic counter. It won't be embedded-hal, but it will be portable.
calebfletcher commentedon Jun 5, 2024
@Ben-PH noted. For the moment I will likely be keeping the API such that the user supplies the angle directly, but that may change in the future.
Ben-PH commentedon Jun 5, 2024
This is an early prototype of the trait:
For me, it makes sense for this crate to fixate on the raw FOC utilities. If this crate provides the algorithms needed, they can form the foundation of a hardware implementation.
I'm for some
Simple FOC
hardware to arrive in the mail before trying out one such implementation I've been working on: https://github.com/Ben-PH/SimpleFOC-rs/tree/devI would be happy to collaborate.
calebfletcher commentedon Jun 8, 2024
Yeah I agree, my goal with this crate is to fill more of the algorithms side rather than dealing with the nitty-gritty of various hardware implementations. Your SimpleFOC work seems pretty interesting, and seeing how our two projects can interplay is definitely something I would be interested in pursuing.