Add a lib that you can test.
This commit is contained in:
parent
3c87ecdbb7
commit
4e2c632485
2
.github/workflows/ci_checks.yml
vendored
2
.github/workflows/ci_checks.yml
vendored
@ -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
|
||||
|
||||
@ -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]
|
||||
|
||||
20
src/lib.rs
Normal file
20
src/lib.rs
Normal file
@ -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=<your PC's 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
|
||||
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user