Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Changelog updated
uses: Zomzog/changelog-checker@v1.1.0
uses: Zomzog/changelog-checker@v1.2.0
with:
fileName: CHANGELOG.md
env:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ on:
push:
branches: [ staging, trying, master ]
pull_request:
merge_group:

name: Continuous integration

Expand All @@ -17,14 +18,17 @@ jobs:
experimental: true

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- name: Checkout code
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: thumbv6m-none-eabi
override: true

- name: Regular build
run: python tools/check.py

Expand Down
87 changes: 86 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,91 @@

All notable changes to this project will be documented in this file.

## v0.2.0

This version depends on py32-rs v0.2.0 or later

### Added

- added optional feature "rtic" to implement `rtic-monotonic::Monotonic` trait on timers.
- added optional feature "defmt" to implement `defmt::Format` trait on Errors in various modules
- added feature "with-dma" for internal use to simplify dma related code
- added module `dma`
- module `gpio` has the following new types and traits:
* Struct `PartiallyErasedPin` and `ErasedPin` replaces previous `Pin`
* Struct `DynamicPin` allows pin to swap between an `Input` and `Output` pin during runtime at the cost of possible runtime errors
* Trait `ExtiPin` allows connecting a pin to EXTI lines for interrupt and event handling
* Struct `Debugger` marks pins that upon bootup are dedicated to the DBG peripheral, must be `activate` before use as a gpio
* Trait `PinExt` adds functions to retrieve pin number and port id ('A', 'B', etc)
- gpio Pins can be temporarily mode changed to do an action, using these methods:
* `as_push_pull_output`
* `as_push_pull_output_with_state`
* `as_open_drain_output`
* `as_open_drain_output_with_state`
* `as_floating_input`
* `as_pull_up_input`
* `as_pull_down_input`
- module `rcc`
* new traits and implementations `Enable`, `Reset`, `BusClock`, `BusTimerClock`, `RccBus`
* added function `debug_stop_mode` for control of clock function in sleep and stop conditions
- added module `rtc` and examples thereof
- module `serial`
* Implemented embedded-hal v1.0 nb::Read/Write traits
* Implemented embedded-hal v1.0 io::Write trait
* Implemented `with_dma` methods, so Rx/Tx can use DMA
* Added `SerialExt` trait and implementations for construction methods
* Can configure stop bits, parity, word length
* added `reconfigure`
- module `spi`
* Implemented embedded-hal v1.0 SpiBus, nb, and blocking, traits
* Implemented `with_dma` methods, both Rx/Tx can use DMA, separately and together
* Added `SpiExt` trait and implementations for construction methods
* Works with both 8 and 16 bit words, though 16bit not tested
* Added `SpiSlave` for slave functionality, though it is not tested
* Added frame size conversion methods, [ex: `frame_size_8_bit`]
- module `timer`
* Old module `timers` was removed. Now follows both hal 1.0 and 0.2.7 traits

### Changed

- Fixed repo url's
- Changed all examples to use new api's where necessary, and to remove code structure that was causing much of the example to be optimized away
- module `adc` changed to use new rcc enable, reset, and bus frequencies
- module `gpio`
* pin `into_<mode>` fns have removed the atomic context parameter which is not needed depending on what OS is used
* implemented `split_without_reset`
* Pin type doesn't represent an erased pin, but the most specific type of pin, see Added above
* embedded-hal v0.2.7 traits moved to gpio/hal_02 module
- module `i2c` changed to use rcc enable, reset, and bus frequencies
- module `prelude` removed all embedded-hal traits
- module `pwm` changed to use rcc enable, reset, and bus frequencies
- module `serial`
* embedded-hal v0.2.7 trait implementations moved to serial/hal_02 module
* changed to use rcc enable, reset, and bus frequencies
- module `spi`
* embedded-hal v0.2.7 trait implementations moved to spi/hal_02 module
* changed to use rcc enable, reset, and bus frequencies
- module `time` changed to use fugit crate, this alters how you specify frequency, ie, hz -> Hz, etc

### Removed

