X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fdrivers%2Fao_ms5607.h;h=02350bb0cbf5977a05cc5a3fa141216b24cfdbf6;hb=c49bd3cb0c31a51fae79ddc92237cc309be9a242;hp=29df25e47066875500dc8767282cffed4414eec1;hpb=1541fc0bde71f503b1ae5757497e9e1e6d023111;p=fw%2Faltos diff --git a/src/drivers/ao_ms5607.h b/src/drivers/ao_ms5607.h index 29df25e4..02350bb0 100644 --- a/src/drivers/ao_ms5607.h +++ b/src/drivers/ao_ms5607.h @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -33,9 +34,9 @@ #define AO_MS5607_CONVERT_D2_4096 0x58 #define AO_MS5607_ADC_READ 0x00 -#define AO_MS5607_PROM_READ(ad) (0xA0 | ((ad) << 1)) +#define AO_MS5607_PROM_READ(ad) (0xA0U | (uint8_t) ((ad) << 1)) -struct ms5607_prom { +struct ao_ms5607_prom { uint16_t reserved; uint16_t sens; uint16_t off; @@ -47,14 +48,32 @@ struct ms5607_prom { }; struct ao_ms5607_sample { - int32_t temp; - int32_t pres; + uint32_t pres; /* raw 24 bit sensor */ + uint32_t temp; /* raw 24 bit sensor */ }; +struct ao_ms5607_value { + int32_t pres; /* in Pa * 10 */ + int32_t temp; /* in °C * 100 */ +}; + +extern struct ao_ms5607_sample ao_ms5607_current; +extern struct ao_ms5607_prom ao_ms5607_prom; + +void +ao_ms5607_setup(void); + void ao_ms5607_init(void); +void +ao_ms5607_info(void); + void ao_ms5607_sample(struct ao_ms5607_sample *sample); +void +ao_ms5607_convert(struct ao_ms5607_sample *sample, + struct ao_ms5607_value *value); + #endif /* _AO_MS5607_H_ */