Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ms2100.c File Reference

Driver for the ms2100 magnetic sensor from PNI. More...

#include "peripherals/ms2100.h"
#include "mcu_periph/spi.h"
#include <stdlib.h>
+ Include dependency graph for ms2100.c:

Go to the source code of this file.

Macros

#define MS2100_DIVISOR_128   2
 
#define MS2100_DIVISOR_256   3
 
#define MS2100_DIVISOR_512   4
 
#define MS2100_DIVISOR_1024   5
 
#define MS2100_DIVISOR   MS2100_DIVISOR_1024
 
#define Int16FromBuf(_buf, _idx)   ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1]))
 

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
 
void ms2100_event (struct Ms2100 *ms)
 

Variables

struct Ms2100 ms2100
 

Detailed Description

Driver for the ms2100 magnetic sensor from PNI.

Definition in file ms2100.c.

Macro Definition Documentation

◆ Int16FromBuf

#define Int16FromBuf (   _buf,
  _idx 
)    ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1]))

Definition at line 103 of file ms2100.c.

◆ MS2100_DIVISOR

#define MS2100_DIVISOR   MS2100_DIVISOR_1024

Definition at line 40 of file ms2100.c.

◆ MS2100_DIVISOR_1024

#define MS2100_DIVISOR_1024   5

Definition at line 37 of file ms2100.c.

◆ MS2100_DIVISOR_128

#define MS2100_DIVISOR_128   2

Definition at line 34 of file ms2100.c.

◆ MS2100_DIVISOR_256

#define MS2100_DIVISOR_256   3

Definition at line 35 of file ms2100.c.

◆ MS2100_DIVISOR_512

#define MS2100_DIVISOR_512   4

Definition at line 36 of file ms2100.c.

Function Documentation

◆ ms2100_event()

void ms2100_event ( struct Ms2100 ms)

Definition at line 105 of file ms2100.c.

References foo, Int16FromBuf, MS2100_DATA_AVAILABLE, MS2100_GOT_EOC, MS2100_IDLE, MS2100_READING_RES, spi_submit(), SPITransDone, SPITransFailed, and SPITransSuccess.

+ Here is the call graph for this function:

◆ ms2100_init()

void ms2100_init ( struct Ms2100 ms,
struct spi_periph spi_p,
uint8_t  slave_idx 
)

◆ ms2100_read()

void ms2100_read ( struct Ms2100 ms)

send request to read next axis

Definition at line 96 of file ms2100.c.

References foo, MS2100_DIVISOR, MS2100_SENDING_REQ, and spi_submit().

Referenced by ms2100_periodic().

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

Variable Documentation

◆ ms2100

struct Ms2100 ms2100

Definition at line 44 of file ms2100.c.

Referenced by exti9_5_isr().