47 ms->spi_trans.slave_idx = slave_idx;
48 ms->spi_trans.output_length = 1;
49 ms->spi_trans.input_length = 4;
50 ms->spi_trans.before_cb =
NULL;
51 ms->spi_trans.after_cb =
NULL;
52 ms->spi_trans.input_buf =
ms->rx_buf;
53 ms->spi_trans.output_buf =
ms->tx_buf;
58 ms->data_available =
false;
59 ms->initialized =
false;
62 ms->is_ms5607 = is_ms5607;
68 ms->initialized =
false;
135 if (
ms->initialized) {
141 switch (
ms->status) {
145 ms->data.d1 = (
ms->rx_buf[1] << 16) |
146 (
ms->rx_buf[2] << 8) |
148 if (
ms->data.d1 == 0) {
161 ms->data.d2 = (
ms->rx_buf[1] << 16) |
162 (
ms->rx_buf[2] << 8) |
164 if (
ms->data.d2 == 0) {
185 switch (
ms->spi_trans.status) {
196 ms->data.c[
ms->prom_cnt++] = (
ms->rx_buf[1] << 8) |
205 ms->initialized =
true;
enum SPIStatus status
internal state of the peripheral
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
@ SPICpolIdleHigh
CPOL = 1.
@ SPISelectUnselect
slave is selected before transaction and unselected after
SPI peripheral structure.
bool ms5607_calc(struct Ms5611Data *ms)
Calculate temperature and compensated pressure for MS5607.
bool ms5611_prom_crc_ok(uint16_t *prom)
Check if CRC of PROM data is OK.
bool ms5611_calc(struct Ms5611Data *ms)
Calculate temperature and compensated pressure for MS5611.
@ MS5611_STATUS_CONV_D2_OK
@ MS5611_STATUS_CONV_D1_OK
#define MS5611_START_CONV_D1
#define MS5611_SOFT_RESET
#define MS5611_START_CONV_D2
void ms5611_spi_start_configure(struct Ms5611_Spi *ms)
void ms5611_spi_event(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.
void ms5611_spi_init(struct Ms5611_Spi *ms, struct spi_periph *spi_p, uint8_t slave_idx, bool is_ms5607)
Measurement Specialties (Intersema) MS5611-01BA and MS5607-02BA03 pressure/temperature sensor interfa...
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.