first commit

This commit is contained in:
Jérôme Delacotte
2025-03-06 11:15:32 +01:00
commit 7b30d6e298
5276 changed files with 2108927 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
/*!
* @file Adafruit_BMP183.h
*/
#ifndef ADAFRUIT_BMP183_H
#define ADAFRUIT_BMP183_H
#include "Arduino.h"
#include "SPI.h"
// use the 'default' datasheet numbers to test calculations
#define BMP183_DEBUG 0 //!< Enables or disables debug mode
/** Registers **/
enum {
BMP183_REGISTER_CAL_AC1 = 0xAA, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_AC2 = 0xAC, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_AC3 = 0xAE, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_AC4 = 0xB0, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_AC5 = 0xB2, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_AC6 = 0xB4, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_B1 = 0xB6, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_B2 = 0xB8, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_MB = 0xBA, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_MC = 0xBC, // R Calibration data (16 bits)
BMP183_REGISTER_CAL_MD = 0xBE, // R Calibration data (16 bits)
BMP183_REGISTER_CHIPID = 0xD0,
BMP183_REGISTER_VERSION = 0xD1,
BMP183_REGISTER_SOFTRESET = 0xE0,
BMP183_REGISTER_CONTROL = 0xF4,
BMP183_REGISTER_TEMPDATA = 0xF6,
BMP183_REGISTER_PRESSUREDATA = 0xF6,
BMP183_REGISTER_READTEMPCMD = 0x2E,
BMP183_REGISTER_READPRESSURECMD = 0x34
};
/** Mode Settings **/
typedef enum {
BMP183_MODE_ULTRALOWPOWER = 0,
BMP183_MODE_STANDARD = 1,
BMP183_MODE_HIGHRES = 2,
BMP183_MODE_ULTRAHIGHRES = 3
} bmp183_mode_t;
/*!
* @brief Class that stores state and functions for interacting with
* BMP183
*/
class Adafruit_BMP183 {
public:
Adafruit_BMP183(int8_t SPICS, SPIClass *theSPI = &SPI);
Adafruit_BMP183(int8_t SPICLK, int8_t SPIMISO, int8_t SPIMOSI, int8_t SPICS);
boolean
begin(bmp183_mode_t mode = BMP183_MODE_ULTRAHIGHRES); // by default go highres
float getTemperature();
int32_t getPressure();
float getAltitude(float sealevelPressure = 101325); // std atmosphere
uint16_t readRawTemperature();
uint32_t readRawPressure();
SPIClass *_spi; //!< pointer to SPI object
private:
uint8_t SPIxfer(uint8_t x);
uint8_t read8(uint8_t addr);
uint16_t read16(uint8_t addr);
void write8(uint8_t addr, uint8_t data);
int8_t _cs, _clk, _miso, _mosi;
uint8_t oversampling;
int16_t ac1, ac2, ac3, b1, b2, mb, mc, md;
uint16_t ac4, ac5, ac6;
};
#endif // ADAFRUIT_BMP183_H