49 lines
1.2 KiB
C
49 lines
1.2 KiB
C
|
|
/*
|
||
|
|
* Baro_MS4525DO.h
|
||
|
|
*
|
||
|
|
* Created on: Jun 22, 2020
|
||
|
|
* Author: matth
|
||
|
|
*/
|
||
|
|
|
||
|
|
#ifndef MATT_BARO_MS4525DO_H_
|
||
|
|
#define MATT_BARO_MS4525DO_H_
|
||
|
|
|
||
|
|
#include "I2CDevice.h"
|
||
|
|
#include <FreeRTOS.h>
|
||
|
|
|
||
|
|
/*
|
||
|
|
* The I2C address consists of a 7-digit binary value.
|
||
|
|
* The factory setting for I2C slave address is 0x28, 0x36 or
|
||
|
|
* 0x46 depending on the interface type selected from the ordering information.
|
||
|
|
* The address is always followed by a write bit (0) or read bit (1).
|
||
|
|
* The default hexadecimal I2C header for read access to the sensor is therefore 0x51,
|
||
|
|
* 0x6D, 0x8D respectively, based on the ordering information.
|
||
|
|
*/
|
||
|
|
#ifndef HAL_BARO_MS4525_I2C_ADDR
|
||
|
|
#define HAL_BARO_MS4525_I2C_ADDR 0x28
|
||
|
|
#endif
|
||
|
|
|
||
|
|
typedef enum {
|
||
|
|
Baro_MS4525_typeA,
|
||
|
|
Baro_MS4525_typeB
|
||
|
|
} Baro_MS4525_type;
|
||
|
|
|
||
|
|
typedef struct Baro_MS4525{
|
||
|
|
const char *name;
|
||
|
|
I2C_DEV_t *_dev;
|
||
|
|
int32_t Prange;
|
||
|
|
int32_t Pmin;
|
||
|
|
Baro_MS4525_type typeAB;
|
||
|
|
int32_t pressure; /* Pa */
|
||
|
|
int16_t temp; /*degC -50~150 */
|
||
|
|
uint8_t status;
|
||
|
|
} Baro_MS4525_t;
|
||
|
|
|
||
|
|
bool Baro_MS4525_init(Baro_MS4525_t *baro, const char *name, I2C_DEV_t *dev, int Pmax, int Pmin, Baro_MS4525_type typeAB);
|
||
|
|
|
||
|
|
bool Baro_MS4525_update(Baro_MS4525_t *baro);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#endif /* MATT_BARO_MS4525DO_H_ */
|