APM:Libraries
Macros | Functions | Variables
ICM20789.cpp File Reference
#include <AP_HAL/AP_HAL.h>
#include <AP_HAL/I2CDevice.h>
#include <AP_Baro/AP_Baro.h>
#include <AP_BoardConfig/AP_BoardConfig.h>
#include <utility>
#include <stdio.h>
Include dependency graph for ICM20789.cpp:

Go to the source code of this file.

Macros

#define MPUREG_WHOAMI   0x75
 
#define MPUREG_USER_CTRL   0x6A
 
#define MPUREG_PWR_MGMT_1   0x6B
 
#define MPUREG_INT_PIN_CFG   0x37
 
#define BIT_BYPASS_EN   0x02
 
#define BIT_INT_RD_CLEAR   0x10
 
#define BIT_LATCH_INT_EN   0x20
 
#define BIT_USER_CTRL_I2C_MST_EN   0x20
 
#define BIT_PWR_MGMT_1_DEVICE_RESET   0x80
 
#define BIT_USER_CTRL_I2C_IF_DIS   0x10
 
#define BIT_PWR_MGMT_1_CLK_XGYRO   0x01
 
#define BIT_PWR_MGMT_1_CLK_ZGYRO   0x03
 
#define CMD_SOFT_RESET   0x805D
 
#define CMD_READ_ID   0xEFC8
 

Functions

void setup (void)
 
void loop (void)
 
static bool send_cmd16 (uint16_t cmd)
 
static bool read_calibration_data (void)
 
 AP_HAL_MAIN ()
 

Variables

const AP_HAL::HALhal = AP_HAL::get_HAL()
 -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- More...
 
static AP_HAL::OwnPtr< AP_HAL::Devicei2c_dev
 
static AP_HAL::OwnPtr< AP_HAL::Devicespi_dev
 
static AP_HAL::OwnPtr< AP_HAL::Devicedev
 

Macro Definition Documentation

◆ BIT_BYPASS_EN

#define BIT_BYPASS_EN   0x02

◆ BIT_INT_RD_CLEAR

#define BIT_INT_RD_CLEAR   0x10

Definition at line 25 of file ICM20789.cpp.

Referenced by AP_InertialSensor_Invensense::start().

◆ BIT_LATCH_INT_EN

#define BIT_LATCH_INT_EN   0x20

Definition at line 26 of file ICM20789.cpp.

Referenced by AP_InertialSensor_Invensense::start().

◆ BIT_PWR_MGMT_1_CLK_XGYRO

#define BIT_PWR_MGMT_1_CLK_XGYRO   0x01

◆ BIT_PWR_MGMT_1_CLK_ZGYRO

#define BIT_PWR_MGMT_1_CLK_ZGYRO   0x03

Definition at line 32 of file ICM20789.cpp.

Referenced by AP_InertialSensor_Invensense::_hardware_init().

◆ BIT_PWR_MGMT_1_DEVICE_RESET

#define BIT_PWR_MGMT_1_DEVICE_RESET   0x80

Definition at line 29 of file ICM20789.cpp.

Referenced by AP_InertialSensor_Invensense::_hardware_init().

◆ BIT_USER_CTRL_I2C_IF_DIS

#define BIT_USER_CTRL_I2C_IF_DIS   0x10

◆ BIT_USER_CTRL_I2C_MST_EN

#define BIT_USER_CTRL_I2C_MST_EN   0x20

◆ CMD_READ_ID

#define CMD_READ_ID   0xEFC8

Definition at line 36 of file ICM20789.cpp.

Referenced by read_calibration_data().

◆ CMD_SOFT_RESET

#define CMD_SOFT_RESET   0x805D

Definition at line 35 of file ICM20789.cpp.

Referenced by read_calibration_data().

◆ MPUREG_INT_PIN_CFG

#define MPUREG_INT_PIN_CFG   0x37

◆ MPUREG_PWR_MGMT_1

#define MPUREG_PWR_MGMT_1   0x6B

◆ MPUREG_USER_CTRL

#define MPUREG_USER_CTRL   0x6A

◆ MPUREG_WHOAMI

#define MPUREG_WHOAMI   0x75

Function Documentation

◆ AP_HAL_MAIN()

AP_HAL_MAIN ( )

Referenced by loop().

Here is the caller graph for this function:

◆ loop()

void loop ( void  )

Definition at line 299 of file ICM20789.cpp.

Here is the call graph for this function:

◆ read_calibration_data()

static bool read_calibration_data ( void  )
static

Definition at line 199 of file ICM20789.cpp.

Here is the call graph for this function:

◆ send_cmd16()

static bool send_cmd16 ( uint16_t  cmd)
static

Definition at line 190 of file ICM20789.cpp.

Referenced by read_calibration_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup()

void setup ( void  )

Definition at line 266 of file ICM20789.cpp.

Here is the call graph for this function:

Variable Documentation

◆ dev

◆ hal

const AP_HAL::HAL& hal = AP_HAL::get_HAL()

-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-

The strategy for roll/pitch autotune is to give the user a AUTOTUNE flight mode which behaves just like FBWA, but does automatic tuning.

While the user is flying in AUTOTUNE the gains are saved every 10 seconds, but the saved gains are not the current gains, instead it saves the gains from 10s ago. When the user exits AUTOTUNE the gains are restored from 10s ago.

This allows the user to fly as much as they want in AUTOTUNE mode, and if they are ever unhappy they just exit the mode. If they stay in AUTOTUNE for more than 10s then their gains will have changed.

Using this approach users don't need any special switches, they just need to be able to enter and exit AUTOTUNE mode

Definition at line 12 of file ICM20789.cpp.

◆ i2c_dev

Definition at line 14 of file ICM20789.cpp.

◆ spi_dev

Definition at line 15 of file ICM20789.cpp.