- `delay` and `timers` modules removed, the functionality is in the `timer` module now
- `spi::Event::Crc` removed, as that doesn't exist on this micro
- `timers` module removed, replaced by `timer`

### Fixed

- Fixed github action `changelog.yml`
- Fixed github action `ci.yml`
- Fixed `tool/check.py`

## v0.1.1 - 2024-10-10

## V0.1.0 - 2024-09-07

## v0.0.1 - 2023-06-10

- Original Release

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

49 changes: 33 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
[package]
edition = "2018"
name = "py32f0xx-hal"
version = "0.2.0"
authors = [
"Daniel Egger <daniel@eggers-club.de>",
"Thomas Bytheway <github@harkonen.net>",
"Jesse Braham <jesse@beta7.io>",
"creatoy@yeah.net",
"Greg Green <ggreen@bit-builder.com>",
]
categories = ["embedded", "hardware-support", "no-std"]
description = "Peripheral access API for py32F0 series microcontrollers"
documentation = "https://docs.rs/crate/py32f0xx-hal"
edition = "2021"

keywords = ["arm", "cortex-m", "py32f0xx", "hal"]
license = "0BSD"
name = "py32f0xx-hal"
readme = "README.md"
repository = "https://github.com/creatoy/py32f0xx-hal"
version = "0.1.1"
repository = "https://github.com/py32-rust/py32f0xx-hal"
categories = ["embedded", "hardware-support", "no-std"]
description = "Peripheral access API for py32F0 series microcontrollers"
documentation = "https://docs.rs/crate/py32f0xx-hal"

[package.metadata.docs.rs]
features = ["py32f030", "rt"]
Expand All @@ -24,14 +23,24 @@ targets = ["thumbv6m-none-eabi"]
bare-metal = { version = "1.0.0" }
cast = "0.3.0"
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
embedded-hal = { version = "0.2.7", features = ["unproven"] }
py32f0 = "0.2.0"
embedded-hal = "1.0"
embedded-hal-nb = "1.0"
embedded-dma = "0.2.0"
embedded-io = "0.6.1"
embedded-time = "0.12.1"
nb = "1.1.0"
void = { version = "1.0.2", default-features = false }
defmt = { version = "0.3.8", optional = true }
bitflags = "1.3.2"
fugit = "0.3.7"
fugit-timer = "0.1.3"
rtic-monotonic = { version = "1.0", optional = true }

[dependencies.py32f0]
version = "0.1.1"
features = []
[dependencies.embedded-hal-02]
package = "embedded-hal"
version = "0.2.7"
features = ["unproven"]

[dev-dependencies]
cortex-m-rt = "0.7.3"
Expand All @@ -44,11 +53,13 @@ mfrc522 = "0.6.1"
[features]
device-selected = []
rt = ["py32f0/rt"]
py32f030 = ["py32f0/py32f030", "device-selected"]
py32f003 = ["py32f0/py32f003", "device-selected"]
py32f030 = ["py32f0/py32f030", "device-selected", "with-dma"]
py32f003 = ["py32f0/py32f003", "device-selected", "with-dma"]
py32f002a = ["py32f0/py32f002a", "device-selected"]
py32f002b = ["py32f0/py32f002b", "device-selected"]

defmt = ["dep:defmt"]

# Features based on Flash size (in kbytes)
flash-16 = []
flash-20 = []
Expand All @@ -64,6 +75,9 @@ ram-4 = []
ram-6 = []
ram-8 = []

# optional peripherals
with-dma = []

# MCU aliases
#
# Features correspond specific mcu series
Expand All @@ -81,6 +95,9 @@ py32f003xx8 = ["py32f003", "flash-64", "ram-8"]
py32f002ax5 = ["py32f002a", "flash-20", "ram-3"]
py32f002bx5 = ["py32f002b", "flash-24", "ram-3"]

# rtic os
rtic = ["dep:rtic-monotonic"]

[profile.dev]
debug = true
lto = true
Expand Down
40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
py32f0xx-hal
=============

