Module esp_ward::peripherals

source ·
Expand description

§Peripherals Module

This module provides abstractions over various peripherals that can be connected to an ESP-based system. It includes traits for common peripheral functionality which is able to be unified.

The provided traits allow for a standardized interface for operations like reading and writing data, initializing devices over I2C or SPI buses, and specialized functionalities for different sensor types.

§Usage

To use a peripheral, initialize and operate with it using the provided traits.

§Examples

// Example of creating a temperature sensor on an I2C bus
let i2c = esp_ward::init_i2c_default!(peripherals, pins, clocks);
let sensor = esp_ward::peripherals::aht20::create_on_i2c(i2c_bus, delay).unwrap();
let temperature = sensor.get_temperature().unwrap();

§Features

  • Button input handling.
  • Support for a range of environmental sensors (temperature, humidity, pressure, movement).
  • Distance measurement capabilities.
  • Light intensity sensing.
  • Gas sensing for CO2 and VOCs.

Modules§

Enums§

  • Represents basic errors that can occur in peripheral operations.

Traits§

  • Trait for peripherals that can measure CO2 (or CO2 equivalent) levels.
  • Trait for peripherals that can measure distance.
  • Trait for peripherals that can sense humidity levels.
  • Trait for peripherals that communicate over I2C. Implementation should provide a method for creating an instance of the peripheral on the I2C bus.
  • Trait for peripherals that can measure luminance.
  • Trait for peripherals that can sense atmospheric pressure.
  • Trait for peripherals that can be explicitly shut down or deactivated.
  • Trait for peripherals that communicate over SPI. Implementation should provide a method for creating an instance of the peripheral on the I2C bus.
  • Trait for peripherals that can sense temperature.
  • Trait for peripherals capable of returning data (which would be serialized).
  • Trait for peripherals that can measure Volatile Organic Compounds (VOCs) or Total Volatile Organic Compounds (TVOCs).
  • Trait for peripherals capable of writing data.