From c9cf3f2195af4d8c3342ec11078d3d9dc21afa4d Mon Sep 17 00:00:00 2001 From: chrysn Date: Sat, 25 Feb 2023 13:23:28 +0100 Subject: [PATCH] DAC: Add test --- tests/dac/Cargo.toml | 19 +++++++++++++++++++ tests/dac/Makefile | 14 ++++++++++++++ tests/dac/src/lib.rs | 11 +++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/dac/Cargo.toml create mode 100644 tests/dac/Makefile create mode 100644 tests/dac/src/lib.rs diff --git a/tests/dac/Cargo.toml b/tests/dac/Cargo.toml new file mode 100644 index 00000000..f4e0ef37 --- /dev/null +++ b/tests/dac/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "riot-wrappers-test-dac" +version = "0.1.0" +authors = ["Christian Amsüss "] +edition = "2021" +publish = false + +[lib] +crate-type = ["staticlib"] + +[profile.release] +panic = "abort" + +[dependencies] +riot-wrappers = { version = "*", features = [ "set_panic_handler" ] } +riot-sys = "*" + +[patch.crates-io] +riot-sys = { git = "https://github.com/RIOT-OS/rust-riot-sys" } diff --git a/tests/dac/Makefile b/tests/dac/Makefile new file mode 100644 index 00000000..3e39f4c3 --- /dev/null +++ b/tests/dac/Makefile @@ -0,0 +1,14 @@ +# name of your application +APPLICATION = riot-wrappers-test-dac +APPLICATION_RUST_MODULE = riot_wrappers_test_dac +BASELIBS += $(APPLICATION_RUST_MODULE).module +FEATURES_REQUIRED += rust_target +FEATURES_REQUIRED += periph_dac + +# Of these boards it is known that DAC0 may be driven arbitrarily because it's +# just a pin on the extension header. (It's probably true for most boards, but +# so far nobody guarantees that. Just add your board here if your DAC0 pin is +# good to use). +BOARD_WHITELIST = stk3700 + +include $(RIOTBASE)/Makefile.include diff --git a/tests/dac/src/lib.rs b/tests/dac/src/lib.rs new file mode 100644 index 00000000..12c5247b --- /dev/null +++ b/tests/dac/src/lib.rs @@ -0,0 +1,11 @@ +#![no_std] + +use riot_wrappers::dac; +use riot_wrappers::riot_main; + +riot_main!(main); + +fn main() { + let mut dac = dac::DACLine::new(0).unwrap(); + dac.set(655); // 1% of maximum value +}