upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Go to the source code of this file.
Data Structures | |
struct | _mpr121_context |
Functions | |
mpr121_context | mpr121_init (int bus, uint8_t address) |
void | mpr121_close (mpr121_context dev) |
upm_result_t | mpr121_config_an3944 (mpr121_context dev) |
upm_result_t | mpr121_read_buttons (mpr121_context dev, uint32_t *states, int num) |
upm_result_t | mpr121_write_bytes (mpr121_context dev, uint8_t reg, uint8_t *buffer, int len) |
upm_result_t | mpr121_read_bytes (mpr121_context dev, uint8_t reg, uint8_t *buffer, int len) |
Macros | |
#define | MPR121_I2C_BUS 0 |
#define | MPR121_DEFAULT_I2C_ADDR 0x5a |
Typedefs | |
typedef struct _mpr121_context * | mpr121_context |
mpr121_context mpr121_init | ( | int | bus, |
uint8_t | address | ||
) |
MPR121 Init function
bus | i2c bus |
address | i2c address of the sensor |
void mpr121_close | ( | mpr121_context | dev | ) |
MPR121 Close function
dev | pointer to sensor struct |
upm_result_t mpr121_config_an3944 | ( | mpr121_context | dev | ) |
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.
dev | pointer to the sensor struct |
upm_result_t mpr121_read_buttons | ( | mpr121_context | dev, |
uint32_t * | states, | ||
int | num | ||
) |
Function to read the individual button values
dev | pointer to the sensor struct |
states | Pointer to store the states of the individual buttons |
num | used to retrieve the state of a particular button |
upm_result_t mpr121_write_bytes | ( | mpr121_context | dev, |
uint8_t | reg, | ||
uint8_t * | buffer, | ||
int | len | ||
) |
Function used to write multiple bytes to the i2c bus
dev | sensor struct |
reg | i2c register to read from |
*buffer | pointer that contains the values that have to be written to the registers |
len | length of the values that have to be written to the regs |
upm_result_t mpr121_read_bytes | ( | mpr121_context | dev, |
uint8_t | reg, | ||
uint8_t * | buffer, | ||
int | len | ||
) |
Function used to read multiple bytes from the i2c bus
dev | sensor struct |
reg | i2c register to read from |
*buffer | pointer that contains the values that have been read from the registers |
len | length of the values that have to be read |
typedef struct _mpr121_context * mpr121_context |
device context