APM:Libraries
|
#include <utility>
#include <AP_HAL/AP_HAL.h>
#include <AP_Math/AP_Math.h>
#include "AP_Compass_LSM303D.h"
#include <AP_HAL_Linux/GPIO.h>
Go to the source code of this file.
Macros | |
#define | LSM303D_DRDY_M_PIN -1 |
#define | DIR_READ (1<<7) |
#define | DIR_WRITE (0<<7) |
#define | ADDR_INCREMENT (1<<6) |
#define | ADDR_WHO_AM_I 0x0F |
#define | WHO_I_AM 0x49 |
#define | ADDR_OUT_TEMP_L 0x05 |
#define | ADDR_OUT_TEMP_H 0x06 |
#define | ADDR_STATUS_M 0x07 |
#define | ADDR_OUT_X_L_M 0x08 |
#define | ADDR_OUT_X_H_M 0x09 |
#define | ADDR_OUT_Y_L_M 0x0A |
#define | ADDR_OUT_Y_H_M 0x0B |
#define | ADDR_OUT_Z_L_M 0x0C |
#define | ADDR_OUT_Z_H_M 0x0D |
#define | ADDR_INT_CTRL_M 0x12 |
#define | ADDR_INT_SRC_M 0x13 |
#define | ADDR_REFERENCE_X 0x1c |
#define | ADDR_REFERENCE_Y 0x1d |
#define | ADDR_REFERENCE_Z 0x1e |
#define | ADDR_STATUS_A 0x27 |
#define | ADDR_OUT_X_L_A 0x28 |
#define | ADDR_OUT_X_H_A 0x29 |
#define | ADDR_OUT_Y_L_A 0x2A |
#define | ADDR_OUT_Y_H_A 0x2B |
#define | ADDR_OUT_Z_L_A 0x2C |
#define | ADDR_OUT_Z_H_A 0x2D |
#define | ADDR_CTRL_REG0 0x1F |
#define | ADDR_CTRL_REG1 0x20 |
#define | ADDR_CTRL_REG2 0x21 |
#define | ADDR_CTRL_REG3 0x22 |
#define | ADDR_CTRL_REG4 0x23 |
#define | ADDR_CTRL_REG5 0x24 |
#define | ADDR_CTRL_REG6 0x25 |
#define | ADDR_CTRL_REG7 0x26 |
#define | ADDR_FIFO_CTRL 0x2e |
#define | ADDR_FIFO_SRC 0x2f |
#define | ADDR_IG_CFG1 0x30 |
#define | ADDR_IG_SRC1 0x31 |
#define | ADDR_IG_THS1 0x32 |
#define | ADDR_IG_DUR1 0x33 |
#define | ADDR_IG_CFG2 0x34 |
#define | ADDR_IG_SRC2 0x35 |
#define | ADDR_IG_THS2 0x36 |
#define | ADDR_IG_DUR2 0x37 |
#define | ADDR_CLICK_CFG 0x38 |
#define | ADDR_CLICK_SRC 0x39 |
#define | ADDR_CLICK_THS 0x3a |
#define | ADDR_TIME_LIMIT 0x3b |
#define | ADDR_TIME_LATENCY 0x3c |
#define | ADDR_TIME_WINDOW 0x3d |
#define | ADDR_ACT_THS 0x3e |
#define | ADDR_ACT_DUR 0x3f |
#define | REG1_RATE_BITS_A ((1<<7) | (1<<6) | (1<<5) | (1<<4)) |
#define | REG1_POWERDOWN_A ((0<<7) | (0<<6) | (0<<5) | (0<<4)) |
#define | REG1_RATE_3_125HZ_A ((0<<7) | (0<<6) | (0<<5) | (1<<4)) |
#define | REG1_RATE_6_25HZ_A ((0<<7) | (0<<6) | (1<<5) | (0<<4)) |
#define | REG1_RATE_12_5HZ_A ((0<<7) | (0<<6) | (1<<5) | (1<<4)) |
#define | REG1_RATE_25HZ_A ((0<<7) | (1<<6) | (0<<5) | (0<<4)) |
#define | REG1_RATE_50HZ_A ((0<<7) | (1<<6) | (0<<5) | (1<<4)) |
#define | REG1_RATE_100HZ_A ((0<<7) | (1<<6) | (1<<5) | (0<<4)) |
#define | REG1_RATE_200HZ_A ((0<<7) | (1<<6) | (1<<5) | (1<<4)) |
#define | REG1_RATE_400HZ_A ((1<<7) | (0<<6) | (0<<5) | (0<<4)) |
#define | REG1_RATE_800HZ_A ((1<<7) | (0<<6) | (0<<5) | (1<<4)) |
#define | REG1_RATE_1600HZ_A ((1<<7) | (0<<6) | (1<<5) | (0<<4)) |
#define | REG1_BDU_UPDATE (1<<3) |
#define | REG1_Z_ENABLE_A (1<<2) |
#define | REG1_Y_ENABLE_A (1<<1) |
#define | REG1_X_ENABLE_A (1<<0) |
#define | REG2_ANTIALIAS_FILTER_BW_BITS_A ((1<<7) | (1<<6)) |
#define | REG2_AA_FILTER_BW_773HZ_A ((0<<7) | (0<<6)) |
#define | REG2_AA_FILTER_BW_194HZ_A ((0<<7) | (1<<6)) |
#define | REG2_AA_FILTER_BW_362HZ_A ((1<<7) | (0<<6)) |
#define | REG2_AA_FILTER_BW_50HZ_A ((1<<7) | (1<<6)) |
#define | REG2_FULL_SCALE_BITS_A ((1<<5) | (1<<4) | (1<<3)) |
#define | REG2_FULL_SCALE_2G_A ((0<<5) | (0<<4) | (0<<3)) |
#define | REG2_FULL_SCALE_4G_A ((0<<5) | (0<<4) | (1<<3)) |
#define | REG2_FULL_SCALE_6G_A ((0<<5) | (1<<4) | (0<<3)) |
#define | REG2_FULL_SCALE_8G_A ((0<<5) | (1<<4) | (1<<3)) |
#define | REG2_FULL_SCALE_16G_A ((1<<5) | (0<<4) | (0<<3)) |
#define | REG5_ENABLE_T (1<<7) |
#define | REG5_RES_HIGH_M ((1<<6) | (1<<5)) |
#define | REG5_RES_LOW_M ((0<<6) | (0<<5)) |
#define | REG5_RATE_BITS_M ((1<<4) | (1<<3) | (1<<2)) |
#define | REG5_RATE_3_125HZ_M ((0<<4) | (0<<3) | (0<<2)) |
#define | REG5_RATE_6_25HZ_M ((0<<4) | (0<<3) | (1<<2)) |
#define | REG5_RATE_12_5HZ_M ((0<<4) | (1<<3) | (0<<2)) |
#define | REG5_RATE_25HZ_M ((0<<4) | (1<<3) | (1<<2)) |
#define | REG5_RATE_50HZ_M ((1<<4) | (0<<3) | (0<<2)) |
#define | REG5_RATE_100HZ_M ((1<<4) | (0<<3) | (1<<2)) |
#define | REG5_RATE_DO_NOT_USE_M ((1<<4) | (1<<3) | (0<<2)) |
#define | REG6_FULL_SCALE_BITS_M ((1<<6) | (1<<5)) |
#define | REG6_FULL_SCALE_2GA_M ((0<<6) | (0<<5)) |
#define | REG6_FULL_SCALE_4GA_M ((0<<6) | (1<<5)) |
#define | REG6_FULL_SCALE_8GA_M ((1<<6) | (0<<5)) |
#define | REG6_FULL_SCALE_12GA_M ((1<<6) | (1<<5)) |
#define | REG7_CONT_MODE_M ((0<<1) | (0<<0)) |
#define | INT_CTRL_M 0x12 |
#define | INT_SRC_M 0x13 |
#define | LSM303D_MAG_DEFAULT_RANGE_GA 2 |
#define | LSM303D_MAG_DEFAULT_RATE 100 |
Variables | |
const AP_HAL::HAL & | hal |
#define ADDR_ACT_DUR 0x3f |
Definition at line 92 of file AP_Compass_LSM303D.cpp.
#define ADDR_ACT_THS 0x3e |
Definition at line 91 of file AP_Compass_LSM303D.cpp.
#define ADDR_CLICK_CFG 0x38 |
Definition at line 85 of file AP_Compass_LSM303D.cpp.
#define ADDR_CLICK_SRC 0x39 |
Definition at line 86 of file AP_Compass_LSM303D.cpp.
#define ADDR_CLICK_THS 0x3a |
Definition at line 87 of file AP_Compass_LSM303D.cpp.
#define ADDR_CTRL_REG0 0x1F |
Definition at line 65 of file AP_Compass_LSM303D.cpp.
#define ADDR_CTRL_REG1 0x20 |
Definition at line 66 of file AP_Compass_LSM303D.cpp.
#define ADDR_CTRL_REG2 0x21 |
Definition at line 67 of file AP_Compass_LSM303D.cpp.
#define ADDR_CTRL_REG3 0x22 |
Definition at line 68 of file AP_Compass_LSM303D.cpp.
#define ADDR_CTRL_REG4 0x23 |
Definition at line 69 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init().
#define ADDR_CTRL_REG5 0x24 |
Definition at line 70 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init(), and AP_Compass_LSM303D::_mag_set_samplerate().
#define ADDR_CTRL_REG6 0x25 |
Definition at line 71 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_range().
#define ADDR_CTRL_REG7 0x26 |
Definition at line 72 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init(), and AP_Compass_LSM303D::_read_sample().
#define ADDR_FIFO_CTRL 0x2e |
Definition at line 74 of file AP_Compass_LSM303D.cpp.
#define ADDR_FIFO_SRC 0x2f |
Definition at line 75 of file AP_Compass_LSM303D.cpp.
#define ADDR_IG_CFG1 0x30 |
Definition at line 77 of file AP_Compass_LSM303D.cpp.
#define ADDR_IG_CFG2 0x34 |
Definition at line 81 of file AP_Compass_LSM303D.cpp.
#define ADDR_IG_DUR1 0x33 |
Definition at line 80 of file AP_Compass_LSM303D.cpp.
#define ADDR_IG_DUR2 0x37 |
Definition at line 84 of file AP_Compass_LSM303D.cpp.
#define ADDR_IG_SRC1 0x31 |
Definition at line 78 of file AP_Compass_LSM303D.cpp.
#define ADDR_IG_SRC2 0x35 |
Definition at line 82 of file AP_Compass_LSM303D.cpp.
#define ADDR_IG_THS1 0x32 |
Definition at line 79 of file AP_Compass_LSM303D.cpp.
#define ADDR_IG_THS2 0x36 |
Definition at line 83 of file AP_Compass_LSM303D.cpp.
#define ADDR_INCREMENT (1<<6) |
Definition at line 35 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_block_read().
#define ADDR_INT_CTRL_M 0x12 |
Definition at line 51 of file AP_Compass_LSM303D.cpp.
#define ADDR_INT_SRC_M 0x13 |
Definition at line 52 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_TEMP_H 0x06 |
Definition at line 42 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_TEMP_L 0x05 |
Definition at line 41 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_X_H_A 0x29 |
Definition at line 59 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_X_H_M 0x09 |
Definition at line 45 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_X_L_A 0x28 |
Definition at line 58 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_X_L_M 0x08 |
Definition at line 44 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_Y_H_A 0x2B |
Definition at line 61 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_Y_H_M 0x0B |
Definition at line 47 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_Y_L_A 0x2A |
Definition at line 60 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_Y_L_M 0x0A |
Definition at line 46 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_Z_H_A 0x2D |
Definition at line 63 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_Z_H_M 0x0D |
Definition at line 49 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_Z_L_A 0x2C |
Definition at line 62 of file AP_Compass_LSM303D.cpp.
#define ADDR_OUT_Z_L_M 0x0C |
Definition at line 48 of file AP_Compass_LSM303D.cpp.
#define ADDR_REFERENCE_X 0x1c |
Definition at line 53 of file AP_Compass_LSM303D.cpp.
#define ADDR_REFERENCE_Y 0x1d |
Definition at line 54 of file AP_Compass_LSM303D.cpp.
#define ADDR_REFERENCE_Z 0x1e |
Definition at line 55 of file AP_Compass_LSM303D.cpp.
#define ADDR_STATUS_A 0x27 |
Definition at line 57 of file AP_Compass_LSM303D.cpp.
#define ADDR_STATUS_M 0x07 |
Definition at line 43 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_read_sample().
#define ADDR_TIME_LATENCY 0x3c |
Definition at line 89 of file AP_Compass_LSM303D.cpp.
#define ADDR_TIME_LIMIT 0x3b |
Definition at line 88 of file AP_Compass_LSM303D.cpp.
#define ADDR_TIME_WINDOW 0x3d |
Definition at line 90 of file AP_Compass_LSM303D.cpp.
#define ADDR_WHO_AM_I 0x0F |
Definition at line 38 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init().
#define DIR_READ (1<<7) |
Definition at line 33 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_block_read(), and AP_Compass_LSM303D::_register_read().
#define DIR_WRITE (0<<7) |
Definition at line 34 of file AP_Compass_LSM303D.cpp.
#define INT_CTRL_M 0x12 |
Definition at line 147 of file AP_Compass_LSM303D.cpp.
#define INT_SRC_M 0x13 |
Definition at line 148 of file AP_Compass_LSM303D.cpp.
#define LSM303D_DRDY_M_PIN -1 |
Definition at line 29 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::init().
#define LSM303D_MAG_DEFAULT_RANGE_GA 2 |
Definition at line 150 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init().
#define LSM303D_MAG_DEFAULT_RATE 100 |
Definition at line 151 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init().
#define REG1_BDU_UPDATE (1<<3) |
Definition at line 107 of file AP_Compass_LSM303D.cpp.
#define REG1_POWERDOWN_A ((0<<7) | (0<<6) | (0<<5) | (0<<4)) |
Definition at line 95 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_100HZ_A ((0<<7) | (1<<6) | (1<<5) | (0<<4)) |
Definition at line 101 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_12_5HZ_A ((0<<7) | (0<<6) | (1<<5) | (1<<4)) |
Definition at line 98 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_1600HZ_A ((1<<7) | (0<<6) | (1<<5) | (0<<4)) |
Definition at line 105 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_200HZ_A ((0<<7) | (1<<6) | (1<<5) | (1<<4)) |
Definition at line 102 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_25HZ_A ((0<<7) | (1<<6) | (0<<5) | (0<<4)) |
Definition at line 99 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_3_125HZ_A ((0<<7) | (0<<6) | (0<<5) | (1<<4)) |
Definition at line 96 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_400HZ_A ((1<<7) | (0<<6) | (0<<5) | (0<<4)) |
Definition at line 103 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_50HZ_A ((0<<7) | (1<<6) | (0<<5) | (1<<4)) |
Definition at line 100 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_6_25HZ_A ((0<<7) | (0<<6) | (1<<5) | (0<<4)) |
Definition at line 97 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_800HZ_A ((1<<7) | (0<<6) | (0<<5) | (1<<4)) |
Definition at line 104 of file AP_Compass_LSM303D.cpp.
#define REG1_RATE_BITS_A ((1<<7) | (1<<6) | (1<<5) | (1<<4)) |
Definition at line 94 of file AP_Compass_LSM303D.cpp.
#define REG1_X_ENABLE_A (1<<0) |
Definition at line 110 of file AP_Compass_LSM303D.cpp.
#define REG1_Y_ENABLE_A (1<<1) |
Definition at line 109 of file AP_Compass_LSM303D.cpp.
#define REG1_Z_ENABLE_A (1<<2) |
Definition at line 108 of file AP_Compass_LSM303D.cpp.
#define REG2_AA_FILTER_BW_194HZ_A ((0<<7) | (1<<6)) |
Definition at line 114 of file AP_Compass_LSM303D.cpp.
#define REG2_AA_FILTER_BW_362HZ_A ((1<<7) | (0<<6)) |
Definition at line 115 of file AP_Compass_LSM303D.cpp.
#define REG2_AA_FILTER_BW_50HZ_A ((1<<7) | (1<<6)) |
Definition at line 116 of file AP_Compass_LSM303D.cpp.
#define REG2_AA_FILTER_BW_773HZ_A ((0<<7) | (0<<6)) |
Definition at line 113 of file AP_Compass_LSM303D.cpp.
#define REG2_ANTIALIAS_FILTER_BW_BITS_A ((1<<7) | (1<<6)) |
Definition at line 112 of file AP_Compass_LSM303D.cpp.
#define REG2_FULL_SCALE_16G_A ((1<<5) | (0<<4) | (0<<3)) |
Definition at line 123 of file AP_Compass_LSM303D.cpp.
#define REG2_FULL_SCALE_2G_A ((0<<5) | (0<<4) | (0<<3)) |
Definition at line 119 of file AP_Compass_LSM303D.cpp.
#define REG2_FULL_SCALE_4G_A ((0<<5) | (0<<4) | (1<<3)) |
Definition at line 120 of file AP_Compass_LSM303D.cpp.
#define REG2_FULL_SCALE_6G_A ((0<<5) | (1<<4) | (0<<3)) |
Definition at line 121 of file AP_Compass_LSM303D.cpp.
#define REG2_FULL_SCALE_8G_A ((0<<5) | (1<<4) | (1<<3)) |
Definition at line 122 of file AP_Compass_LSM303D.cpp.
#define REG2_FULL_SCALE_BITS_A ((1<<5) | (1<<4) | (1<<3)) |
Definition at line 118 of file AP_Compass_LSM303D.cpp.
#define REG5_ENABLE_T (1<<7) |
Definition at line 125 of file AP_Compass_LSM303D.cpp.
#define REG5_RATE_100HZ_M ((1<<4) | (0<<3) | (1<<2)) |
Definition at line 136 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_samplerate().
#define REG5_RATE_12_5HZ_M ((0<<4) | (1<<3) | (0<<2)) |
Definition at line 133 of file AP_Compass_LSM303D.cpp.
#define REG5_RATE_25HZ_M ((0<<4) | (1<<3) | (1<<2)) |
Definition at line 134 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_samplerate().
#define REG5_RATE_3_125HZ_M ((0<<4) | (0<<3) | (0<<2)) |
Definition at line 131 of file AP_Compass_LSM303D.cpp.
#define REG5_RATE_50HZ_M ((1<<4) | (0<<3) | (0<<2)) |
Definition at line 135 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_samplerate().
#define REG5_RATE_6_25HZ_M ((0<<4) | (0<<3) | (1<<2)) |
Definition at line 132 of file AP_Compass_LSM303D.cpp.
#define REG5_RATE_BITS_M ((1<<4) | (1<<3) | (1<<2)) |
Definition at line 130 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_samplerate().
#define REG5_RATE_DO_NOT_USE_M ((1<<4) | (1<<3) | (0<<2)) |
Definition at line 137 of file AP_Compass_LSM303D.cpp.
#define REG5_RES_HIGH_M ((1<<6) | (1<<5)) |
Definition at line 127 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init().
#define REG5_RES_LOW_M ((0<<6) | (0<<5)) |
Definition at line 128 of file AP_Compass_LSM303D.cpp.
#define REG6_FULL_SCALE_12GA_M ((1<<6) | (1<<5)) |
Definition at line 143 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_range().
#define REG6_FULL_SCALE_2GA_M ((0<<6) | (0<<5)) |
Definition at line 140 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_range().
#define REG6_FULL_SCALE_4GA_M ((0<<6) | (1<<5)) |
Definition at line 141 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_range().
#define REG6_FULL_SCALE_8GA_M ((1<<6) | (0<<5)) |
Definition at line 142 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_range().
#define REG6_FULL_SCALE_BITS_M ((1<<6) | (1<<5)) |
Definition at line 139 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_mag_set_range().
#define REG7_CONT_MODE_M ((0<<1) | (0<<0)) |
Definition at line 145 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init().
#define WHO_I_AM 0x49 |
Definition at line 39 of file AP_Compass_LSM303D.cpp.
Referenced by AP_Compass_LSM303D::_hardware_init().
const AP_HAL::HAL& hal |
Definition at line 14 of file AC_PID_test.cpp.