Skip to main content

Crate arduino_uno_r4_hal

Crate arduino_uno_r4_hal 

Source
Expand description

embedded-hal implementation for the Arduino Uno R4 (Renesas RA4M1 / Cortex-M4F).

Peripherals::take is the entry point. It consumes the ra4m1 PAC and Cortex-M core peripherals once, initializes the clock to 48MHz, and hands out:

  • Clocks — resolved clock frequencies
  • Delay — SysTick-based blocking delay
  • gpio::Pins — Arduino header pins (d0..d13, a0..a5)
  • PAC handles for UART / ADC / PWM (moved into their respective drivers)

The uno-r4-minima feature is enabled by default. Disable default features and enable uno-r4-wifi when targeting the WiFi board; its digital and PWM pin mapping differs.

let p = arduino_uno_r4_hal::Peripherals::take().unwrap();
let mut delay = p.delay;
let mut led = p.pins.d13.into_output();
loop {
    led.toggle();
    delay.delay_ms(500);
}

Re-exports§

pub use clock::Clocks;
pub use delay::Delay;
pub use gpio::Alternate;
pub use gpio::Analog;
pub use gpio::Input;
pub use gpio::InputPullUp;
pub use gpio::Output;
pub use gpio::OutputOpenDrain;
pub use gpio::Pin;
pub use gpio::PinState;
pub use gpio::Pins;

Modules§

adc
A/D converter (ADC140, 14-bit successive approximation).
clock
Clock generation circuit (CGC) initialization.
delay
Blocking delay using SysTick (the Cortex-M core timer).
gpio
General-purpose I/O (GPIO).
pwm
PWM output (GPT timer, sawtooth PWM mode).
serial
UART (SCI2 = Arduino Serial1, pins D0/D1 = P301/P302).
time

Structs§

Peripherals
Initialized top-level peripherals.