Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
baro_MS5534A.c File Reference

Handling of the MS5534a pressure sensor. More...

#include "modules/sensors/baro_MS5534A.h"
#include "mcu_periph/spi.h"
#include "mcu_periph/uart.h"
#include "ap_downlink.h"
#include "subsystems/nav.h"
#include "estimator.h"
+ Include dependency graph for baro_MS5534A.c:

Go to the source code of this file.

Macros

#define STATUS_INIT1   0
 
#define STATUS_INIT2   1
 
#define STATUS_INIT3   2
 
#define STATUS_INIT4   3
 
#define STATUS_MEASURE_PRESSURE   4
 
#define STATUS_MEASURE_TEMPERATURE   5
 
#define STATUS_RESET   6
 
#define InitStatus()   (status <= STATUS_INIT4)
 
#define NextStatus()
 
#define CMD_INIT   0x1D
 
#define CMD_MEASUREMENT   0x0F
 
#define CMD_W1   0x50
 
#define CMD_W2   0x60
 
#define CMD_W3   0x90
 
#define CMD_W4   0xA0
 
#define CMD_PRESSURE   0x40
 
#define CMD_TEMPERATURE   0x20
 
#define Uint16(buf_input)   (buf_input[0] << 8 | buf_input[1])
 
#define MS5534A_MCLK   32768
 
#define PWM_PERIOD   ((PCLK / PWM_PRESCALER) / MS5534A_MCLK)
 
#define PWM_DUTY   (PWM_PERIOD / 2)
 

Functions

static void calibration (void)
 
void baro_MS5534A_init (void)
 
void baro_MS5534A_reset (void)
 
void baro_MS5534A_send (void)
 
void baro_MS5534A_event_task (void)
 
void baro_MS5534A_event (void)
 

Variables

bool_t baro_MS5534A_do_reset
 
uint32_t baro_MS5534A_pressure
 
uint16_t baro_MS5534A_temp
 
bool_t baro_MS5534A_available
 
bool_t alt_baro_enabled
 
uint32_t baro_MS5534A_ground_pressure
 
float baro_MS5534A_r
 
float baro_MS5534A_sigma2
 
float baro_MS5534A_z
 
static uint8_t status
 
static bool_t status_read_data
 
static uint16_t words [4]
 
static uint8_t cmds [6] = {CMD_W1, CMD_W2, CMD_W3, CMD_W4, CMD_PRESSURE, CMD_TEMPERATURE}
 
static uint8_t reset [3] = {0x15, 0x55, 0x40}
 
static uint8_t buf_input [3]
 
static uint8_t buf_output [3]
 
static uint16_t d1
 
static uint16_t d2
 
static uint16_t c1
 
static uint16_t c2
 
static uint16_t c3
 
static uint16_t c4
 
static uint16_t ut1
 
static uint16_t c6
 

Detailed Description

Handling of the MS5534a pressure sensor.

uses: MOSI, MISO, SCK and 32kHz @ P0.7 with 5V for the -A type

Definition in file baro_MS5534A.c.

Macro Definition Documentation

#define CMD_INIT   0x1D

Definition at line 72 of file baro_MS5534A.c.

Referenced by baro_MS5534A_send().

#define CMD_MEASUREMENT   0x0F

Definition at line 73 of file baro_MS5534A.c.

Referenced by baro_MS5534A_send().

#define CMD_PRESSURE   0x40

Definition at line 79 of file baro_MS5534A.c.

#define CMD_TEMPERATURE   0x20

Definition at line 80 of file baro_MS5534A.c.

#define CMD_W1   0x50

Definition at line 75 of file baro_MS5534A.c.

#define CMD_W2   0x60

Definition at line 76 of file baro_MS5534A.c.

#define CMD_W3   0x90

Definition at line 77 of file baro_MS5534A.c.

#define CMD_W4   0xA0

Definition at line 78 of file baro_MS5534A.c.

#define InitStatus ( )    (status <= STATUS_INIT4)

Definition at line 63 of file baro_MS5534A.c.

Referenced by baro_MS5534A_send().

#define MS5534A_MCLK   32768

Definition at line 110 of file baro_MS5534A.c.

#define NextStatus ( )
Value:
{ \
}; \
}
status
Definition: anemotaxis.c:10
#define STATUS_MEASURE_TEMPERATURE
Definition: baro_MS5534A.c:56
static bool_t status_read_data
Definition: baro_MS5534A.c:60
#define STATUS_MEASURE_PRESSURE
Definition: baro_MS5534A.c:55
static uint8_t status
Definition: baro_MS5534A.c:59

Definition at line 65 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task().

#define PWM_DUTY   (PWM_PERIOD / 2)

Definition at line 112 of file baro_MS5534A.c.

Referenced by baro_MS5534A_init().

#define PWM_PERIOD   ((PCLK / PWM_PRESCALER) / MS5534A_MCLK)

Definition at line 111 of file baro_MS5534A.c.

Referenced by baro_MS5534A_init().

#define STATUS_INIT1   0

Definition at line 51 of file baro_MS5534A.c.

Referenced by baro_MS5534A_init(), and baro_MS5534A_reset().

#define STATUS_INIT2   1

Definition at line 52 of file baro_MS5534A.c.

#define STATUS_INIT3   2

Definition at line 53 of file baro_MS5534A.c.

#define STATUS_INIT4   3

Definition at line 54 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task().

#define STATUS_MEASURE_PRESSURE   4

Definition at line 55 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and baro_MS5534A_init().

#define STATUS_MEASURE_TEMPERATURE   5

Definition at line 56 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task().

#define STATUS_RESET   6

Definition at line 57 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and baro_MS5534A_send().

#define Uint16 (   buf_input)    (buf_input[0] << 8 | buf_input[1])

Definition at line 89 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task().

Function Documentation

void baro_MS5534A_event ( void  )
void baro_MS5534A_event_task ( void  )

Definition at line 219 of file baro_MS5534A.c.

References baro_MS5534A_available, baro_MS5534A_pressure, baro_MS5534A_send(), baro_MS5534A_temp, buf_input, c1, c2, c3, c4, c6, calibration(), d1, d2, NextStatus, status, STATUS_INIT4, STATUS_MEASURE_PRESSURE, STATUS_MEASURE_TEMPERATURE, status_read_data, STATUS_RESET, TRUE, Uint16, ut1, and words.

Referenced by baro_MS5534A_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void baro_MS5534A_reset ( void  )

Definition at line 160 of file baro_MS5534A.c.

References FALSE, STATUS_INIT1, and status_read_data.

void baro_MS5534A_send ( void  )
static void calibration ( void  )
static

Definition at line 200 of file baro_MS5534A.c.

References c1, c2, c3, c4, c6, DefaultChannel, DefaultDevice, ut1, and words.

Referenced by baro_MS5534A_event_task(), and baro_MS5534A_init().

+ Here is the caller graph for this function:

Variable Documentation

bool_t alt_baro_enabled

Definition at line 44 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event(), and baro_MS5534A_init().

bool_t baro_MS5534A_available

Definition at line 43 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event(), baro_MS5534A_event_task(), and baro_MS5534A_init().

bool_t baro_MS5534A_do_reset

Definition at line 40 of file baro_MS5534A.c.

Referenced by baro_MS5534A_init().

uint32_t baro_MS5534A_ground_pressure

Definition at line 45 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event(), and baro_MS5534A_init().

uint32_t baro_MS5534A_pressure

Definition at line 41 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event(), and baro_MS5534A_event_task().

float baro_MS5534A_r

Definition at line 46 of file baro_MS5534A.c.

Referenced by baro_MS5534A_init().

float baro_MS5534A_sigma2

Definition at line 47 of file baro_MS5534A.c.

Referenced by baro_MS5534A_init().

uint16_t baro_MS5534A_temp

Definition at line 42 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task().

float baro_MS5534A_z

Definition at line 48 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event().

uint8_t buf_input[3]
static

Definition at line 86 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and baro_MS5534A_send().

uint8_t buf_output[3]
static

Definition at line 87 of file baro_MS5534A.c.

Referenced by baro_MS5534A_send().

uint16_t c1
static

Definition at line 197 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), calibration(), nav_anemotaxis(), and nav_eight().

uint16_t c2
static
uint16_t c3
static

Definition at line 197 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and calibration().

uint16_t c4
static

Definition at line 197 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and calibration().

uint16_t c6
static

Definition at line 197 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and calibration().

Definition at line 81 of file baro_MS5534A.c.

Referenced by baro_MS5534A_send().

uint16_t d1
static

Definition at line 196 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and main_periodic().

uint16_t d2
static

Definition at line 196 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task().

uint8_t reset[3] = {0x15, 0x55, 0x40}
static

Definition at line 82 of file baro_MS5534A.c.

Referenced by baro_MS5534A_send().

uint8_t status
static

Definition at line 59 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and baro_MS5534A_send().

bool_t status_read_data
static
uint16_t ut1
static

Definition at line 197 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), and calibration().

uint16_t words[4]
static

Definition at line 61 of file baro_MS5534A.c.

Referenced by baro_MS5534A_event_task(), baro_MS5534A_init(), and calibration().