This file contains functions for initializing and reading data from a magnetometer and accelerometer sensors using I2C communication. The module used is the LSM303DLHC. More...
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include "pico/time.h"
#include "hardware/gpio.h"
#include "hardware/i2c.h"
#include "magnetometer/magnetometer.h"
Functions | |
float | magneto_get_curr_bearing (void) |
Gets the current bearing of the magnetometer sensor. More... | |
float | magneto_get_true_bearing (void) |
Gets the true bearing of the magnetometer sensor. More... | |
void | magneto_init (void) |
Initializes the magnetometer by initializing the USB, I2C, and setting the GPIO pins. | |
bool | magneto_is_bearing_invalid () |
Checks if the current bearing is invalid if it is out of bounds. More... | |
void | magneto_read_data (void) |
Reads magnetometer data from the magnetometer sensor and outputs the values into the global variables. More... | |
This file contains functions for initializing and reading data from a magnetometer and accelerometer sensors using I2C communication. The module used is the LSM303DLHC.
float magneto_get_curr_bearing | ( | void | ) |
Gets the current bearing of the magnetometer sensor.
References gp_current_bearing.
float magneto_get_true_bearing | ( | void | ) |
Gets the true bearing of the magnetometer sensor.
References gp_true_heading.
bool magneto_is_bearing_invalid | ( | void | ) |
Checks if the current bearing is invalid if it is out of bounds.
References gp_current_bearing, gp_max_bearing, and gp_min_bearing.
void magneto_read_data | ( | void | ) |
Reads magnetometer data from the magnetometer sensor and outputs the values into the global variables.
References gp_current_bearing, gp_max_bearing, gp_min_bearing, gp_true_heading, MAGNETO_BEARING_OFFSET, and MAGNETO_METER_ADDR.