Skip to main content

Crate uferris_bsp

Crate uferris_bsp 

Source
Expand description

§uFerris Board Support Package Crate

uFerris is a flexible Rust embedded learning kit that can accomodate several SeeedStudio Xiao controllers. uFerris is essentially a carrier board that can accomodate mutliple different controllers.

The uferris-bsp crate provides a generic Board Support Package for the uFerris carrier board. As such, uferris-bsp is architecture-agnostic and can support for several MCUs (ESP32, RP2040…etc.) Controller support is provided via feature flags.

In summary, this crate is meant to provide a software abstraction to easily drive the uFerris board with any supported Xiao Controller.

§Crate Architechture

The uFerris BSP architechture follows the layered scheme shown in the figure below. The upper uFerris board logic layer is meant to provide a hardware agnositc uniform interface across all Xiao controllers. The second adapter layer is introduced to create the mappings between the logic and the individual device HALs. The adapter layer also utilizes the embedded-hal traits where possible. In most cases the controller HALs provide implementations for embedded-hal traits.

§Currently Supported Xiaos:

  • Xiao ESP32-C3

§async Support

This crate does not support async yet. Support would entail adding board async method calls for the different functions in lib.rs.

§Contributing to the uFerris BSP - Adding a New Xiao Board Support:

Adding support for a new Xiao board entails two parts:

  1. Device Feature Flag in Cargo.toml: A feature flag that imports the new device HAL needs to be added.
  2. Device Board Adapter: This entails adding a new board definition (adapter layer) under the crate boards/ folder.

Other files in the crate should remain unchanged. It is recommended to view the existing board implementations for guidance on creating an adapter layer.

§Feature Flags

⚠️ At least one Xiao device feature must be enabled when building the crate.

  • xiao-esp32c3 — Xiao ESP32-C3 Device Support
  • power-board — uFerris Megalops Power Board Extension Support
  • embassy — embassy Support Feature Flag

§Usage

The abstractions in this crate are designed in a way where they are common for any Xiao device. The only difference is that the correct controller board needs to be chosen as a feature. The steps to use this crate include the following:

1- Import the board init function:

use uferris_bsp::uferris_init;

2- Acquire the controller peripherals and pass them to initialize the board:

let mut uferris = uferris_init(peripherals);

3- Use the board methods:

// Turn on LED 1 on the board
uferris.led1_on();

Re-exports§

pub use components::io_expander::SwPos;
pub use crate::components::io_expander::SevenSegDigit;
pub use boards::xiao_esp32c3::uferris_init;

Modules§

boards
components

Structs§

InitError
Uferris
The uFerris Board Driver.

Traits§

PowerConstraints