|
upm
1.6.0
Sensor/Actuator repository for libmraa (v1.9.0)
|

Go to the source code of this file.
Data Structures | |
| struct | _lsm6ds3h_context |
Functions | |
| lsm6ds3h_context | lsm6ds3h_init (int bus, int addr, int cs) |
| void | lsm6ds3h_close (lsm6ds3h_context dev) |
| upm_result_t | lsm6ds3h_update (const lsm6ds3h_context dev) |
| uint8_t | lsm6ds3h_get_chip_id (const lsm6ds3h_context dev) |
| upm_result_t | lsm6ds3h_devinit (const lsm6ds3h_context dev, LSM6DS3H_XL_ODR_T acc_odr, LSM6DS3H_XL_FS_T acc_fs, LSM6DS3H_G_ODR_T gyr_odr, LSM6DS3H_G_FS_T gyr_fs) |
| upm_result_t | lsm6ds3h_set_acc_odr (const lsm6ds3h_context dev, LSM6DS3H_XL_ODR_T odr) |
| upm_result_t | lsm6ds3h_set_gyr_odr (const lsm6ds3h_context dev, LSM6DS3H_G_ODR_T odr) |
| upm_result_t | lsm6ds3h_set_acc_full_scale (const lsm6ds3h_context dev, LSM6DS3H_XL_FS_T fs) |
| upm_result_t | lsm6ds3h_set_gyr_full_scale (const lsm6ds3h_context dev, LSM6DS3H_G_FS_T fs) |
| void | lsm6ds3h_get_accelerometer (const lsm6ds3h_context dev, float *x, float *y, float *z) |
| void | lsm6ds3h_get_gyroscope (const lsm6ds3h_context dev, float *x, float *y, float *z) |
| float | lsm6ds3h_get_temperature (const lsm6ds3h_context dev) |
| upm_result_t | lsm6ds3h_high_performance (const lsm6ds3h_context dev, bool enable) |
| upm_result_t | lsm6ds3h_reset (const lsm6ds3h_context dev) |
| upm_result_t | lsm6ds3h_set_interrupt_active_high (const lsm6ds3h_context dev, bool high) |
| upm_result_t | lsm6ds3h_set_interrupt_push_pull (const lsm6ds3h_context dev, bool pp) |
| uint8_t | lsm6ds3h_get_status (const lsm6ds3h_context dev) |
| upm_result_t | lsm6ds3h_install_isr (const lsm6ds3h_context dev, LSM6DS3H_INTERRUPT_PINS_T intr, int gpio, mraa_gpio_edge_t level, void(*isr)(void *), void *arg) |
| void | lsm6ds3h_uninstall_isr (const lsm6ds3h_context dev, LSM6DS3H_INTERRUPT_PINS_T intr) |
| uint8_t | lsm6ds3h_read_reg (const lsm6ds3h_context dev, uint8_t reg) |
| int | lsm6ds3h_read_regs (const lsm6ds3h_context dev, uint8_t reg, uint8_t *buffer, int len) |
| upm_result_t | lsm6ds3h_write_reg (const lsm6ds3h_context dev, uint8_t reg, uint8_t val) |
Typedefs | |
| typedef struct _lsm6ds3h_context * | lsm6ds3h_context |
| lsm6ds3h_context lsm6ds3h_init | ( | int | bus, |
| int | addr, | ||
| int | cs | ||
| ) |
LSM6DS3H initialization.
This device can support both I2C and SPI. For SPI, set the addr to -1, and specify a positive integer representing the Chip Select (CS) pin for the cs argument. If you are using a hardware CS pin (like Intel Edison with Arduino breakout), then you can connect the proper pin to the hardware CS pin on your MCU and supply -1 for cs.
| bus | I2C or SPI bus to use |
| addr | The address for this device, or -1 for SPI |
| cs | The gpio pin to use for the SPI Chip Select. Use -1 for I2C or for SPI with a hardware controlled pin. |

| void lsm6ds3h_close | ( | lsm6ds3h_context | dev | ) |
LSM6DS3H Destructor
| dev | The device context |


| upm_result_t lsm6ds3h_update | ( | const lsm6ds3h_context | dev | ) |
Update the internal stored values from sensor data
| dev | The device context |


| uint8_t lsm6ds3h_get_chip_id | ( | const lsm6ds3h_context | dev | ) |
Return the chip ID
| dev | The device context |


| upm_result_t lsm6ds3h_devinit | ( | const lsm6ds3h_context | dev, |
| LSM6DS3H_XL_ODR_T | acc_odr, | ||
| LSM6DS3H_XL_FS_T | acc_fs, | ||
| LSM6DS3H_G_ODR_T | gyr_odr, | ||
| LSM6DS3H_G_FS_T | gyr_fs | ||
| ) |
Initialize the device and start operation. This function is called from lsm6ds3h_init(), so it will not need to be called by a user unless the device is reset. It sets the accelerometer and gyroscope ODR and FS modes, and enables BDU, register auto-increment, and high performance mode.
| dev | The device context |
| acc_odr | One of the LSM6DS3H_XL_ODR_T values |
| acc_fs | One of the LSM6DS3H_XL_FS_T values |
| gyr_odr | One of the LSM6DS3H_G_ODR_T values |
| gyr_fs | One of the LSM6DS3H_G_FS_T values |


| upm_result_t lsm6ds3h_set_acc_odr | ( | const lsm6ds3h_context | dev, |
| LSM6DS3H_XL_ODR_T | odr | ||
| ) |
Set the output data rate (ODR) of the accelerometer
| dev | The device context |
| odr | One of the LSM6DS3H_XL_ODR_T values |


