Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
baro_scp.c File Reference
#include "std.h"
#include "mcu_periph/sys_time.h"
#include "led.h"
#include "mcu.h"
#include "mcu_periph/uart.h"
#include "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 DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE
 
#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)
 

Functions

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

Variables

uint8_t baro_scp_status
 
uint32_t baro_scp_pressure
 
uint16_t baro_scp_temperature
 
bool_t baro_scp_available
 

Macro Definition Documentation

#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE

Definition at line 19 of file baro_scp.c.

#define ScpSelect ( )    SetBit(SS_IOCLR,SS_PIN)

Definition at line 64 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 65 of file baro_scp.c.

Referenced by baro_scp_init(), and SPI1_ISR().

#define SS_IOCLR   IO0CLR

Definition at line 62 of file baro_scp.c.

#define SS_IODIR   IO0DIR

Definition at line 60 of file baro_scp.c.

Referenced by baro_scp_init().

#define SS_IOSET   IO0SET

Definition at line 61 of file baro_scp.c.

#define SS_PIN   20

Definition at line 59 of file baro_scp.c.

Referenced by baro_scp_init().

#define SSP_CLOCK   468750

Definition at line 44 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 50 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 49 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 47 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 48 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 54 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 56 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 51 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 57 of file baro_scp.c.

Referenced by baro_scp_init().

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

Definition at line 55 of file baro_scp.c.

#define STA_IDLE   2

Definition at line 24 of file baro_scp.c.

Referenced by SPI1_ISR().

#define STA_INITIALISING   1

Definition at line 23 of file baro_scp.c.

Referenced by EXTINT_ISR(), and SPI1_ISR().

#define STA_UNINIT   0

Definition at line 22 of file baro_scp.c.

Referenced by baro_scp_init(), and EXTINT_ISR().

Function Documentation

void baro_scp_event ( void  )

Definition at line 179 of file baro_scp.c.

void baro_scp_init ( void  )

Definition at line 67 of file baro_scp.c.

static void baro_scp_read ( void  )
static

Definition at line 163 of file baro_scp.c.

References ScpSelect, SpiEnable, and SSPDR.

static void baro_scp_start_high_res_measurement ( void  )
static

Definition at line 152 of file baro_scp.c.

References ScpSelect, SpiEnable, SpiEnableRti, and SSPDR.

Referenced by EXTINT_ISR().

+ Here is the caller graph for this function:

static void EXTINT_ISR ( void  )
static

Definition at line 33 of file baro_scp.c.

References baro_scp_start_high_res_measurement(), baro_scp_status, cpu_time_sec, STA_INITIALISING, and STA_UNINIT.

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  )

Definition at line 103 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, TRUE, and VICVectAddr.

Referenced by baro_scp_init().

+ Here is the caller graph for this function:

Variable Documentation

bool_t baro_scp_available

Definition at line 29 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().

uint32_t baro_scp_pressure

Definition at line 27 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().

uint8_t baro_scp_status

Definition at line 26 of file baro_scp.c.

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

uint16_t baro_scp_temperature

Definition at line 28 of file baro_scp.c.

Referenced by baro_scp_event(), and SPI1_ISR().