|
upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|

Go to the source code of this file.
Data Structures | |
| struct | _mma7660_context |
Functions | |
| mma7660_context | mma7660_init (int bus, uint8_t address) |
| void | mma7660_close (mma7660_context dev) |
| upm_result_t | mma7660_write_byte (const mma7660_context dev, uint8_t reg, uint8_t byte) |
| upm_result_t | mma7660_read_byte (const mma7660_context dev, uint8_t reg, uint8_t *byte) |
| upm_result_t | mma7660_get_raw_values (const mma7660_context dev, int *x, int *y, int *z) |
| upm_result_t | mma7660_get_acceleration (const mma7660_context dev, float *ax, float *ay, float *az) |
| upm_result_t | mma7660_get_verified_axis (const mma7660_context dev, MMA7660_REG_T axis, int *val) |
| upm_result_t | mma7660_get_verified_tilt (const mma7660_context dev, uint8_t *val) |
| upm_result_t | mma7660_set_mode_active (const mma7660_context dev) |
| upm_result_t | mma7660_set_mode_standby (const mma7660_context dev) |
| upm_result_t | mma7660_tilt_back_front (const mma7660_context dev, uint8_t *bits) |
| upm_result_t | mma7660_tilt_landscape_portrait (const mma7660_context dev, uint8_t *bits) |
| upm_result_t | mma7660_tilt_tap (const mma7660_context dev, bool *tap) |
| upm_result_t | mma7660_tilt_shake (const mma7660_context dev, bool *shake) |
| upm_result_t | mma7660_install_isr (const mma7660_context dev, int pin, void(*isr)(void *), void *arg) |
| void | mma7660_uninstall_isr (const mma7660_context dev) |
| upm_result_t | mma7660_set_interrupt_bits (const mma7660_context dev, uint8_t ibits) |
| upm_result_t | mma7660_set_sample_rate (const mma7660_context dev, MMA7660_AUTOSLEEP_T sr) |
Typedefs | |
| typedef struct _mma7660_context * | mma7660_context |
| mma7660_context mma7660_init | ( | int | bus, |
| uint8_t | address | ||
| ) |
MMA7660 initialization.
| bus | I2C bus to use |
| address | Address for this sensor |

| void mma7660_close | ( | mma7660_context | dev | ) |
MMA7660 destructor
| dev | Device context. |


| upm_result_t mma7660_write_byte | ( | const mma7660_context | dev, |
| uint8_t | reg, | ||
| uint8_t | byte | ||
| ) |
Writes a byte value into a register
| dev | Device context. |
| reg | Register location to write into |
| byte | Byte to write |

| upm_result_t mma7660_read_byte | ( | const mma7660_context | dev, |
| uint8_t | reg, | ||
| uint8_t * | byte | ||
| ) |
Reads a byte value from a register
| dev | Device context. |
| reg | Register location to read from |
| byte | A pointer to hold the value that was read |

| upm_result_t mma7660_get_raw_values | ( | const mma7660_context | dev, |
| int * | x, | ||
| int * | y, | ||
| int * | z | ||
| ) |
Reads the current value of conversion
| dev | Device context. |
| x | Returned x value |
| y | Returned y value |
| z | Returned z value |


| upm_result_t mma7660_get_acceleration | ( | const mma7660_context | dev, |
| float * | ax, | ||
| float * | ay, | ||
| float * | az | ||
| ) |
Gets the computed acceleration
| dev | Device context. |
| ax | Returned computed acceleration of the X-axis |
| ay | Returned computed acceleration of the Y-axis |
| az | Returned computed acceleration of the Z-axis |


| upm_result_t mma7660_get_verified_axis | ( | const mma7660_context | dev, |
| MMA7660_REG_T | axis, | ||
| int * | val | ||
| ) |
Reads an axis, verifying its validity. The value passed must be one of MMA7660_REG_XOUT, MMA7660_REG_YOUT, or MMA7660_REG_ZOUT.
| dev | Device context. |
| axis | Axis to read |
| val | pointer containing returned value |


| upm_result_t mma7660_get_verified_tilt | ( | const mma7660_context | dev, |
| uint8_t * | val | ||
| ) |
Reads the tilt register, verifying its validity
| dev | Device context. |
| val | Pointer to returned value |


| upm_result_t mma7660_set_mode_active | ( | const mma7660_context | dev | ) |
Puts the device in the active mode. In this mode, register writes are not allowed. Place the device in the standby mode before attempting to write registers.
| dev | Device context. |


| upm_result_t mma7660_set_mode_standby | ( | const mma7660_context | dev | ) |
Puts the device in the standby (power saving) mode. Note: when in the standby mode, there is no valid data in the registers. In addition, the only way to write a register is to put the device in the standby mode.
| dev | Device context. |


| upm_result_t mma7660_tilt_back_front | ( | const mma7660_context | dev, |
| uint8_t * | bits | ||
| ) |
Reads tiltBackFront bits
The value returned is one of the MMA7660_TILT_BF_T values
| dev | Device context. |
| bits | Pointer to returned bits corresponding to the BackFront tilt status |


| upm_result_t mma7660_tilt_landscape_portrait | ( | const mma7660_context | dev, |
| uint8_t * | bits | ||
| ) |
Reads tiltLandscapePortrait bits
The value returned is one of the MMA7660_TILT_LP_T values
| dev | Device context. |
| bits | Pointer to returned bits corresponding to the LandscapePortrait tilt status |


| upm_result_t mma7660_tilt_tap | ( | const mma7660_context | dev, |
| bool * | tap | ||
| ) |
Reads the tiltTap status
| dev | Device context. |
| tap | Pointer to a bool indicating tap detection |


| upm_result_t mma7660_tilt_shake | ( | const mma7660_context | dev, |
| bool * | shake | ||
| ) |
Reads the tiltShake status
| dev | Device context. |
| shake | Pointer to a bool indicating shake detection |


| upm_result_t mma7660_install_isr | ( | const mma7660_context | dev, |
| int | pin, | ||
| void(*)(void *) | isr, | ||
| void * | arg | ||
| ) |
Installs an interrupt service routine (ISR) to be called when an interrupt occurs
| dev | Device context. |
| pin | GPIO pin to use as the interrupt pin |
| isr | Pointer to a function to be called on interrupt |
| arg | Pointer to an object to be supplied as an argument to the ISR. |


| void mma7660_uninstall_isr | ( | const mma7660_context | dev | ) |
Uninstalls the previously installed ISR
| dev | Device context. |

| upm_result_t mma7660_set_interrupt_bits | ( | const mma7660_context | dev, |
| uint8_t | ibits | ||
| ) |
Enables interrupt generation based on passed interrupt bits. The bits are a bitmask of the requested MMA7660_INTR_T values. Note: the device must be in the standby mode to set this register.
| dev | Device context. |
| ibits | Sets the requested interrupt bits |


| upm_result_t mma7660_set_sample_rate | ( | const mma7660_context | dev, |
| MMA7660_AUTOSLEEP_T | sr | ||
| ) |
Sets the sampling rate of the sensor. The value supplied must be one of the MMA7660_AUTOSLEEP_T values.
| dev | Device context. |
| sr | One of the MMA7660_AUTOSLEEP_T values |


| typedef struct _mma7660_context * mma7660_context |
Device context
1.8.11