Skip to content

Commit

Permalink
Add CI and fix formatting and cleanup chip features
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelchcki committed Jan 29, 2021
1 parent f959a96 commit a16b2fd
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 18 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
pull_request:

name: Continuous integration

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
feature:
- stm32g431
- stm32g441
- stm32g471
- stm32g473
- stm32g474
- stm32g483
- stm32g484

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: thumbv7em-none-eabihf
override: true

- name: Regular build
run: cargo check --features ${{ matrix.feature }}
21 changes: 21 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:
branches: [ staging, trying, master ]
pull_request:

name: Clippy check
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: rustup component add clippy
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: thumbv7em-none-eabihf
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features=stm32g431 --target thumbv7em-none-eabihf
23 changes: 23 additions & 0 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches: [ staging, trying, master ]
pull_request:

name: Code formatting check

jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
35 changes: 22 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@
#![allow(non_camel_case_types)]

#[cfg(not(any(
feature = "stm32g431",
feature = "stm32g441",
feature = "stm32g491",
feature = "stm32g473",
feature = "stm32g483",
feature = "stm32g474",
feature = "stm32g484",
feature = "stm32g431",
feature = "stm32g441",
feature = "stm32g471",
feature = "stm32g473",
feature = "stm32g474",
feature = "stm32g483",
feature = "stm32g484",
)))]
compile_error!("This crate requires one of the following features enabled: stm32g431, stm32g441, stm32g491, stm32g473, stm32g483, stm32g474 or stm32g484");

compile_error!(
"This crate requires one of the following features enabled:
stm32g431
stm32g441
stm32g473
stm32g474
stm32g483
stm32g484"
);

extern crate bare_metal;
extern crate void;
Expand All @@ -28,18 +37,18 @@ pub use stm32g4::stm32g431 as stm32;
#[cfg(feature = "stm32g441")]
pub use stm32g4::stm32g441 as stm32;

#[cfg(feature = "stm32g491")]
pub use stm32g4::stm32g491 as stm32;
#[cfg(feature = "stm32g471")]
pub use stm32g4::stm32g471 as stm32;

#[cfg(feature = "stm32g473")]
pub use stm32g4::stm32g473 as stm32;

#[cfg(feature = "stm32g483")]
pub use stm32g4::stm32g483 as stm32;

#[cfg(feature = "stm32g474")]
pub use stm32g4::stm32g474 as stm32;

#[cfg(feature = "stm32g483")]
pub use stm32g4::stm32g483 as stm32;

#[cfg(feature = "stm32g484")]
pub use stm32g4::stm32g484 as stm32;

Expand Down
5 changes: 1 addition & 4 deletions src/rcc/clockout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,4 @@ macro_rules! mco {
};
}

mco!(
gpioa::PA8<DefaultMode>,
gpiog::PG10<DefaultMode>
);
mco!(gpioa::PA8<DefaultMode>, gpiog::PG10<DefaultMode>);
2 changes: 1 addition & 1 deletion src/rcc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub enum Prescaler {
pub enum SysClockSrc {
PLL,
HSI,
HSE(Hertz)
HSE(Hertz),
}

/// Microcontroller clock output source
Expand Down

0 comments on commit a16b2fd

Please sign in to comment.