rp-hal
rp-hal copied to clipboard
add Adafruit Macropad macros
Add a bunch of macros in the adafruit-macropad board crate to make it easier to construct working peripheral objects.
With this patch your main() can start like this:
let mut pac = pac::Peripherals::take().unwrap();
let core = pac::CorePeripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = macropad_clocks!(pac, watchdog);
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer());
let pins = macropad_pins!(pac);
let timer = Timer::new(pac.TIMER, &mut pac.RESETS);
//
let mut disp = macropad_oled!(pins, clocks, delay, pac);
let mut led_pin = pins.led.into_push_pull_output();
let mut neopixels = macropad_neopixels!(pins, clocks, timer, pac);
//
let mut rotary = macropad_rotary_encoder!(pins);
let keys = macropad_keypad!(pins);
I could use some help figuring out how to make the CI checks pass. It looks like cargo test --doc --target x86_64-unknown-linux-gnu is malfunctioning.
if I remove the code sample from the top of macro.rs the test passes fine, but then the user of the library will not be able to benefit from the example.
You could add the ignore attribute to the code block. https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#attributes
That way, it stays part of the documentation, but won't be run as a doc test.
This PR should be moved to https://github.com/rp-rs/rp-hal-boards. I am closing it here but be assured these changes would be welcome over there :) .