Skip to content

Conversation

gpgreen
Copy link
Contributor

@gpgreen gpgreen commented Dec 2, 2024

The visible changes to existing code would be removing the atomic context from gpio pin type creation, as this is dependent on what operating system you are using, plus using that idiom would require using it in a lot of other calls as well, not just gpio. Also how serial and spi hal structs are created. The embedded-hal traits were removed from prelude.rs, as it depends on what one you want to use.

I intend to work on the timers also, as there is a lot of stuff missing.

The authors in Cargo.toml don't have anything to do with this repo, correct? They are there because you started out from an existing repository? I think that mentioning that this repo is based on their work, and referencing that in the README would be better. I based a lot of my changes on the stm32f1xx-hal github repo, as I had used that one previously and it worked ok. I didn't mention that anywhere in my changes, even though it should be mentioned as it is based on that work.

Added dma.
Removed critical sections from gpio pins as this is really os
dependent.
Commented out modules: adc, i2c, pwm, timers, watchdog as they aren't
yet converted.
modules gpio, serial, spi are converted to embedded hal 1.0
Added embedded-hal 1.0, embedded-hal-nb 1.0, embedded-io 0.6
Renamed embedded-hal 0.2.7 to embedded-hal-02
Added 'with-dma' feature to ease code use with dma module
adc module now uses embedded-hal-02 only
delay module uses embedded-hal-02 only
Added peripheral mapping to dma module
Fixed bug with clearing DMA flags for a channel
Changed types of DMA channels to use channel numbers from 1-3 instead
of the array offsets 0-2, eases downstream code use
Converted gpio mod to use embedded-hal 1 and 0.2 both
Added EXTI interrupt code to gpio mod.
Added port identifier to Pin structs for use in EXTI setup
i2c module uses embedded-hal-02 only
Adjusted prelude mod to remove embedded-hal traits
pwm mod uses embedded-hal-02 only
Added enable mod to rcc mod.
Added traits BusClock, BusTimerClock, Enable, Reset to rcc mod
enable module also seals all peripherals
serial mod uses embedded-hal 1 and 0.2 both, and can use DMA
spi mod uses embedded-hal 1 and 0.2 both, and can use DMA
spi now has slave functions, but not tested
timers mod uses embedded-hal 0.2 only
watchdog mod uses embedded-hal 0.2 only
adc mod uses enable and reset
added hal_02 module to gpio
i2c mod implements Instance trait, uses enable, reset, busclock
pwm mod uses enable and reset, bustimerclock
added hal_02 module to spi
timers mod implements Instance trait, uses enable, reset bustimerclock
All examples updated to compile with no warnings
Fixed typo in adc_values example
Added listen/unlisten to dma Transfers so interrupts can be used
Removed unused parameter in gpio! macro
Filled out CHANGELOG.md
Altered examples to use changed gpio module
Added module rtc and 2 examples
Added 'disable_dbg' method to Rcc
Deleted timers and delay modules, functionality in new modules
time module converted to use fugit
All code converted to use fugit rates instead of old time module
functions
@creatoy
Copy link
Collaborator

creatoy commented Dec 18, 2024

The visible changes to existing code would be removing the atomic context from gpio pin type creation, as this is dependent on what operating system you are using, plus using that idiom would require using it in a lot of other calls as well, not just gpio. Also how serial and spi hal structs are created. The embedded-hal traits were removed from prelude.rs, as it depends on what one you want to use.

Great, these changes will make this crate even better.

The authors in Cargo.toml don't have anything to do with this repo, correct? They are there because you started out from an existing repository? I think that mentioning that this repo is based on their work, and referencing that in the README would be better. I based a lot of my changes on the stm32f1xx-hal github repo, as I had used that one previously and it worked ok. I didn't mention that anywhere in my changes, even though it should be mentioned as it is based on that work.

Yes, it would be better to mention it in the readme.

In addition, since I no longer use this series of chips, it is difficult to have time to maintain and test these code, and I would like to add you to the collaborators. In my opinion, your coding and maintenance skills are better than mine, and you can maintain them better. I can put these two repositories into a new organization, do you have any ideas?

@gpgreen
Copy link
Contributor Author

gpgreen commented Dec 19, 2024

Creating an organization would work. I have time to do the maintenance work for now at least. I don't agree that my coding and maintenance skills are better, I just merged the stm32f1xx-hal with what you had done. The 2 chip families are very similar, clearly Puya used stm32 as a guide. Rust is not an easy language for a person with a lot of experience in the 'old' way, Ha Ha. Even in computer science there is progress over time.

Fixed typos in Changelog
Updated edition to 2021
Fixed authors in Cargo.toml
Fixed chip feature in tools/capture* scripts
Fixed tools/check.py
Updated README.md
Deleted build.rs as it doesn't work with current features
Fixed github actions that didn't work
Set SYST clock source to sysclk for configure function
Fixed Clocks.sysclk initialization
Adjusted all examples to remove if let, and loop construct, the
compiler was optimizing out a lot of the example functionality due to
that code construction
@gpgreen gpgreen merged commit 98c9b1f into py32-rust:main Jan 22, 2025
3 of 5 checks passed
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.

2 participants