Prechádzať zdrojové kódy

Rework examples to apply to more targets and test in CI

This also improves the required-features selection for the examples.

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
Daniel Egger 4 rokov pred
rodič
commit
3801f390bc
4 zmenil súbory, kde vykonal 24 pridanie a 17 odobranie
  1. 7 4
      .github/workflows/ci.yml
  2. 15 11
      Cargo.toml
  3. 1 1
      examples/delay.rs
  4. 1 1
      examples/led.rs

+ 7 - 4
.github/workflows/ci.yml

@@ -1,4 +1,7 @@
-on: [push, pull_request]
+on:
+  push:
+    branches: [ staging, trying, master ]
+  pull_request:
 
 name: Continuous integration
 
@@ -7,7 +10,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        mcu: 
+        mcu:
           - stm32f100
           - stm32f101
           - stm32f103
@@ -30,5 +33,5 @@ jobs:
           override: true
       - uses: actions-rs/cargo@v1
         with:
-          command: build
-          args: --features=${{ matrix.mcu }}
+          command: check
+          args: --features=${{ matrix.mcu }},rt --examples

+ 15 - 11
Cargo.toml

@@ -15,13 +15,6 @@ version = "0.5.3"
 features = ["stm32f103", "rt", "stm32-usbd"]
 default-target = "x86_64-unknown-linux-gnu"
 
-[[example]]
-name = "timer-interrupt-rtfm"
-required-features = ["rt"]
-[[example]]
-name = "exti"
-required-features = ["rt"]
-
 [dependencies]
 cortex-m = "0.6.0"
 nb = "0.1.2"
@@ -109,17 +102,28 @@ lto = true
 
 [[example]]
 name = "usb_serial"
-required-features = ["rt", "stm32f103", "stm32-usbd"]
+required-features = ["rt", "stm32-usbd"]
 
 [[example]]
 name = "usb_serial_interrupt"
-required-features = ["rt", "stm32f103", "stm32-usbd"]
+required-features = ["rt", "stm32-usbd"]
 
 [[example]]
 name = "usb_serial_rtfm"
-required-features = ["rt", "stm32f103", "stm32-usbd"]
+required-features = ["rt", "stm32-usbd"]
 
 [[example]]
 name = "blinky_timer_irq"
-required-features = ["medium", "rt", "stm32f103"]
+required-features = ["rt"]
 
+[[example]]
+name = "qei"
+required-features = ["medium"]
+
+[[example]]
+name = "timer-interrupt-rtfm"
+required-features = ["rt", "medium"]
+
+[[example]]
+name = "exti"
+required-features = ["rt"]

+ 1 - 1
examples/delay.rs

@@ -28,7 +28,7 @@ fn main() -> ! {
     #[cfg(feature = "stm32f101")]
     let mut led = gpioc.pc9.into_push_pull_output(&mut gpioc.crh);
 
-    #[cfg(feature = "stm32f103")]
+    #[cfg(any(feature = "stm32f103", feature = "stm32f105", feature = "stm32f107"))]
     let mut led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
 
     let mut delay = Delay::new(cp.SYST, clocks);

+ 1 - 1
examples/led.rs

@@ -40,7 +40,7 @@ fn main() -> ! {
         .set_high()
         .unwrap();
 
-    #[cfg(feature = "stm32f103")]
+    #[cfg(any(feature = "stm32f103", feature = "stm32f105", feature = "stm32f107"))]
     gpioc
         .pc13
         .into_push_pull_output(&mut gpioc.crh)