Crate mpr121_hal

Crate mpr121_hal 

Source
Expand description

§MPR121-Hal

This crate follows the Adafruit implementation closely but exposes it in terms of the embedded-hal project.

The main responsibility of this crate is returning the current on/off state of all the (up to) 12 pins.

The chip’s data sheet can be found here. The implementation however mostly mirrors the Adafruit implementation, since this is probably the most widely used one.

When working with this crate you can either use it in Synchronous/Blocking mode with the embedded-hal or in Asynchronous mode with the embedded-hal-async. This can be done by using the features sync and async. This crate does not pull in the std library and thus is fully no-std. For MCU scale devices Embassy is a valid framework to use the async feature or Tokio when using Linux/MacOS based devices.

Modules§

mpr121

Enums§

Channel
This enum represents the channels of the sensor and is used to get the corresponding touch values
DebounceNumber
This enum represents the number of debounces see section 5.7 in the MPR121 Data Sheet
Mpr121Address
The four values the sensor can be addressed as. Note that the address of the device is determined by where the ADDR pin is connected to. Default is used if no connection, or a connection to VSS is made.
Mpr121Error
The MPR121 Device has an Enumeration of potential driver errors, which are held in the enum below