2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 #define AO_MS5607_RESET 0x1e
24 #define AO_MS5607_CONVERT_D1_256 0x40
25 #define AO_MS5607_CONVERT_D1_512 0x42
26 #define AO_MS5607_CONVERT_D1_1024 0x44
27 #define AO_MS5607_CONVERT_D1_2048 0x46
28 #define AO_MS5607_CONVERT_D1_4096 0x48
30 #define AO_MS5607_CONVERT_D2_256 0x50
31 #define AO_MS5607_CONVERT_D2_512 0x52
32 #define AO_MS5607_CONVERT_D2_1024 0x54
33 #define AO_MS5607_CONVERT_D2_2048 0x56
34 #define AO_MS5607_CONVERT_D2_4096 0x58
36 #define AO_MS5607_ADC_READ 0x00
37 #define AO_MS5607_PROM_READ(ad) (0xA0 | ((ad) << 1))
39 struct ao_ms5607_prom {
50 struct ao_ms5607_sample {
51 uint32_t pres; /* raw 24 bit sensor */
52 uint32_t temp; /* raw 24 bit sensor */
55 struct ao_ms5607_value {
56 int32_t pres; /* in Pa * 10 */
57 int32_t temp; /* in °C * 100 */
60 extern __xdata struct ao_ms5607_sample ao_ms5607_current;
61 extern __xdata struct ao_ms5607_prom ao_ms5607_prom;
64 ao_ms5607_setup(void);
73 ao_ms5607_sample(__xdata struct ao_ms5607_sample *sample);
76 ao_ms5607_convert(__xdata struct ao_ms5607_sample *sample,
77 __xdata struct ao_ms5607_value *value);
79 #endif /* _AO_MS5607_H_ */