diff --git a/.github/workflows/ci_checks.yml b/.github/workflows/ci_checks.yml index bb41e32..baa2a00 100644 --- a/.github/workflows/ci_checks.yml +++ b/.github/workflows/ci_checks.yml @@ -43,7 +43,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable - - run: cargo test --target=x86_64-unknown-linux-gnu + - run: cargo test --lib --target=x86_64-unknown-linux-gnu linting: name: Linting runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 2c7d046..8ea83e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,10 +23,8 @@ pico = { git = "https://github.com/rp-rs/rp-hal", branch="main"} # pro_micro_rp2040 = { git = "https://github.com/rp-rs/rp-hal", branch="main"} # If you're not going to use a Board Support Package you'll need these: -#rp2040-hal = { git = "https://github.com/rp-rs/rp-hal", branch="main", features=["rt"] } -#rp2040-boot2 = { git = "https://github.com/rp-rs/rp2040-boot2-rs", branch="main" } - - +# rp2040-hal = { git = "https://github.com/rp-rs/rp-hal", branch="main", features=["rt"] } +# rp2040-boot2 = { git = "https://github.com/rp-rs/rp2040-boot2-rs", branch="main" } # cargo build/run [profile.dev] diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..f37054e --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,20 @@ +//! # Library Code for the rp2040-project-template application +//! +//! Code in this file can be tested on the host with `cargo +//! test --lib --target=` + +#[cfg_attr(not(test), no_std)] + +/// LED on-period and off-period, in milliseconds +pub const LED_DELAY_MS: u32 = 500; + +#[cfg(test)] +mod test { + #[test] + fn it_works() { + let sum = 2 + 2; + assert_eq!(4, sum); + } +} + +// End of file \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index c3c8b90..5157f03 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,9 +59,11 @@ fn main() -> ! { loop { info!("on!"); led_pin.set_high().unwrap(); - delay.delay_ms(500); + delay.delay_ms(rp2040_project_template::LED_DELAY_MS); info!("off!"); led_pin.set_low().unwrap(); - delay.delay_ms(500); + delay.delay_ms(rp2040_project_template::LED_DELAY_MS); } } + +// End of file \ No newline at end of file