Paparazzi UAS  v6.0_unstable-92-g17422e4-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
rm3100.h File Reference

PNI RM3100 3-axis magnetometer driver interface (I2C). More...

#include "std.h"
#include "mcu_periph/i2c.h"
#include "math/pprz_algebra_int.h"
+ Include dependency graph for rm3100.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Rm3100
 
union  Rm3100.data
 

Macros

#define RM3100_ADDR0   (0b0100000 << 1)
 The lower 2 bits of the slave address are user-configurable, using pins 3 and 28. More...
 
#define RM3100_ADDR1   (0b0100001 << 1)
 
#define RM3100_ADDR2   (0b0100010 << 1)
 
#define RM3100_ADDR3   (0b0100011 << 1)
 
#define RM3100_RATE_600   0x92
 
#define RM3100_RATE_300   0x93
 
#define RM3100_RATE_150   0x94
 
#define RM3100_RATE_75   0x95
 
#define RM3100_RATE_37   0x96
 
#define RM3100_RATE_18   0x97
 
#define RM3100_RATE_9   0x98
 
#define RM3100_RATE_4_5   0x99
 
#define RM3100_RATE_2_3   0x9A
 
#define RM3100_RATE_1_2   0x9B
 
#define RM3100_RATE_0_6   0x9C
 
#define RM3100_RATE_0_3   0x9D
 
#define RM3100_RATE_0_15   0x9E
 
#define RM3100_RATE_0_075   0x9F
 
#define RM3100_TMRC_DEFAULT   RM3100_RATE_150
 

Enumerations

enum  Rm3100Status {
  RM3100_CONF_UNINIT, RM3100_CONF_CCR_DONE, RM3100_CONF_TMRC_DONE, RM3100_CONF_CCM_DONE,
  RM3100_STATUS_IDLE, RM3100_STATUS_MEAS
}
 config status states More...
 

Functions

void rm3100_init (struct Rm3100 *mag, struct i2c_periph *i2c_p, uint8_t addr, uint8_t data_rate)
 
void rm3100_configure (struct Rm3100 *mag)
 
void rm3100_event (struct Rm3100 *mag)
 
void rm3100_read (struct Rm3100 *mag)
 
static void rm3100_periodic (struct Rm3100 *mag)
 convenience function: read or start configuration if not already initialized More...
 

Detailed Description

PNI RM3100 3-axis magnetometer driver interface (I2C).

Definition in file rm3100.h.


Data Structure Documentation

struct Rm3100

Definition at line 72 of file rm3100.h.

+ Collaboration diagram for Rm3100:
Data Fields
union Rm3100 data
volatile bool data_available data ready flag
uint8_t data_rate sensor data rate
struct i2c_periph * i2c_p peripheral used for communcation
struct i2c_transaction i2c_trans i2c transaction
bool initialized config done flag
enum Rm3100Status status init status
union Rm3100.data

Definition at line 79 of file rm3100.h.

Data Fields
int32_t value[3] data values accessible by channel index
struct Int32Vect3 vect data vector in mag coordinate system

Macro Definition Documentation

#define RM3100_ADDR0   (0b0100000 << 1)

The lower 2 bits of the slave address are user-configurable, using pins 3 and 28.

Definition at line 37 of file rm3100.h.

#define RM3100_ADDR1   (0b0100001 << 1)

Definition at line 38 of file rm3100.h.

#define RM3100_ADDR2   (0b0100010 << 1)

Definition at line 39 of file rm3100.h.

#define RM3100_ADDR3   (0b0100011 << 1)

Definition at line 40 of file rm3100.h.

#define RM3100_RATE_0_075   0x9F

Definition at line 56 of file rm3100.h.

#define RM3100_RATE_0_15   0x9E

Definition at line 55 of file rm3100.h.

#define RM3100_RATE_0_3   0x9D

Definition at line 54 of file rm3100.h.

#define RM3100_RATE_0_6   0x9C

Definition at line 53 of file rm3100.h.

#define RM3100_RATE_150   0x94

Definition at line 45 of file rm3100.h.

#define RM3100_RATE_18   0x97

Definition at line 48 of file rm3100.h.

#define RM3100_RATE_1_2   0x9B

Definition at line 52 of file rm3100.h.

#define RM3100_RATE_2_3   0x9A

Definition at line 51 of file rm3100.h.

#define RM3100_RATE_300   0x93

Definition at line 44 of file rm3100.h.

#define RM3100_RATE_37   0x96

Definition at line 47 of file rm3100.h.

#define RM3100_RATE_4_5   0x99

Definition at line 50 of file rm3100.h.

#define RM3100_RATE_600   0x92

Definition at line 43 of file rm3100.h.

#define RM3100_RATE_75   0x95

Definition at line 46 of file rm3100.h.

#define RM3100_RATE_9   0x98

Definition at line 49 of file rm3100.h.

#define RM3100_TMRC_DEFAULT   RM3100_RATE_150

Definition at line 59 of file rm3100.h.

Enumeration Type Documentation

config status states

Enumerator
RM3100_CONF_UNINIT 
RM3100_CONF_CCR_DONE 
RM3100_CONF_TMRC_DONE 
RM3100_CONF_CCM_DONE 
RM3100_STATUS_IDLE 
RM3100_STATUS_MEAS 

Definition at line 62 of file rm3100.h.

Function Documentation

void rm3100_event ( struct Rm3100 mag)
void rm3100_init ( struct Rm3100 mag,
struct i2c_periph i2c_p,
uint8_t  addr,
uint8_t  data_rate 
)
static void rm3100_periodic ( struct Rm3100 mag)
inlinestatic

convenience function: read or start configuration if not already initialized

Definition at line 92 of file rm3100.h.

References Rm3100::initialized, rm3100_configure(), and rm3100_read().

Referenced by mag_rm3100_module_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rm3100_read ( struct Rm3100 mag)

Definition at line 130 of file rm3100.c.

References i2c_transaction::buf, Rm3100::i2c_p, Rm3100::i2c_trans, i2c_transceive(), RM3100_ADDR_MX, RM3100_STATUS_IDLE, RM3100_STATUS_MEAS, i2c_transaction::slave_addr, and Rm3100::status.

Referenced by rm3100_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: