Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
ak8975.c File Reference

Driver for the AKM AK8975 magnetometer. More...

Include dependency graph for ak8975.c:

Go to the source code of this file.

Macros

#define AK8975_MEAS_TIME_MS   9
#define RawFromBuf(_buf, _idx)
#define Int16FromRaw(_raw)

Functions

static float get_ajusted_value (const int16_t val, const uint8_t axis)
void ak8975_init (struct Ak8975 *ak, struct i2c_periph *i2c_p, uint8_t addr)
void ak8975_configure (struct Ak8975 *ak)
void ak8975_read (struct Ak8975 *ak)
void ak8975_event (struct Ak8975 *ak)

Variables

static float calibration_values [3] = { 0, 0, 0 }

Detailed Description

Driver for the AKM AK8975 magnetometer.

Definition in file ak8975.c.

Macro Definition Documentation

◆ AK8975_MEAS_TIME_MS

#define AK8975_MEAS_TIME_MS   9

Definition at line 31 of file ak8975.c.

Referenced by ak8975_event().

◆ Int16FromRaw

#define Int16FromRaw ( _raw)
Value:
( (_raw & 0x1FFF) > 0xFFF ? (_raw & 0x1FFF) - 0x2000 : (_raw & 0x0FFF) )

Definition at line 130 of file ak8975.c.

Referenced by ak8975_event().

◆ RawFromBuf

#define RawFromBuf ( _buf,
_idx )
Value:
((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8)))
short int16_t
Typedef defining 16 bit short type.

Definition at line 128 of file ak8975.c.

Referenced by ak8975_event().

Function Documentation

◆ ak8975_configure()

◆ ak8975_event()

◆ ak8975_init()

void ak8975_init ( struct Ak8975 * ak,
struct i2c_periph * i2c_p,
uint8_t addr )

◆ ak8975_read()

void ak8975_read ( struct Ak8975 * ak)

Definition at line 113 of file ak8975.c.

References AK8975_MODE_SINGLE_MEAS, AK8975_REG_CNTL_ADDR, AK_STATUS_IDLE, AK_STATUS_MEAS, i2c_transaction::buf, get_sys_time_msec(), Ak8975::i2c_p, Ak8975::i2c_trans, i2c_transmit(), Ak8975::last_meas_time, i2c_transaction::slave_addr, and Ak8975::status.

Referenced by ak8975_periodic().

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

◆ get_ajusted_value()

float get_ajusted_value ( const int16_t val,
const uint8_t axis )
static

Definition at line 38 of file ak8975.c.

References calibration_values, H, and val.

Variable Documentation

◆ calibration_values

float calibration_values[3] = { 0, 0, 0 }
static

Definition at line 36 of file ak8975.c.

Referenced by ak8975_configure(), and get_ajusted_value().