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

◆ ScpSelect

#define ScpSelect ( )    SetBit(SS_IOCLR,SS_PIN)

Definition at line 63 of file baro_scp.c.

◆ ScpUnselect

#define ScpUnselect ( )    SetBit(SS_IOSET,SS_PIN)

Definition at line 64 of file baro_scp.c.

◆ SPI1_VIC_SLOT

#define SPI1_VIC_SLOT   7

Definition at line 69 of file baro_scp.c.

◆ SS_IOCLR

#define SS_IOCLR   IO0CLR

Definition at line 61 of file baro_scp.c.

◆ SS_IODIR

#define SS_IODIR   IO0DIR

Definition at line 59 of file baro_scp.c.

◆ SS_IOSET

#define SS_IOSET   IO0SET

Definition at line 60 of file baro_scp.c.

◆ SS_PIN

#define SS_PIN   20

Definition at line 58 of file baro_scp.c.

◆ SSP_CLOCK

#define SSP_CLOCK   468750

Definition at line 43 of file baro_scp.c.

◆ SSP_CPHA

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

Definition at line 49 of file baro_scp.c.

◆ SSP_CPOL

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

Definition at line 48 of file baro_scp.c.

◆ SSP_DDS

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

Definition at line 46 of file baro_scp.c.

◆ SSP_FRF

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

Definition at line 47 of file baro_scp.c.

◆ SSP_LBM

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

Definition at line 53 of file baro_scp.c.

◆ SSP_MS

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

Definition at line 55 of file baro_scp.c.

◆ SSP_SCR

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

Definition at line 50 of file baro_scp.c.

◆ SSP_SOD

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

Definition at line 56 of file baro_scp.c.

◆ SSP_SSE

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

Definition at line 54 of file baro_scp.c.

◆ STA_IDLE

#define STA_IDLE   2

Definition at line 22 of file baro_scp.c.

◆ STA_INITIALISING

#define STA_INITIALISING   1

Definition at line 21 of file baro_scp.c.

◆ STA_UNINIT

#define STA_UNINIT   0

Definition at line 20 of file baro_scp.c.

Function Documentation

◆ baro_scp_event()

void baro_scp_event ( void  )

Definition at line 188 of file baro_scp.c.

◆ baro_scp_init()

void baro_scp_init ( void  )

Definition at line 72 of file baro_scp.c.

◆ baro_scp_periodic()

void baro_scp_periodic ( void  )

Definition at line 34 of file baro_scp.c.

◆ baro_scp_read()

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:

◆ baro_scp_start_high_res_measurement()

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:

◆ EXTINT_ISR()

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:

◆ SPI1_ISR()

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

◆ baro_scp_available

bool baro_scp_available

Definition at line 27 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().

◆ baro_scp_pressure

uint32_t baro_scp_pressure

Definition at line 25 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().

◆ baro_scp_status

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

◆ baro_scp_temperature

uint16_t baro_scp_temperature

Definition at line 26 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().