Skip to content

Conversation

@HybridChild
Copy link
Contributor

@HybridChild HybridChild commented Nov 7, 2025

Changes

Rename FrameOptions enum

  • Renames FrameOptions enum to PositionInTransaction with clearer variant names:
    • FirstAndLastFrameFirstAndFinal
    • FirstFrameFirstThenSwitch
    • FirstAndNextFrameFirstWithMore
    • NextFrameMiddle
    • LastFrameFinal
    • LastFrameNoStopLastBeforeSwitch
  • Renames operation_frames() to assign_position_in_transaction()
  • Enhances documentation with concrete examples and better structure
  • Clarifies the embedded-hal transaction contract implementation

Rationale
Clearer names = Code is more self documenting

Remove unnecessary wrapper enums

Remove unnecessary wrapper enums (Mode and Duty) in STM32 I2C v1 driver and use PAC types (i2c::vals::FS and i2c::vals::Duty) directly.

  • Replace custom Mode enum with i2c::vals::FS
  • Replace custom Duty enum with i2c::vals::Duty
  • Update Timings struct to store PAC types directly
  • Remove conversion methods (.f_s(), .duty())
  • Remove the PeriMode alias

Rationale
The wrapper enums served no purpose other than to convert between identical types. Using PAC types directly simplifies the code with no functional changes.

The PeriMode alias added confusing complexity because the term Mode did not mean the same thing for I2C v1 and v2.

Conclusion

No functional changes — purely a refactor, naming and documentation improvement.

@HybridChild
Copy link
Contributor Author

@lulf @Dirbaio

@HybridChild HybridChild changed the title Stm32 I2C v1 refactor Refactor/ stm32 I2C v1 Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant