Skip to content

Commit

Permalink
stm32-rs master 74a6df05c17396ee04cb2d5715eb4e19ed795e05
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Feb 19, 2025
0 parents commit 2c11276
Show file tree
Hide file tree
Showing 109,662 changed files with 22,396,274 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# STM32 Peripheral Access Crates - Nightly Builds

This repository contains automated builds of the [stm32-rs] crates, rebuilt
whenever a PR is merged to the master branch. Consult the [stm32-rs] README
for full details.

[stm32-rs]: https://github.com/stm32-rs/stm32-rs

## Using These Builds

Edit your `Cargo.toml`:

```toml
[dependencies.stm32f4]
git = "https://github.com/stm32-rs/stm32-rs-nightlies"
features = ["stm32f405", "rt"]
```

The nightlies should always build and be as stable as the latest release, but
typically with the latest patches and updates.


## Using These Builds With Cargo.lock

Since no commit history is stored in this repository (to keep download sizes
small), if you depend on a specific git commit (for example if one ends up
in your `Cargo.lock` file) it will eventually be removed from this repository,
breaking your build until you update.

For local development builds this shouldn't be a problem, but for CI systems
it might be annoying. The recommended solution is to fork this repository;
your fork will not update automatically and so will persist the commit you
use until you manually update the fork (either by pushing a new commit to it
or by deleting and re-forking it).
33 changes: 33 additions & 0 deletions stm32c0/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
edition = "2021"
name = "stm32c0"
version = "0.16.0"
authors = ["Adam Greig <[email protected]>", "stm32-rs Contributors"]
description = "Device support crates for STM32C0 devices"
repository = "https://github.com/stm32-rs/stm32-rs"
readme = "README.md"
keywords = ["stm32", "svd2rust", "no_std", "embedded"]
categories = ["embedded", "no-std"]
license = "MIT/Apache-2.0"
rust-version = "1.65"

[dependencies]
critical-section = { version = "1.0", optional = true }
cortex-m = "0.7.7"
cortex-m-rt = { version = "0.7.3", optional = true }
defmt = { version = "0.3.5", optional = true }
vcell = "0.1.3"
portable-atomic = { version = "1", default-features = false, optional = true }

[package.metadata.docs.rs]
features = ['atomics', 'critical-section', 'defmt', 'rt', 'stm32c011', 'stm32c031', 'stm32c071']
default-target = "thumbv6m-none-eabi"
targets = []

[features]
default = ["critical-section", "rt"]
rt = ["cortex-m-rt/device"]
atomics = ["dep:portable-atomic"]
stm32c011 = []
stm32c031 = []
stm32c071 = []
42 changes: 42 additions & 0 deletions stm32c0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# stm32c0
This crate provides an autogenerated API for access to STM32C0 peripherals.
The API is generated using [svd2rust] with patched svd files containing
extensive type-safe support. For more information please see the [main repo].

Refer to the [documentation] for full details.

[svd2rust]: https://github.com/rust-embedded/svd2rust
[main repo]: https://github.com/stm32-rs/stm32-rs
[documentation]: https://docs.rs/stm32c0/latest/stm32c0/

## Usage
Each device supported by this crate is behind a feature gate so that you only
compile the device(s) you want. To use, in your Cargo.toml:

```toml
[dependencies.stm32c0]
version = "0.16.0"
features = ["stm32c011"]
```

The `rt` feature is enabled by default and brings in support for `cortex-m-rt`.
To disable, specify `default-features = false` in `Cargo.toml`.

In your code:

```rust
use stm32c0::stm32c011;

let mut peripherals = stm32c011::Peripherals::take().unwrap();
let gpioa = &peripherals.GPIOA;
gpioa.odr.modify(|_, w| w.odr0().set_bit());
```

For full details on the autogenerated API, please see:
https://docs.rs/svd2rust/0.35.0/svd2rust/#peripheral-api

## Supported Devices

| Module | Devices | Links |
|:------:|:-------:|:-----:|
| stm32c0x1 | STM32C011, STM32C031, STM32C071 | [RM0490](https://www.st.com/resource/en/reference_manual/rm0490-stm32c0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32c0x1.html) |
24 changes: 24 additions & 0 deletions stm32c0/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
if env::var_os("CARGO_FEATURE_RT").is_some() {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
println!("cargo:rustc-link-search={}", out.display());
let devices = ["stm32c011", "stm32c031", "stm32c071"];
let mut device_file = None;
for &d in &devices {
if env::var_os(&format!("CARGO_FEATURE_{}", d.to_uppercase())).is_some() {
device_file = Some(format!("src/{d}/device.x"));
break;
}
}
if let Some(device_file) = device_file {
fs::copy(&device_file, out.join("device.x")).unwrap();
println!("cargo:rerun-if-changed={device_file}");
} else {
panic!("No device features selected. Avaliable device features are: {devices:?}");
}
}
println!("cargo:rerun-if-changed=build.rs");
}
Loading

0 comments on commit 2c11276

Please sign in to comment.