Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Measurement Specialties (Intersema) MS5611-01BA and MS5607-02BA03 pressure/temperature sensor interface for SPI. More...
Go to the source code of this file.
Data Structures | |
struct | Ms5611_Spi |
Functions | |
void | ms5611_spi_init (struct Ms5611_Spi *ms, struct spi_periph *spi_p, uint8_t addr, bool is_ms5607) |
void | ms5611_spi_start_configure (struct Ms5611_Spi *ms) |
void | ms5611_spi_start_conversion (struct Ms5611_Spi *ms) |
void | ms5611_spi_periodic_check (struct Ms5611_Spi *ms) |
Periodic function to ensure proper delay after triggering reset or conversion. More... | |
void | ms5611_spi_event (struct Ms5611_Spi *ms) |
static void | ms5611_spi_read (struct Ms5611_Spi *ms) |
convenience function to trigger new measurement. More... | |
static void | ms5611_spi_periodic (struct Ms5611_Spi *ms) |
convenience function More... | |
Measurement Specialties (Intersema) MS5611-01BA and MS5607-02BA03 pressure/temperature sensor interface for SPI.
Definition in file ms5611_spi.h.
struct Ms5611_Spi |
Definition at line 36 of file ms5611_spi.h.
Data Fields | ||
---|---|---|
struct Ms5611Data | data | |
volatile bool | data_available | data ready flag |
bool | initialized | config done flag |
bool | is_ms5607 | TRUE if MS5607, FALSE if MS5611. |
int32_t | prom_cnt | number of bytes read from PROM |
volatile uint8_t | rx_buf[4] | |
struct spi_periph * | spi_p | |
struct spi_transaction | spi_trans | |
enum Ms5611Status | status | |
volatile uint8_t | tx_buf[1] |
void ms5611_spi_event | ( | struct Ms5611_Spi * | ms | ) |
Definition at line 133 of file ms5611_spi.c.
References Ms5611Data::c, Ms5611Data::d1, Ms5611Data::d2, Ms5611_Spi::data, Ms5611_Spi::data_available, if(), Ms5611_Spi::initialized, Ms5611_Spi::is_ms5607, ms5607_calc(), ms5611_calc(), ms5611_prom_crc_ok(), MS5611_PROM_READ, MS5611_START_CONV_D2, MS5611_STATUS_ADC_D1, MS5611_STATUS_ADC_D2, MS5611_STATUS_CONV_D2, MS5611_STATUS_IDLE, MS5611_STATUS_PROM, MS5611_STATUS_UNINIT, Ms5611_Spi::prom_cnt, PROM_NB, Ms5611_Spi::rx_buf, Ms5611_Spi::spi_p, spi_submit(), Ms5611_Spi::spi_trans, SPITransDone, SPITransFailed, SPITransSuccess, spi_transaction::status, Ms5611_Spi::status, and Ms5611_Spi::tx_buf.
Referenced by baro_event(), and baro_ms5611_event().
void ms5611_spi_init | ( | struct Ms5611_Spi * | ms, |
struct spi_periph * | spi_p, | ||
uint8_t | addr, | ||
bool | is_ms5607 | ||
) |
Definition at line 33 of file ms5611_spi.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, spi_transaction::cpha, spi_transaction::cpol, Ms5611_Spi::data_available, spi_transaction::dss, Ms5611_Spi::initialized, spi_transaction::input_buf, spi_transaction::input_length, Ms5611_Spi::is_ms5607, MS5611_STATUS_UNINIT, spi_transaction::output_buf, spi_transaction::output_length, Ms5611_Spi::prom_cnt, Ms5611_Spi::rx_buf, spi_transaction::select, spi_transaction::slave_idx, Ms5611_Spi::spi_p, Ms5611_Spi::spi_trans, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, Ms5611_Spi::status, and Ms5611_Spi::tx_buf.
Referenced by baro_init(), and baro_ms5611_init().
|
inlinestatic |
convenience function
Definition at line 71 of file ms5611_spi.h.
References ms5611_spi_periodic_check(), and ms5611_spi_read().
Referenced by baro_periodic().
void ms5611_spi_periodic_check | ( | struct Ms5611_Spi * | ms | ) |
Periodic function to ensure proper delay after triggering reset or conversion.
Should run at 100Hz max. Typical conversion time is 8.22ms at max resolution.
Definition at line 92 of file ms5611_spi.c.
References MS5611_ADC_READ, MS5611_PROM_READ, MS5611_STATUS_ADC_D1, MS5611_STATUS_ADC_D2, MS5611_STATUS_CONV_D1, MS5611_STATUS_CONV_D1_OK, MS5611_STATUS_CONV_D2, MS5611_STATUS_CONV_D2_OK, MS5611_STATUS_PROM, MS5611_STATUS_RESET, MS5611_STATUS_RESET_OK, Ms5611_Spi::prom_cnt, Ms5611_Spi::spi_p, spi_submit(), Ms5611_Spi::spi_trans, SPITransDone, spi_transaction::status, Ms5611_Spi::status, and Ms5611_Spi::tx_buf.
Referenced by baro_ms5611_periodic_check(), and ms5611_spi_periodic().
|
inlinestatic |
convenience function to trigger new measurement.
(or start configuration if not already initialized) Still need to regularly run ms5611_spi_periodic_check to complete the measurement.
Definition at line 61 of file ms5611_spi.h.
References Ms5611_Spi::initialized, ms5611_spi_start_configure(), and ms5611_spi_start_conversion().
Referenced by baro_ms5611_read(), and ms5611_spi_periodic().
void ms5611_spi_start_configure | ( | struct Ms5611_Spi * | ms | ) |
Definition at line 65 of file ms5611_spi.c.
References Ms5611_Spi::initialized, MS5611_SOFT_RESET, MS5611_STATUS_RESET, MS5611_STATUS_UNINIT, Ms5611_Spi::prom_cnt, Ms5611_Spi::spi_p, spi_submit(), Ms5611_Spi::spi_trans, Ms5611_Spi::status, and Ms5611_Spi::tx_buf.
Referenced by ms5611_spi_read().
void ms5611_spi_start_conversion | ( | struct Ms5611_Spi * | ms | ) |
Definition at line 76 of file ms5611_spi.c.
References MS5611_START_CONV_D1, MS5611_STATUS_CONV_D1, MS5611_STATUS_IDLE, Ms5611_Spi::spi_p, spi_submit(), Ms5611_Spi::spi_trans, SPITransDone, spi_transaction::status, Ms5611_Spi::status, and Ms5611_Spi::tx_buf.
Referenced by ms5611_spi_read().