2024-03-04 01:01:14 +08:00
|
|
|
/*
|
|
|
|
|
* bmp280.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: Mar 4, 2024
|
|
|
|
|
* Author: gxms0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef BSP_BMP280_H_
|
|
|
|
|
#define BSP_BMP280_H_
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-18 11:50:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ch32v20x.h"
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include "drv_i2c.h"
|
|
|
|
|
|
|
|
|
|
typedef struct sBMP {
|
|
|
|
|
|
|
|
|
|
I2C_ptr i2c;
|
|
|
|
|
uint16_t address;
|
|
|
|
|
|
|
|
|
|
uint16_t (*read)(I2C_ptr ptr, uint16_t address, uint16_t reg,uint8_t *data, uint16_t len);
|
|
|
|
|
uint16_t (*write)(I2C_ptr ptr, uint16_t address, uint16_t reg,uint8_t *data, uint16_t len);
|
|
|
|
|
|
|
|
|
|
}BMP_t;
|
|
|
|
|
|
|
|
|
|
typedef BMP_t* BMP_ptr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void bmpxxx_init(BMP_ptr ptr,I2C_ptr i2c,uint16_t address);
|
|
|
|
|
|
|
|
|
|
uint16_t bmpxxx_read(BMP_ptr ptr, uint8_t reg,uint8_t *data, uint16_t len);
|
|
|
|
|
|
|
|
|
|
uint16_t bmpxxx_write(BMP_ptr ptr, uint8_t reg,uint8_t *data, uint16_t len);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 01:01:14 +08:00
|
|
|
#endif /* BSP_BMP280_H_ */
|