Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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

◆ MM_BUSY

#define MM_BUSY   1

Definition at line 16 of file mag_micromag_fw.h.

◆ MM_DATA_AVAILABLE

#define MM_DATA_AVAILABLE   6

Definition at line 21 of file mag_micromag_fw.h.

◆ MM_GOT_EOC

#define MM_GOT_EOC   4

Definition at line 19 of file mag_micromag_fw.h.

◆ MM_IDLE

#define MM_IDLE   0

Definition at line 15 of file mag_micromag_fw.h.

◆ MM_NB_AXIS

#define MM_NB_AXIS   3

Definition at line 6 of file mag_micromag_fw.h.

◆ MM_READING_RES

#define MM_READING_RES   5

Definition at line 20 of file mag_micromag_fw.h.

◆ MM_SENDING_REQ

#define MM_SENDING_REQ   2

Definition at line 17 of file mag_micromag_fw.h.

◆ MM_WAITING_EOC

#define MM_WAITING_EOC   3

Definition at line 18 of file mag_micromag_fw.h.

◆ SS_IOCLR

#define SS_IOCLR   IO0CLR

Definition at line 42 of file mag_micromag_fw.h.

◆ SS_IODIR

#define SS_IODIR   IO0DIR

Definition at line 40 of file mag_micromag_fw.h.

◆ SS_IOSET

#define SS_IOSET   IO0SET

Definition at line 41 of file mag_micromag_fw.h.

◆ SS_PIN

#define SS_PIN   20

Definition at line 39 of file mag_micromag_fw.h.

◆ SSP_ClearRti

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

Definition at line 59 of file mag_micromag_fw.h.

◆ SSP_CLOCK

#define SSP_CLOCK   468750

Definition at line 24 of file mag_micromag_fw.h.

◆ SSP_CPHA

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

Definition at line 30 of file mag_micromag_fw.h.

◆ SSP_CPOL

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

Definition at line 29 of file mag_micromag_fw.h.

◆ SSP_DDS

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

Definition at line 27 of file mag_micromag_fw.h.

◆ SSP_Disable

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

Definition at line 52 of file mag_micromag_fw.h.

◆ SSP_DisableRti

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

Definition at line 58 of file mag_micromag_fw.h.

◆ SSP_DisableRxi

#define SSP_DisableRxi ( )    ClearBit(SSPIMSC, RXIM)

Definition at line 54 of file mag_micromag_fw.h.

◆ SSP_DisableTxi

#define SSP_DisableTxi ( )    ClearBit(SSPIMSC, TXIM)

Definition at line 56 of file mag_micromag_fw.h.

◆ SSP_Enable

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

Definition at line 51 of file mag_micromag_fw.h.

◆ SSP_EnableRti

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

Definition at line 57 of file mag_micromag_fw.h.

◆ SSP_EnableRxi

#define SSP_EnableRxi ( )    SetBit(SSPIMSC, RXIM)

Definition at line 53 of file mag_micromag_fw.h.

◆ SSP_EnableTxi

#define SSP_EnableTxi ( )    SetBit(SSPIMSC, TXIM)

Definition at line 55 of file mag_micromag_fw.h.

◆ SSP_FRF

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

Definition at line 28 of file mag_micromag_fw.h.

◆ SSP_LBM

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

Definition at line 34 of file mag_micromag_fw.h.

◆ SSP_MS

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

Definition at line 36 of file mag_micromag_fw.h.

◆ SSP_PINSEL1_MISO

#define SSP_PINSEL1_MISO   (2<<4)

Definition at line 48 of file mag_micromag_fw.h.

◆ SSP_PINSEL1_MOSI

#define SSP_PINSEL1_MOSI   (2<<6)

Definition at line 49 of file mag_micromag_fw.h.

◆ SSP_PINSEL1_SCK

#define SSP_PINSEL1_SCK   (2<<2)

Definition at line 47 of file mag_micromag_fw.h.

◆ SSP_SCR

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

Definition at line 31 of file mag_micromag_fw.h.

◆ SSP_SOD

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

Definition at line 37 of file mag_micromag_fw.h.

◆ SSP_SSE

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

Definition at line 35 of file mag_micromag_fw.h.

◆ SSPCR0_VAL

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

Definition at line 44 of file mag_micromag_fw.h.

◆ SSPCR1_VAL

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

Definition at line 45 of file mag_micromag_fw.h.

Function Documentation

◆ micromag_event()

void micromag_event ( void  )

◆ micromag_init()

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:

◆ micromag_periodic()

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.

◆ micromag_read()

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.

◆ micromag_reset()

void micromag_reset ( void  )

Definition at line 59 of file mag_micromag_fw.c.

References micromag_status, and MM_IDLE.

Variable Documentation

◆ micromag_status

volatile uint8_t micromag_status

◆ micromag_values

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().