> This repo is modified from [stm32f0xx-hal](https://github.com/stm32-rs/stm32f0xx-hal)
> [HAL] for the py32f0xx family of microcontrollers

> **NOTE: The function is not fully tested, and you are responsible for any problems with the use of this repository.**
> **NOTE: The function's are not fully tested, and you are responsible for any problems with the use of this repository.**

Known issue:
- I2C not work
Known issues:
- I2C master/slave not tested
- rtc not tested

[![Continuous integration](https://github.com/creatoy/py32f0xx-hal/workflows/Continuous%20integration/badge.svg)](https://github.com/creatoy/py32f0xx-hal)
[![Crates.io](https://img.shields.io/crates/d/py32f0xx-hal.svg)](https://crates.io/crates/py32f0xx-hal)
[![Crates.io](https://img.shields.io/crates/v/py32f0xx-hal.svg)](https://crates.io/crates/py32f0xx-hal)
[![docs.rs](https://docs.rs/py32f0xx-hal/badge.svg)](https://docs.rs/py32f0xx-hal/)
[![dependency status](https://deps.rs/repo/github/[py32-rust/py32f0xx-hal/status.svg)](https://deps.rs/repo/github/py32-rust/py32f0xx-hal)
[![Continuous integration](https://github.com/creatoy/py32f0xx-hal/workflows/Continuous%20integration/badge.svg)](https://github.com/py32-rust/py32f0xx-hal)

[_py32f0xx-hal_](https://github.com/creatoy/py32f0xx-hal) contains a hardware abstraction on top of the peripheral access API for the puyasemi PY32F0xx family of microcontrollers.
[_py32f0xx-hal_](https://github.com/py32-rust/py32f0xx-hal) contains a hardware abstraction on top of the peripheral access API for the puyasemi PY32F0xx family of microcontrollers.

Collaboration on this crate is highly welcome, as are pull requests!

Supported
------------------------

* __py32f030__ (py32f030xx4, py32f030xx6, py32f030xx7, py32f030xx8)
* __py32f003__ (py32f003xx4, py32f003xx6, py32f030xx8)
* __py32f002a__ (py32f002ax5)
* __py32f002b__ (py32f002bx5)
* __py32f030__ (py32f030xx4, py32f030xx6, py32f030xx7, py32f030xx8)
* __py32f003__ (py32f003xx4, py32f003xx6, py32f030xx8)
* __py32f002a__ (py32f002ax5)
* __py32f002b__ (py32f002bx5)

Getting Started
---------------
Expand All @@ -34,16 +37,20 @@ $ cargo build --features=py32f002ax5 --example=blinky
To use py32f0xx-hal as a dependency in a standalone project the target device feature must be specified in the `Cargo.toml` file:
```
[dependencies]
embedded-hal = "1"
nb = "1"
cortex-m = "0.7.7"
cortex-m-rt = "0.7.3"
py32f0xx-hal = { version = "0.1.0", features = ["py32f002ax5"]}
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
panic-halt = "0.2.0"
py32f0xx-hal = { version = "0.2.0", features = ["py32f002ax5"]}
```

If you are unfamiliar with embedded development using Rust, there are a number of fantastic resources available to help.

- [Embedded Rust Documentation](https://docs.rust-embedded.org/)
- [The Embedded Rust Book](https://docs.rust-embedded.org/book/)
- [Rust Embedded FAQ](https://docs.rust-embedded.org/faq.html)
- [Embedded Rust Documentation](https://docs.rust-embedded.org/)
- [The Embedded Rust Book](https://docs.rust-embedded.org/book/)
- [Rust Embedded FAQ](https://docs.rust-embedded.org/faq.html)
- [rust-embedded/awesome-embedded-rust](https://github.com/rust-embedded/awesome-embedded-rust)


Expand All @@ -58,6 +65,11 @@ Changelog
See [CHANGELOG.md](CHANGELOG.md).


Credits
-------

> This repo was inspired by [stm32f0xx-hal](https://github.com/stm32-rs/stm32f0xx-hal) and [stm32f1xx-hal](https://github.com/stm32-rs/stm32f1xx-hal)

License
-------

Expand Down
Loading
Loading