Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mag_micromag_fw.h File Reference
#include "std.h"
+ Include dependency graph for mag_micromag_fw.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MM_NB_AXIS   3
 
#define MM_IDLE   0
 
#define MM_BUSY   1
 
#define MM_SENDING_REQ   2
 
#define MM_WAITING_EOC   3
 
#define MM_GOT_EOC   4
 
#define MM_READING_RES   5
 
#define MM_DATA_AVAILABLE   6
 
#define SSP_CLOCK   468750
 
#define SSP_DDS   0x07 << 0 /* data size : 8 bits */
 
#define SSP_FRF   0x00 << 4 /* frame format : SPI */
 
#define SSP_CPOL   0x00 << 6 /* clock polarity : data captured on first clock transition */
 
#define SSP_CPHA   0x00 << 7 /* clock phase : SCK idles low */
 
#define SSP_SCR   0x0F << 8 /* serial clock rate : divide by 16 */
 
#define SSP_LBM   0x00 << 0 /* loopback mode : disabled */
 
#define SSP_SSE   0x00 << 1 /* SSP enable : disabled */
 
#define SSP_MS   0x00 << 2 /* master slave mode : master */
 
#define SSP_SOD   0x00 << 3 /* slave output disable : don't care when master */
 
#define SS_PIN   20
 
#define SS_IODIR   IO0DIR
 
#define SS_IOSET   IO0SET
 
#define SS_IOCLR   IO0CLR
 
#define SSPCR0_VAL   (SSP_DDS | SSP_FRF | SSP_CPOL | SSP_CPHA | SSP_SCR )
 
#define SSPCR1_VAL   (SSP_LBM | SSP_SSE | SSP_MS | SSP_SOD )
 
#define SSP_PINSEL1_SCK   (2<<2)
 
#define SSP_PINSEL1_MISO   (2<<4)
 
#define SSP_PINSEL1_MOSI   (2<<6)
 
#define SSP_Enable()   SetBit(SSPCR1, SSE);
 
#define SSP_Disable()   ClearBit(SSPCR1, SSE);
 
#define SSP_EnableRxi()   SetBit(SSPIMSC, RXIM)
 
#define SSP_DisableRxi()   ClearBit(SSPIMSC, RXIM)
 
#define SSP_EnableTxi()   SetBit(SSPIMSC, TXIM)
 
#define SSP_DisableTxi()   ClearBit(SSPIMSC, TXIM)
 
#define SSP_EnableRti()   SetBit(SSPIMSC, RTIM);
 
#define SSP_DisableRti()   ClearBit(SSPIMSC, RTIM);
 
#define SSP_ClearRti()   SetBit(SSPICR, RTIC);
 

Functions

void micromag_init (void)
 
void micromag_read (void)
 
void micromag_reset (void)
 
void micromag_periodic (void)
 
void micromag_event (void)
 

Variables

volatile uint8_t micromag_status
 
volatile int16_t micromag_values [MM_NB_AXIS]
 

Macro Definition Documentation

#define MM_BUSY   1

Definition at line 16 of file mag_micromag_fw.h.

#define MM_DATA_AVAILABLE   6

Definition at line 21 of file mag_micromag_fw.h.

Referenced by micromag_event(), and micromag_read().

#define MM_GOT_EOC   4

Definition at line 19 of file mag_micromag_fw.h.

Referenced by EXTINT_ISR(), micromag_periodic(), and micromag_read().

#define MM_IDLE   0
#define MM_NB_AXIS   3

Definition at line 6 of file mag_micromag_fw.h.

Referenced by micromag_init().

#define MM_READING_RES   5

Definition at line 20 of file mag_micromag_fw.h.

#define MM_SENDING_REQ   2

Definition at line 17 of file mag_micromag_fw.h.

#define MM_WAITING_EOC   3

Definition at line 18 of file mag_micromag_fw.h.

Referenced by micromag_periodic().

#define SS_IOCLR   IO0CLR

Definition at line 42 of file mag_micromag_fw.h.

#define SS_IODIR   IO0DIR

Definition at line 40 of file mag_micromag_fw.h.

#define SS_IOSET   IO0SET

Definition at line 41 of file mag_micromag_fw.h.

#define SS_PIN   20

Definition at line 39 of file mag_micromag_fw.h.

#define SSP_ClearRti ( )    SetBit(SSPICR, RTIC);

