Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the ms2100 magnetic sensor from PNI. More...
#include "std.h"
#include "mcu_periph/spi.h"
#include "math/pprz_algebra_int.h"
#include "peripherals/ms2100_arch.h"
Go to the source code of this file.
Data Structures | |
struct | Ms2100 |
union | Ms2100.data |
Enumerations | |
enum | Ms2100Status { MS2100_IDLE, MS2100_SENDING_REQ, MS2100_GOT_EOC, MS2100_READING_RES, MS2100_DATA_AVAILABLE } |
Functions | |
void | ms2100_init (struct Ms2100 *ms, struct spi_periph *spi_p, uint8_t slave_idx) |
void | ms2100_read (struct Ms2100 *ms) |
send request to read next axis More... | |
void | ms2100_event (struct Ms2100 *ms) |
static void | ms2100_periodic (struct Ms2100 *ms) |
void | ms2100_arch_init (void) |
Variables | |
struct Ms2100 | ms2100 |
Driver for the ms2100 magnetic sensor from PNI.
Definition in file ms2100.h.
struct Ms2100 |
Data Fields | ||
---|---|---|
volatile uint8_t | cur_axe | |
union Ms2100 | data | |
volatile uint8_t | read_buf[2] | SPI buffer for reading a single axis. |
struct spi_transaction | read_trans | |
volatile uint8_t | req_buf[1] | SPI buffer for the command byte. |
struct spi_transaction | req_trans | |
struct spi_periph * | spi_p | |
enum Ms2100Status | status |
union Ms2100.data |
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in mag coordinate system |
enum Ms2100Status |
void ms2100_arch_init | ( | void | ) |
Definition at line 38 of file ms2100_arch.c.
References _VIC_ADDR, _VIC_CNTL, EXTINT, EXTINT_ISR(), EXTMODE, EXTPOLAR, GPIO13, GPIO5, gpio_set(), GPIOB, GPIOC, MS2100_DRDY_EINT, MS2100_DRDY_PINSEL, MS2100_DRDY_PINSEL_BIT, MS2100_DRDY_PINSEL_VAL, MS2100_DRDY_VIC_IT, MS2100_RESET_IODIR, MS2100_RESET_PIN, Ms2100Reset, VIC_BIT, VIC_ENABLE, VICIntEnable, and VICIntSelect.
Referenced by ms2100_init().
void ms2100_event | ( | struct Ms2100 * | ms | ) |
Definition at line 105 of file ms2100.c.
References Ms2100::cur_axe, Ms2100::data, Int16FromBuf, MS2100_DATA_AVAILABLE, MS2100_GOT_EOC, MS2100_IDLE, MS2100_READING_RES, Ms2100::read_buf, Ms2100::read_trans, Ms2100::req_trans, Ms2100::spi_p, spi_submit(), SPITransDone, SPITransFailed, SPITransSuccess, Ms2100::status, and spi_transaction::status.
void ms2100_init | ( | struct Ms2100 * | ms, |
struct spi_periph * | spi_p, | ||
uint8_t | slave_idx | ||
) |
Definition at line 47 of file ms2100.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, spi_transaction::cpha, spi_transaction::cpol, Ms2100::cur_axe, Ms2100::data, spi_transaction::dss, spi_transaction::input_buf, spi_transaction::input_length, INT_VECT3_ZERO, ms2100_arch_init(), MS2100_IDLE, ms2100_reset_cb(), spi_transaction::output_buf, spi_transaction::output_length, Ms2100::read_buf, Ms2100::read_trans, Ms2100::req_buf, Ms2100::req_trans, spi_transaction::select, spi_transaction::slave_idx, Ms2100::spi_p, SPICphaEdge1, SPICpolIdleLow, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, Ms2100::status, and spi_transaction::status.
Referenced by imu_b2_init().
|
inlinestatic |
Definition at line 65 of file ms2100.h.
References MS2100_IDLE, ms2100_read(), and Ms2100::status.
Referenced by imu_b2_periodic().
void ms2100_read | ( | struct Ms2100 * | ms | ) |
send request to read next axis
Definition at line 96 of file ms2100.c.
References Ms2100::cur_axe, MS2100_DIVISOR, MS2100_SENDING_REQ, Ms2100::req_buf, Ms2100::req_trans, Ms2100::spi_p, spi_submit(), and Ms2100::status.
Referenced by ms2100_periodic().
struct Ms2100 ms2100 |
Definition at line 44 of file ms2100.c.
Referenced by exti9_5_isr(), EXTINT_ISR(), imu_b2_init(), and imu_b2_periodic().