5 unstable releases
0.2.0 | Dec 10, 2024 |
---|---|
0.1.1 | Dec 1, 2024 |
0.1.0 | Nov 21, 2024 |
0.0.1 | Nov 6, 2024 |
0.0.0 | Mar 12, 2024 |
#92 in Embedded development
503 downloads per month
460KB
8K
SLoC
py32-hal
Note This project is under development. While it's usable for experimentation and testing, it may not be fully stable for production environments. We welcome user feedback and encourage reporting any issues you encounter to help improve the hal crate.
This HAL crates is the Embassy framework driver for Puya microcontrollers.
This HAL crates uses the metapac approach to support multiple chips in the same crate.
The metapac is maintained in the py32-rs/py32-data repository, published as a crate py32-metapac
.
Keypoints:
- Embassy support
- All-in-one metapac for peripheral register access, check py32-data for more
- All-in-one HAL crate, no need to create a new crate for each chip
- Async drivers, with async/await support, DMA(TODO) support
- Write once, run on all supported chips(should be)
Supported Devices and Peripherals
Currently, supported chips are listed in Cargo.toml
as feature flags.
Supported chip flags: py32f030f16
, py32f030k28
, py32f072c1b
, More is coming...
Note: Currently the program behavior has nothing to do with chip packaging.
Others should work if you are careful as most peripherals are similar enough.In fact, the IPs of peripherals in different PY32 series may be consistent. Moreover, some series use the same die, so it might not require much work.
For a full list of chip capabilities and peripherals, check the py32-data repository.
Family | F002B/L020/F001 | F030/F003/F002A | F040/F07x/MD410 | F403 |
---|---|---|---|---|
Embassy | ✅ | ✅ | ||
RCC | ✅ | ✅ | ||
GPIO | ✅ | ✅ | ||
INTERRUPT | ✅ | ✅ | ||
DMA | N/A | |||
EXTI | ✅+ | ❓ | ||
USART | ✅ | ❓ | ||
I2C | ✅ | ❓ | ||
SPI | ||||
ADC | ✅+ | ✅ | ||
RTC | ||||
Timer(PWM) | ✅ | ❓ | ||
USB | N/A | N/A | ✅+ |
- ✅ : Implemented
- Blank : Not implemented
- ❓ : Requires demo verification
+
: Async support- N/A : Not available
TODOs
Too many...
-
DMA support (channel map, codegen, API, RingBuffer, I2C...)
-
Test F072 peripherals
-
HSE test and examples
-
Other series
-
SPI, RTC
-
F072 TIM2(GP32) support
-
...
time-driver
This crate provides an implementation of the Embassy time-driver
.
Embassy requires that any TIM used as a time-driver has at least two channels, so only TIM1 and TIM3 are available for the PY32F030, 003, and 002A series. You can select either time-driver-tim3
or time-driver-tim1
to specify the TIM to use.
time-driver-systick
: Although we do not recommend using it and there are some shortcomings, it does work. For details, please see systick-demo
For PY32F07x, F040, you can use TIM15, TIM3 or TIM1.
Minimum supported Rust version(MSRV)
This project is developed with a recent nightly version of Rust compiler. And is expected to work with beta versions of Rust.
Feel free to change this if you did some testing with some version of Rust.
Contributing
All kinds of contributions are welcome.
- Share your project at Discussions
- if your project is an open-source project, consider adding it to the awesome list (TODO)
- Support new MCUs.
- README and Documentation, including doc comments in code
- Writing demo code for peripherals
- Revising the peripheral definitions at py32-data
- Adding new peripheral drivers
- ...
License
This project is licensed under the MIT or Apache-2.0 license, at your option.
Some peripheral driver code has been modified from [embassy-stm32](embassy/embassy-stm32 at main · embassy-rs/embassy). Big thanks to this project and its awesome contributors!
Dependencies
~6.5MB
~126K SLoC