NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
compass_hmc5883l.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <platform.h>
#include "debug.h"
#include "common/axis.h"
#include "common/maths.h"
#include "system.h"
#include "nvic.h"
#include "gpio.h"
#include "bus_i2c.h"
#include "light_led.h"
#include "sensor.h"
#include "compass.h"
#include "compass_hmc5883l.h"
Include dependency graph for compass_hmc5883l.c:

Macros

#define MAG_ADDRESS   0x1E
 
#define MAG_DATA_REGISTER   0x03
 
#define HMC58X3_R_CONFA   0
 
#define HMC58X3_R_CONFB   1
 
#define HMC58X3_R_MODE   2
 
#define HMC58X3_X_SELF_TEST_GAUSS   (+1.16f)
 
#define HMC58X3_Y_SELF_TEST_GAUSS   (+1.16f)
 
#define HMC58X3_Z_SELF_TEST_GAUSS   (+1.08f)
 
#define SELF_TEST_LOW_LIMIT   (243.0f / 390.0f)
 
#define SELF_TEST_HIGH_LIMIT   (575.0f / 390.0f)
 
#define HMC_POS_BIAS   1
 
#define HMC_NEG_BIAS   2
 

Functions

void MAG_DATA_READY_EXTI_Handler (void)
 
bool hmc5883lDetect (mag_t *mag, const hmc5883Config_t *hmc5883ConfigToUse)
 
void hmc5883lInit (void)
 
bool hmc5883lRead (int16_t *magData)
 

Macro Definition Documentation

#define HMC58X3_R_CONFA   0
#define HMC58X3_R_CONFB   1
#define HMC58X3_R_MODE   2
#define HMC58X3_X_SELF_TEST_GAUSS   (+1.16f)
#define HMC58X3_Y_SELF_TEST_GAUSS   (+1.16f)
#define HMC58X3_Z_SELF_TEST_GAUSS   (+1.08f)
#define HMC_NEG_BIAS   2
#define HMC_POS_BIAS   1
#define MAG_ADDRESS   0x1E
#define MAG_DATA_REGISTER   0x03
#define SELF_TEST_HIGH_LIMIT   (575.0f / 390.0f)
#define SELF_TEST_LOW_LIMIT   (243.0f / 390.0f)

Function Documentation

bool hmc5883lDetect ( mag_t mag,
const hmc5883Config_t hmc5883ConfigToUse 
)

Here is the call graph for this function:

void hmc5883lInit ( void  )

Here is the call graph for this function:

bool hmc5883lRead ( int16_t *  magData)

Here is the call graph for this function:

void MAG_DATA_READY_EXTI_Handler ( void  )

Here is the call graph for this function: