UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

MPR121 Class

Module: mpr121

UPM module for the MPR121 touch sensor
mpr121.jpg

Methods

MPR121

(
  • bus
  • address
)
Number

MPR121 constructor

Parameters:

  • bus Number

    I2C bus to use

  • address Number

    undefined

Returns:

Number:

configAN3944

() Boolean

MPR121 destructor ~MPR121(); there is no need for the destructor Sets up a default configuration, based on Application Note 3944 (AN3944): http://cache.freescale.com/files/sensors/doc/app_note/AN3944.pdf
After configuration, the sensor is left in the run state.

Returns:

Boolean:

True if configuration is successful

readButtons

()

Reads button states in the m_buttonStates member variable. Also, sets the m_overCurrentFault variable if overcurrent is detected.

writeBytes

(
  • reg
  • buffer
  • len
)
Mraa::Result

Writes value(s) into registers

Parameters:

  • reg Number

    Register location to start writing into

  • buffer Uint8_t *

    Buffer for data storage

  • len Number

    Number of bytes to write

Returns:

Mraa::Result:

mraa::Result

readBytes

(
  • reg
  • buffer
  • len
)
Number

Reads value(s) from registers

Parameters:

  • reg Number

    Register location to start reading from

  • buffer Uint8_t *

    Buffer for data storage

  • len Number

    Number of bytes to read

Returns:

Number:

Properties

m_buttonStates

Number

Button states

m_overCurrentFault

Boolean

Overcurrent detected