Definition at line 59 of file mag_micromag_fw.h.

#define SSP_CLOCK   468750

Definition at line 24 of file mag_micromag_fw.h.

#define SSP_CPHA   0x00 << 7 /* clock phase : SCK idles low */

Definition at line 30 of file mag_micromag_fw.h.

#define SSP_CPOL   0x00 << 6 /* clock polarity : data captured on first clock transition */

Definition at line 29 of file mag_micromag_fw.h.

#define SSP_DDS   0x07 << 0 /* data size : 8 bits */

Definition at line 27 of file mag_micromag_fw.h.

#define SSP_Disable ( )    ClearBit(SSPCR1, SSE);

Definition at line 52 of file mag_micromag_fw.h.

#define SSP_DisableRti ( )    ClearBit(SSPIMSC, RTIM);

Definition at line 58 of file mag_micromag_fw.h.

#define SSP_DisableRxi ( )    ClearBit(SSPIMSC, RXIM)

Definition at line 54 of file mag_micromag_fw.h.

#define SSP_DisableTxi ( )    ClearBit(SSPIMSC, TXIM)

Definition at line 56 of file mag_micromag_fw.h.

#define SSP_Enable ( )    SetBit(SSPCR1, SSE);

Definition at line 51 of file mag_micromag_fw.h.

#define SSP_EnableRti ( )    SetBit(SSPIMSC, RTIM);

Definition at line 57 of file mag_micromag_fw.h.

#define SSP_EnableRxi ( )    SetBit(SSPIMSC, RXIM)

Definition at line 53 of file mag_micromag_fw.h.

#define SSP_EnableTxi ( )    SetBit(SSPIMSC, TXIM)

Definition at line 55 of file mag_micromag_fw.h.

#define SSP_FRF   0x00 << 4 /* frame format : SPI */

Definition at line 28 of file mag_micromag_fw.h.

#define SSP_LBM   0x00 << 0 /* loopback mode : disabled */

Definition at line 34 of file mag_micromag_fw.h.

#define SSP_MS   0x00 << 2 /* master slave mode : master */

Definition at line 36 of file mag_micromag_fw.h.

#define SSP_PINSEL1_MISO   (2<<4)

Definition at line 48 of file mag_micromag_fw.h.

#define SSP_PINSEL1_MOSI   (2<<6)

Definition at line 49 of file mag_micromag_fw.h.

#define SSP_PINSEL1_SCK   (2<<2)

Definition at line 47 of file mag_micromag_fw.h.

#define SSP_SCR   0x0F << 8 /* serial clock rate : divide by 16 */

Definition at line 31 of file mag_micromag_fw.h.

#define SSP_SOD   0x00 << 3 /* slave output disable : don't care when master */

Definition at line 37 of file mag_micromag_fw.h.

#define SSP_SSE   0x00 << 1 /* SSP enable : disabled */

Definition at line 35 of file mag_micromag_fw.h.

#define SSPCR0_VAL   (SSP_DDS | SSP_FRF | SSP_CPOL | SSP_CPHA | SSP_SCR )

Definition at line 44 of file mag_micromag_fw.h.

#define SSPCR1_VAL   (SSP_LBM | SSP_SSE | SSP_MS | SSP_SOD )

Definition at line 45 of file mag_micromag_fw.h.

Function Documentation

void micromag_event ( void  )
void micromag_init ( void  )

Definition at line 47 of file mag_micromag_fw.c.

References micromag_hw_init(), micromag_status, micromag_values, MM_IDLE, and MM_NB_AXIS.

+ Here is the call graph for this function:

void micromag_periodic ( void  )

Definition at line 13 of file mag_micromag_fw.c.

References micromag_status, MM_GOT_EOC, MM_IDLE, MM_WAITING_EOC, MmReadRes, and MmSendReq.

void micromag_read ( void  )

Definition at line 64 of file mag_micromag_fw.c.

References micromag_status, MM_DATA_AVAILABLE, MM_GOT_EOC, MM_IDLE, MmReadRes, and MmSendReq.

void micromag_reset ( void  )

Definition at line 59 of file mag_micromag_fw.c.

References micromag_status, and MM_IDLE.

Variable Documentation

volatile uint8_t micromag_status
volatile int16_t micromag_values[MM_NB_AXIS]

Definition at line 10 of file mag_micromag_fw.c.

Referenced by micromag_event(), and micromag_init().