| Nordic Thingy:52 v2.0.0

Data Structures | Functions
MPU-9250 motion sensor
Drivers » Motion sensor

MPU-9250 motion sensor. More...

## Data Structures

struct | drv_mpu9250_init_t
| TWI communication initialization struct. More...

## Functions

uint32_t | drv_mpu9250_enable (bool enable)
| Function for enabling or disabling the MPU-9250 driver. More...
uint32_t | drv_mpu9250_init (drv_mpu9250_init_t *p_params)
| Function for initializing the MPU-9250 driver. More...
int | drv_mpu9250_int_register (struct int_param_s *p_int_param)
| Function for enabling and registering the MPU-9250 interrupt callback. More...
int | drv_mpu9250_ms_get (unsigned long *p_count)
| Function for getting a timestamp in milliseconds. More...
int | drv_mpu9250_read (unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char *p_data)
| Function for reading a MPU-9250 register. More...
int | drv_mpu9250_write (unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char const *p_data)
| Function for writing to a MPU-9250 register. More...

## Detailed Description

MPU-9250 motion sensor.

## Function Documentation

## ◆ drv_mpu9250_enable()

uint32_t drv_mpu9250_enable | ( | bool | enable | ) |

Function for enabling or disabling the MPU-9250 driver.

Parameters

  [in] | enable | Enables the device.

Return values

  NRF_SUCCESS. |

## ◆ drv_mpu9250_init()

uint32_t drv_mpu9250_init | ( | drv_mpu9250_init_t * | p_params | ) |

Function for initializing the MPU-9250 driver.

Parameters

  [in] | p_params | Pointer to the init paramter structure.

Return values

  NRF_SUCCESS. |

## ◆ drv_mpu9250_int_register()

int drv_mpu9250_int_register | ( | struct int_param_s * | p_int_param | ) |

Function for enabling and registering the MPU-9250 interrupt callback.

Parameters

  [in] | p_int_param | Pointer to the interrupt parameter structure.

Return values

  0 | if success. Else -1.

## ◆ drv_mpu9250_ms_get()

int drv_mpu9250_ms_get | ( | unsigned long * | p_count | ) |

Function for getting a timestamp in milliseconds.

Parameters

  [out] | p_count | Pointer to the timestamp.

Return values

  0 | if success. Else -1.

## ◆ drv_mpu9250_read()

int drv_mpu9250_read | ( | unsigned char | slave_addr,
|  | unsigned char | reg_addr,
|  | unsigned char | length,
|  | unsigned char * | p_data
| ) |  |

Function for reading a MPU-9250 register.

Parameters

  [in] | slave_addr | Slave address on the TWI bus.
  [in] | reg_addr | Register address to read.
  [in] | length | Length of the data to read.
  [out] | p_data | Pointer to where the data should be stored.

Return values

  0 | if success. Else -1.

## ◆ drv_mpu9250_write()

int drv_mpu9250_write | ( | unsigned char | slave_addr,
|  | unsigned char | reg_addr,
|  | unsigned char | length,
|  | unsigned char const * | p_data
| ) |  |

Function for writing to a MPU-9250 register.

Parameters

  [in] | slave_addr | Slave address on the TWI bus.
  [in] | reg_addr | Register address to write.
  [in] | length | Length of the data to write.
  [in] | p_data | Pointer to the data to write.

Return values

  0 | if success. Else -1.