Paparazzi UAS
v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
spa06_regs.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2026 OpenUAS
3
* Thanks to Florian Sansou florian.sansou@enac.fr for initial implementation
4
*
5
* This file is part of paparazzi.
6
*
7
* paparazzi is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2, or (at your option)
10
* any later version.
11
*
12
* paparazzi is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with paparazzi; see the file COPYING. If not, see
19
* <http://www.gnu.org/licenses/>.
20
*
21
*/
22
31
#ifndef SPA06_REGS_H
32
#define SPA06_REGS_H
33
34
#include "
std.h
"
35
36
// I2C addresses (8-bit, i.e. 7-bit address << 1)
37
38
#define SPA06_I2C_ADDR 0xec
// 0x76 << 1 (SDO pin pulled down to GND)
39
#define SPA06_I2C_ADDR_ALT 0xee
// 0x77 << 1 (SDO pin high, default)
40
42
#define SPL06_CHIP_ID 0x10
// SPL06-001 (product 0, revision 1)
43
#define SPA06_CHIP_ID 0x11
// SPA06-003 (product 1, revision 1)
44
45
#define SPL06_READ_FLAG 0x80
// OR into the register address for SPI reads (bit 7 = RW = '1')
46
47
#define SPL06_REG_PRESSURE_B2 0x00
// Pressure MSB Register
48
#define SPL06_REG_PRESSURE_B1 0x01
// Pressure middle byte Register
49
#define SPL06_REG_PRESSURE_B0 0x02
// Pressure LSB Register
50
#define SPL06_REG_PRESSURE_START SPL06_REG_PRESSURE_B2
51
#define SPL06_PRESSURE_LEN 3
// 24 bits, 3 bytes
52
#define SPL06_REG_TEMPERATURE_B2 0x03
// Temperature MSB Register
53
#define SPL06_REG_TEMPERATURE_B1 0x04
// Temperature middle byte Register
54
#define SPL06_REG_TEMPERATURE_B0 0x05
// Temperature LSB Register
55
#define SPL06_REG_TEMPERATURE_START SPL06_REG_TEMPERATURE_B2
56
#define SPL06_TEMPERATURE_LEN 3
// 24 bits, 3 bytes
57
#define SPL06_REG_PRESSURE_CFG 0x06
// Pressure config
58
#define SPL06_REG_TEMPERATURE_CFG 0x07
// Temperature config
59
#define SPL06_REG_MODE_AND_STATUS 0x08
// Mode and status
60
#define SPL06_REG_INT_AND_FIFO_CFG 0x09
// Interrupt and FIFO config
61
#define SPL06_REG_INT_STATUS 0x0A
// Interrupt status
62
#define SPL06_REG_FIFO_STATUS 0x0B
// FIFO status
63
#define SPL06_REG_RST 0x0C
// Softreset Register
64
#define SPL06_RESET_BIT_SOFT_RST 0x09
// 0b1001: write to RST to trigger a full soft reset (~40ms until ready)
65
#define SPL06_REG_CHIP_ID 0x0D
// Chip ID Register
66
#define SPL06_REG_CALIB_COEFFS_START 0x10
// First calibration coefficient register (c0)
67
#define SPL06_REG_CALIB_COEFFS_END 0x21
// Last coefficient on the SPL06 (c30), 18 bytes total
68
#define SPA06_REG_CALIB_COEFFS_END 0x24
// Last coefficient on the SPA06 (c40), 21 bytes total (adds c31/c40)
69
#define SPL06_REG_COEF_SRCE 0x28
// Calibration coefficients temperature sensor source
70
#define SPL06_COEF_SRCE_BIT_TMP_COEF_SRCE (1<<7)
// Mirror this bit into TMP_CFG bit 7 (TMP_EXT)
71
72
// PRESSURE_CFG_REG
73
// Background mode measurement rate, bits [6:4] (PM_RATE), rate code = log2(measurements/s).
74
// Keep the total conversion time of pressure + temperature below 1s per second.
75
#define SPL06_PRES_RATE_1HZ (0x00 << 4)
// 1 pressure measurement per second
76
#define SPL06_PRES_RATE_4HZ (0x02 << 4)
// 4 pressure measurements per second
77
#define SPL06_PRES_RATE_8HZ (0x03 << 4)
// 8 pressure measurements per second
78
#define SPL06_PRES_RATE_32HZ (0x05 << 4)
// 32 pressure measurements per second
79
80
// TEMPERATURE_CFG_REG
81
// Rate in bits [6:4] (TMP_RATE), same coding and 1s/s conversion time budget as PM_RATE above.
82
#define SPL06_TEMP_USE_EXT_SENSOR (1<<7)
// TMP_EXT: measure with the external (MEMS) sensor; must match TMP_COEF_SRCE
83
#define SPL06_TEMP_RATE_1HZ (0x00 << 4)
// 1 temperature measurement per second
84
#define SPL06_TEMP_RATE_4HZ (0x02 << 4)
// 4 temperature measurements per second
85
#define SPL06_TEMP_RATE_32HZ (0x05 << 4)
// 32 temperature measurements per second
86
87
// MODE_AND_STATUS_REG
88
// Measurement control in bits [2:0] (MEAS_CTRL), status flags in bits [7:4].
89
#define SPL06_MEAS_PRESSURE (1<<0)
// one-shot pressure measurement command
90
#define SPL06_MEAS_TEMPERATURE (1<<1)
// one-shot temperature measurement command
91
#define SPL06_MEAS_CON_PRE_TEM 0x07
// MEAS_CTRL 111: continuous pressure and temperature measurement
92
93
#define SPL06_MEAS_CFG_CONTINUOUS (1<<2)
// background (continuous) measurement mode bit
94
#define SPL06_MEAS_CFG_PRESSURE_RDY (1<<4)
// new pressure result available, cleared on read
95
#define SPL06_MEAS_CFG_TEMPERATURE_RDY (1<<5)
// new temperature result available, cleared on read
96
#define SPL06_MEAS_CFG_SENSOR_RDY (1<<6)
// sensor initialization complete after power-up/reset
97
#define SPL06_MEAS_CFG_COEFFS_RDY (1<<7)
// calibration coefficients valid (~40ms after power-up)
98
99
// INT_AND_FIFO_CFG_REG
100
#define SPL06_PRESSURE_RESULT_BIT_SHIFT (1<<2)
// necessary for pressure oversampling > 8
101
#define SPL06_TEMPERATURE_RESULT_BIT_SHIFT (1<<3)
// necessary for temperature oversampling > 8
102
103
// Oversampling codes for TMP_CFG bits [3:0] (TMP_PRC).
104
// Each code has its own compensation scale factor, see raw_value_scale_factor().
105
#define SPL06_OVERSAMPLING_1X_T 0x00
// single. (Default) - Measurement time 3.6 ms
106
#define SPL06_OVERSAMPLING_2X_T 0x01
// 2 times
107
#define SPL06_OVERSAMPLING_4X_T 0x02
// 4 times
108
#define SPL06_OVERSAMPLING_8X_T 0x03
// 8 times.
109
#define SPL06_OVERSAMPLING_16X_T 0x04
// 16 times
110
#define SPL06_OVERSAMPLING_32X_T 0x05
// 32 times
111
#define SPL06_OVERSAMPLING_64X_T 0x06
// 64 times
112
#define SPL06_OVERSAMPLING_128X_T 0x07
// 128 times
113
114
// Oversampling codes for PRS_CFG bits [3:0] (PM_PRC). Measurement times:
115
// 1x=3.6ms 2x=5.2ms 4x=8.4ms 8x=14.8ms 16x=27.6ms 32x=53.2ms 64x=104.4ms 128x=206.8ms
116
#define SPL06_OVERSAMPLING_1X_P 0x00
// Single. (Low Precision)
117
#define SPL06_OVERSAMPLING_2X_P 0x01
// 2 times (Low Power)
118
#define SPL06_OVERSAMPLING_4X_P 0x02
// 4 times
119
#define SPL06_OVERSAMPLING_8X_P 0x03
// 8 times.
120
#define SPL06_OVERSAMPLING_16X_P 0x04
// 16 times (Standard) Use in combination with a bit shift
121
#define SPL06_OVERSAMPLING_32X_P 0x05
// 32 times Use in combination with a bit shift
122
#define SPL06_OVERSAMPLING_64X_P 0x06
// 64 times (High Precision) Use in combination with a bit shift
123
#define SPL06_OVERSAMPLING_128X_P 0x07
// 128 times Use in combination with a bit shift
124
125
#endif
/* SPA06_REGS_H */
std.h
sw
airborne
peripherals
spa06_regs.h
Generated on Sat Jul 18 2026 21:40:03 for Paparazzi UAS by
1.9.8