Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ak8963.h File Reference

Register and address definitions for AK8963 magnetometer. More...

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

Go to the source code of this file.

Data Structures

struct  Ak8963
 Default Ak8963 structure. More...
 
union  Ak8963.data
 

Enumerations

enum  Ak8963ConfStatus { AK_CONF_UNINIT, AK_CONF_MODE, AK_CONF_DONE }
 Config status states. More...
 
enum  Ak8963Status { AK_STATUS_IDLE, AK_STATUS_READ, AK_STATUS_DONE }
 Normal status states. More...
 

Functions

void ak8963_init (struct Ak8963 *ak, struct i2c_periph *i2c_p, uint8_t addr)
 Initialize AK8963 struct. More...
 
void ak8963_configure (struct Ak8963 *ak)
 
void ak8963_event (struct Ak8963 *ak)
 
void ak8963_read (struct Ak8963 *ak)
 
static void ak8963_periodic (struct Ak8963 *ak)
 convenience function: read or start configuration if not already initialized More...
 

Detailed Description

Register and address definitions for AK8963 magnetometer.

Definition in file ak8963.h.


Data Structure Documentation

struct Ak8963

Default Ak8963 structure.

Definition at line 53 of file ak8963.h.

+ Collaboration diagram for Ak8963:
Data Fields
union Ak8963 data
volatile bool data_available data ready flag
struct i2c_periph * i2c_p peripheral used for communcation
struct i2c_transaction i2c_trans i2c transaction used for communication with the ak8936
enum Ak8963ConfStatus init_status init status
bool initialized config done flag
enum Ak8963Status status main status
union Ak8963.data

Definition at line 62 of file ak8963.h.

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

Enumeration Type Documentation

Config status states.

Enumerator
AK_CONF_UNINIT 
AK_CONF_MODE 
AK_CONF_DONE 

Definition at line 39 of file ak8963.h.

Normal status states.

Enumerator
AK_STATUS_IDLE 
AK_STATUS_READ 
AK_STATUS_DONE 

Definition at line 46 of file ak8963.h.

Function Documentation

void ak8963_configure ( struct Ak8963 ak)
void ak8963_init ( struct Ak8963 ak,
struct i2c_periph i2c_p,
uint8_t  addr 
)

Initialize AK8963 struct.

Definition at line 34 of file ak8963.c.

References AK_CONF_UNINIT, Ak8963::data_available, Ak8963::i2c_p, Ak8963::i2c_trans, I2CTransDone, Ak8963::init_status, Ak8963::initialized, i2c_transaction::slave_addr, and i2c_transaction::status.

Referenced by imu_bebop_init(), imu_disco_init(), and mpu9250_i2c_init().

+ Here is the caller graph for this function:

static void ak8963_periodic ( struct Ak8963 ak)
inlinestatic

convenience function: read or start configuration if not already initialized

Definition at line 75 of file ak8963.h.

References ak8963_configure(), ak8963_read(), and Ak8963::initialized.

Referenced by imu_bebop_periodic(), and imu_disco_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ak8963_read ( struct Ak8963 ak)

Definition at line 83 of file ak8963.c.

References AK8963_REG_ST1, AK_STATUS_IDLE, i2c_transaction::buf, Ak8963::i2c_p, Ak8963::i2c_trans, i2c_transceive(), i2c_transaction::slave_addr, and Ak8963::status.

Referenced by ak8963_periodic(), and mpu9250_i2c_read().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: