Crate rp6

source ·
Expand description

Rust adaptation of the RP6Lib provided with the original Robby RP6 robot.

Example usage (see examples/ directory for more):


use rp6::*;

/// entry point for the embedded rust program
fn main() -> ! {
    Serial::write("Hello world!\n");

    let init_leds: u8 = 0b001001;
    let mut running_light: u8 = init_leds;

    // main loop:
    loop {
        // set LEDs according to the binary number `running_light`

        // sleep for 250ms (= a quarter of one second)

        // shift to the left for the 'running' effect
        running_light <<= 1;

        // reset to the initial LED pattern after the last LED was lit
        if running_light > 0b111111 {
            running_light = init_leds;


pub use robot_base::port;
pub use robot_base::RobotBase;
pub use avr::prelude::*;
pub use uart::*;


This module combines some simple device-abstraction for AVR microcontrollers. Currently only supports the atmega32 target, but could be extended to other avr devices.
Re-exports commonly-used API that can be imported at once.
Module for general interaction with the specific systems installed on the RP6’s robot base.
UART = “Universal Aynchronous Receiver Transceiver”


Convenience macro that allows to write multiple (formatted) Serial::write statements as a single call. Currently supported formatters are dec and hex for numbers.
Convenience macro that allows to use the print! macro and append a newline character.


Blocking procedure that allows to delay for N milliseconds
Blocking procedure that allows to delay for N microseconds

Attribute Macros

Allows to define the entry point of the program by annotating a function with this macro.
Allows to define an interrupt service routine (ISR) by annotating a function with this macro. By convention, the function must be named like the handled interrupt.