Skip to content

Commit

Permalink
DAC: Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Feb 25, 2023
1 parent 8d66f72 commit c9cf3f2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/dac/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "riot-wrappers-test-dac"
version = "0.1.0"
authors = ["Christian Amsüss <[email protected]>"]
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" }
14 changes: 14 additions & 0 deletions tests/dac/Makefile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions tests/dac/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit c9cf3f2

Please sign in to comment.