Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
baro_scp.c File Reference
#include "std.h"
#include "mcu_periph/sys_time.h"
#include "led.h"
#include "mcu.h"
#include "subsystems/abi.h"
#include "mcu_periph/uart.h"
#include "pprzlink/messages.h"
#include "subsystems/datalink/downlink.h"
#include "mcu_periph/spi.h"
#include "modules/sensors/baro_scp.h"
+ Include dependency graph for baro_scp.c:

Go to the source code of this file.

Macros

#define STA_UNINIT   0
 
#define STA_INITIALISING   1
 
#define STA_IDLE   2
 
#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 ScpSelect()   SetBit(SS_IOCLR,SS_PIN)
 
#define ScpUnselect()   SetBit(SS_IOSET,SS_PIN)
 
#define SPI1_VIC_SLOT   7
 

Functions

static void baro_scp_start_high_res_measurement (void)
 
static void baro_scp_read (void)
 
static void EXTINT_ISR (void)
 
static void SPI1_ISR (void)
 
void baro_scp_periodic (void)
 
void baro_scp_init (void)
 
void baro_scp_event (void)
 

Variables

uint8_t baro_scp_status
 
uint32_t baro_scp_pressure
 
uint16_t baro_scp_temperature
 
bool baro_scp_available
 

Macro Definition Documentation

#define ScpSelect ( )    SetBit(SS_IOCLR,SS_PIN)

Definition at line 63 of file baro_scp.c.

Referenced by baro_scp_read(), and baro_scp_start_high_res_measurement().

#define ScpUnselect ( )    SetBit(SS_IOSET,SS_PIN)

Definition at line 64 of file baro_scp.c.

Referenced by baro_scp_init(), and SPI1_ISR().

#define SPI1_VIC_SLOT   7

Definition at line 69 of file baro_scp.c.

Referenced by baro_scp_init().

#define SS_IOCLR   IO0CLR

Definition at line 61 of file baro_scp.c.

#define SS_IODIR   IO0DIR

Definition at line 59 of file baro_scp.c.

Referenced by baro_scp_init().

#define SS_IOSET   IO0SET

Definition at line 60 of file baro_scp.c.

#define SS_PIN   20

Definition at line 58 of file baro_scp.c.

Referenced by baro_scp_init().

#define SSP_CLOCK   468750

Definition at line 43 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 49 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 48 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 46 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 47 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 53 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 55 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 50 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 56 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 54 of file baro_scp.c.

#define STA_IDLE   2

Definition at line 22 of file baro_scp.c.

Referenced by SPI1_ISR().

#define STA_INITIALISING   1

Definition at line 21 of file baro_scp.c.

Referenced by baro_scp_periodic(), and SPI1_ISR().

#define STA_UNINIT   0

Definition at line 20 of file baro_scp.c.

Referenced by baro_scp_init(), and baro_scp_periodic().

Function Documentation

void baro_scp_event ( void  )

Definition at line 188 of file baro_scp.c.

void baro_scp_init ( void  )

Definition at line 72 of file baro_scp.c.

void baro_scp_periodic ( void  )

Definition at line 34 of file baro_scp.c.

static void baro_scp_read ( void  )
static

Definition at line 171 of file baro_scp.c.

References ScpSelect, SpiEnable, and SSPDR.

Referenced by EXTINT_ISR().

+ Here is the caller graph for this function:

static void baro_scp_start_high_res_measurement ( void  )
static

Definition at line 159 of file baro_scp.c.

References Ms5611_Spi::data, ScpSelect, SpiEnable, SpiEnableRti(), and SSPDR.

Referenced by baro_scp_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EXTINT_ISR ( void  )
static

Definition at line 148 of file baro_scp.c.

References baro_scp_read(), EXTINT, ISR_ENTRY, ISR_EXIT, SPI1_DRDY_EINT, and VICVectAddr.

Referenced by baro_scp_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SPI1_ISR ( void  )
static

Definition at line 109 of file baro_scp.c.

References baro_scp_available, baro_scp_pressure, baro_scp_status, baro_scp_temperature, ISR_ENTRY, ISR_EXIT, ScpUnselect, SpiClearRti(), SpiDisable, SSPDR, STA_IDLE, STA_INITIALISING, and VICVectAddr.

Referenced by baro_scp_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool baro_scp_available

Definition at line 27 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().

uint32_t baro_scp_pressure

Definition at line 25 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().

uint8_t baro_scp_status

Definition at line 24 of file baro_scp.c.

Referenced by baro_scp_init(), baro_scp_periodic(), and SPI1_ISR().

uint16_t baro_scp_temperature

Definition at line 26 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().