| upm_result_t lsm6ds3h_set_gyr_odr | ( | const lsm6ds3h_context | dev, |
| LSM6DS3H_G_ODR_T | odr | ||
| ) |
Set the output data rate (ODR) of the gyroscope
| dev | The device context |
| odr | One of the LSM6DS3H_G_ODR_T values |


| upm_result_t lsm6ds3h_set_acc_full_scale | ( | const lsm6ds3h_context | dev, |
| LSM6DS3H_XL_FS_T | fs | ||
| ) |
Set the full scale (FS) of the accelerometer. This device supports a full scale of 2, 4, 8, and 16G.
| dev | The device context |
| fs | One of the LSM6DS3H_XL_FS_T values |


| upm_result_t lsm6ds3h_set_gyr_full_scale | ( | const lsm6ds3h_context | dev, |
| LSM6DS3H_G_FS_T | fs | ||
| ) |
Set the full scale (FS) of the gyroscope. This device supports a full scale of 125, 245, 500, 1000, and 2000 degrees per second (DPS)
| dev | The device context |
| fs | One of the LSM6DS3H_G_FS_T values |


| void lsm6ds3h_get_accelerometer | ( | const lsm6ds3h_context | dev, |
| float * | x, | ||
| float * | y, | ||
| float * | z | ||
| ) |
Return accelerometer data in gravities (g). lsm6ds3h_update() must have been called prior to calling this function.
| dev | The device context |
| x | Pointer to a floating point value that will have the current x component placed into it |
| y | Pointer to a floating point value that will have the current y component placed into it |
| z | Pointer to a floating point value that will have the current z component placed into it |

| void lsm6ds3h_get_gyroscope | ( | const lsm6ds3h_context | dev, |
| float * | x, | ||
| float * | y, | ||
| float * | z | ||
| ) |
Return gyroscope data in degrees per second (DPS). lsm6ds3h_update() must have been called prior to calling this function.
| dev | The device context |
| x | Pointer to a floating point value that will have the current x component placed into it |
| y | Pointer to a floating point value that will have the current y component placed into it |
| z | Pointer to a floating point value that will have the current z component placed into it |

| float lsm6ds3h_get_temperature | ( | const lsm6ds3h_context | dev | ) |
Return the current measured temperature. Note, this is not ambient temperature. lsm6ds3h_update() must have been called prior to calling this function.
| dev | The device context |

| upm_result_t lsm6ds3h_high_performance | ( | const lsm6ds3h_context | dev, |
| bool | enable | ||
| ) |
Enable accelerometer and gyroscope high performance modes. These are further defined by the respective ODR settings to allow low power, and normal/high-performance modes.
| dev | The device context |
| enable | true to enable high performance mode, false otherwise |


| upm_result_t lsm6ds3h_reset | ( | const lsm6ds3h_context | dev | ) |
Reset the device as if during a power on reset. All configured values are lost when this happens. You should call lsm6ds3h_devinit() afterwards, or at least perform the same initialization lsm6ds3h_devinit() does before continuing.
| dev | The device context |


| upm_result_t lsm6ds3h_set_interrupt_active_high | ( | const lsm6ds3h_context | dev, |
| bool | high | ||
| ) |
Indicate whether the interrupt should be active high (default) or active low. See the datasheet for details.
| dev | The device context |
| high | true for active high, false for active low |


| upm_result_t lsm6ds3h_set_interrupt_push_pull | ( | const lsm6ds3h_context | dev, |
| bool | pp | ||
| ) |
Indicate whether interrupts are push-pull (default) or open drain. See the datasheet for details.
| dev | The device context |
| pp | true for push-pull, false for open-drain |


| uint8_t lsm6ds3h_get_status | ( | const lsm6ds3h_context | dev | ) |
Return the contents of the status register
| dev | The device context |


| upm_result_t lsm6ds3h_install_isr | ( | const lsm6ds3h_context | dev, |
| LSM6DS3H_INTERRUPT_PINS_T | intr, | ||
| int | gpio, | ||
| mraa_gpio_edge_t | level, | ||
| void(*)(void *) | isr, | ||
| void * | arg | ||
| ) |
Install an interrupt handler
| dev | The device context |
| intr | One of the LSM6DS3H_INTERRUPT_PINS_T values specifying which interrupt pin you are installing |
| gpio | GPIO pin to use as interrupt pin |
| level | The interrupt trigger level (one of mraa_gpio_edge_t values). Make sure that you have configured the interrupt pin properly for whatever level you choose. |
| isr | The interrupt handler, accepting a void * argument |
| arg | The argument to pass the the interrupt handler |


| void lsm6ds3h_uninstall_isr | ( | const lsm6ds3h_context | dev, |
| LSM6DS3H_INTERRUPT_PINS_T | intr | ||
| ) |
Uninstall a previously installed interrupt handler
| dev | The device context |
| intr | One of the LSM6DS3H_INTERRUPT_PINS_T values specifying which interrupt pin you are removing |

| uint8_t lsm6ds3h_read_reg | ( | const lsm6ds3h_context | dev, |
| uint8_t | reg | ||
| ) |
Read a register
| dev | The device context |
| reg | The register to read |

| int lsm6ds3h_read_regs | ( | const lsm6ds3h_context | dev, |
| uint8_t | reg, | ||
| uint8_t * | buffer, | ||
| int | len | ||
| ) |
Read contiguous registers into a buffer
| dev | The device context |
| buffer | The buffer to store the results |
| len | The number of registers to read |

| upm_result_t lsm6ds3h_write_reg | ( | const lsm6ds3h_context | dev, |
| uint8_t | reg, | ||
| uint8_t | val | ||
| ) |
Write to a register
| dev | The device context |
| reg | The register to write to |
| val | The value to write |

| typedef struct _lsm6ds3h_context * lsm6ds3h_context |
Device context
1.8.11