10 releases (4 breaking)

0.5.1 Nov 29, 2024
0.5.0 Nov 29, 2024
0.4.2 Oct 16, 2024
0.3.0 Jul 16, 2024
0.1.0 May 10, 2024

#60 in Robotics

Download history 14/week @ 2024-08-17 11/week @ 2024-08-24 4/week @ 2024-08-31 10/week @ 2024-09-07 20/week @ 2024-09-14 67/week @ 2024-09-21 35/week @ 2024-09-28 398/week @ 2024-10-05 204/week @ 2024-10-12 80/week @ 2024-10-19 18/week @ 2024-10-26 19/week @ 2024-11-02 243/week @ 2024-11-09 69/week @ 2024-11-16 143/week @ 2024-11-23 258/week @ 2024-11-30

714 downloads per month
Used in 5 crates (4 directly)

MIT license

640KB
9K SLoC

vexide-devices

Functionality for accessing hardware connected to the V5 Brain.

This crate abstracts over the various V5 devices and provides a Peripherals API for accessing them.


lib.rs:

Hardware abstractions and functionality for peripherals on the V5 Brain.

Overview

This crate provides APIs for interfacing with VEX hardware and peripherals.

The V5 Brain features 21 RJ9 serial ports (known as "Smart Ports") for communicating with newer V5 devices, as well as six three-wire ports with analog-to-digital conversion capability for compatibility with legacy Cortex devices. The Brain also has a screen, battery, and usually a controller for reading user input.

Hardware access begins at the Peripherals API, where singleton access to the brain's I/O and peripherals can be obtained:

let peripherals = Peripherals::take().unwrap();

// Pull out port 1 of peripherals. This is a `SmartPort` and can be used to construct any
// device on port 1 of the Brain that we want to control.
let port_1 = peripherals.port_1;

If you are using vexide's #[vexide::main] macro, then Peripherals is already given to you through an argument to your main function:

#![no_std]
#![no_main]

use vexide::prelude::*;

#[vexide::main]
async fn main(peripherals: Peripherals) {
    println!("o.o what's this? {:?}", peripherals);
}

For more information on peripheral access, see the peripherals module.

Dependencies

~1.3–2MB
~36K SLoC