Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
mag_micromag_fw_hw.h File Reference
#include <stdlib.h>
#include "std.h"
#include "LPC21xx.h"
#include "mcu.h"
#include "mcu_periph/spi.h"
#include <BOARD_CONFIG>
#include "generated/airframe.h"
+ Include dependency graph for mag_micromag_fw_hw.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MM_DIVISOR_128   2
 
#define MM_DIVISOR_256   3
 
#define MM_DIVISOR_512   4
 
#define MM_DIVISOR_1024   5
 
#define MM_DIVISOR   MM_DIVISOR_512
 
#define MmSelect()   SetBit(MM_SS_IOCLR,MM_SS_PIN)
 
#define MmUnselect()   SetBit(MM_SS_IOSET,MM_SS_PIN)
 
#define MmReset()   SetBit(MM_RESET_IOCLR,MM_RESET_PIN)
 
#define MmSet()   SetBit(MM_RESET_IOSET,MM_RESET_PIN)
 
#define MmOnSpiIt()
 
#define MmSendReq()
 
#define MmReadRes()
 

Functions

void micromag_hw_init (void)
 

Variables

volatile uint8_t micromag_cur_axe
 

Macro Definition Documentation

◆ MM_DIVISOR

#define MM_DIVISOR   MM_DIVISOR_512

Definition at line 20 of file mag_micromag_fw_hw.h.

◆ MM_DIVISOR_1024

#define MM_DIVISOR_1024   5

Definition at line 18 of file mag_micromag_fw_hw.h.

◆ MM_DIVISOR_128

#define MM_DIVISOR_128   2

Definition at line 15 of file mag_micromag_fw_hw.h.

◆ MM_DIVISOR_256

#define MM_DIVISOR_256   3

Definition at line 16 of file mag_micromag_fw_hw.h.

◆ MM_DIVISOR_512

#define MM_DIVISOR_512   4

Definition at line 17 of file mag_micromag_fw_hw.h.

◆ MmOnSpiIt

#define MmOnSpiIt ( )

Definition at line 31 of file mag_micromag_fw_hw.h.

◆ MmReadRes

#define MmReadRes ( )
Value:
{ \
micromag_status = MM_READING_RES; \
MmSelect(); \
/* trigger 2 bytes read */ \
SSPDR = 0; \
SSPDR = 0; \
SpiEnable(); \
SpiClearRti(); \
SpiEnableRti(); \
}

Definition at line 80 of file mag_micromag_fw_hw.h.

◆ MmReset

#define MmReset ( )    SetBit(MM_RESET_IOCLR,MM_RESET_PIN)

Definition at line 28 of file mag_micromag_fw_hw.h.

◆ MmSelect

#define MmSelect ( )    SetBit(MM_SS_IOCLR,MM_SS_PIN)

Definition at line 25 of file mag_micromag_fw_hw.h.

◆ MmSendReq

#define MmSendReq ( )
Value:
{ \
MmSelect(); \
micromag_status = MM_SENDING_REQ; \
MmSet(); \
SpiClearRti(); \
SpiEnableRti(); \
MmReset(); \
uint8_t control_byte = (micromag_cur_axe+1) << 0 | MM_DIVISOR_1024 << 4; \
SSPDR = control_byte; \
SpiEnable(); \
}

Definition at line 68 of file mag_micromag_fw_hw.h.

◆ MmSet

#define MmSet ( )    SetBit(MM_RESET_IOSET,MM_RESET_PIN)

Definition at line 29 of file mag_micromag_fw_hw.h.

◆ MmUnselect

#define MmUnselect ( )    SetBit(MM_SS_IOSET,MM_SS_PIN)

Definition at line 26 of file mag_micromag_fw_hw.h.

Function Documentation

◆ micromag_hw_init()

void micromag_hw_init ( void  )

Definition at line 48 of file mag_micromag_fw_hw.c.

References _VIC_ADDR, _VIC_CNTL, EXTINT, EXTINT_ISR(), EXTMODE, EXTPOLAR, MmReset, MmUnselect, PINSEL1, SPI1_VIC_SLOT, SSP_ISR(), SSP_PINSEL1_MISO, SSP_PINSEL1_MOSI, SSP_PINSEL1_SCK, SSPCPSR, SSPCR0, SSPCR0_VAL, SSPCR1, SSPCR1_VAL, VIC_BIT, VIC_ENABLE, VIC_SPI1, VICIntEnable, and VICIntSelect.

Referenced by micromag_init().

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

Variable Documentation

◆ micromag_cur_axe

volatile uint8_t micromag_cur_axe

Definition at line 13 of file mag_micromag_fw_hw.c.

MM_READING_RES
#define MM_READING_RES
Definition: mag_micromag_fw.h:20
MM_DIVISOR_1024
#define MM_DIVISOR_1024
Definition: mag_micromag_fw_hw.h:18
MM_SENDING_REQ
#define MM_SENDING_REQ
Definition: mag_micromag_fw.h:17
micromag_cur_axe
volatile uint8_t micromag_cur_axe
Definition: mag_micromag_fw_hw.c:13