mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 17:31:13 +03:00
bmpx8x: rename gy65 to bmpx8x to more properly reflect supported chips
Signed-off-by: Jon Trulson <jtrulson@ics.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
f0dd5f9530
commit
23e47fa3b9
@ -1,5 +1,5 @@
|
||||
set (libname "gy65")
|
||||
set (libdescription "upm GY65")
|
||||
set (libname "bmpx8x")
|
||||
set (libdescription "upm BMPX8X")
|
||||
set (module_src ${libname}.cxx)
|
||||
set (module_h ${libname}.h)
|
||||
upm_module_init()
|
@ -26,12 +26,12 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gy65.h"
|
||||
#include "bmpx8x.h"
|
||||
|
||||
using namespace upm;
|
||||
|
||||
GY65::GY65 (int bus, int devAddr, uint8_t mode) {
|
||||
m_name = "GY65";
|
||||
BMPX8X::BMPX8X (int bus, int devAddr, uint8_t mode) {
|
||||
m_name = "BMPX8X";
|
||||
|
||||
m_controlAddr = devAddr;
|
||||
m_bus = bus;
|
||||
@ -69,12 +69,12 @@ GY65::GY65 (int bus, int devAddr, uint8_t mode) {
|
||||
md = i2cReadReg_16 (BMP085_CAL_MD);
|
||||
}
|
||||
|
||||
GY65::~GY65() {
|
||||
BMPX8X::~BMPX8X() {
|
||||
mraa_i2c_stop(m_i2ControlCtx);
|
||||
}
|
||||
|
||||
int32_t
|
||||
GY65::getPressure () {
|
||||
BMPX8X::getPressure () {
|
||||
int32_t UT, UP, B3, B5, B6, X1, X2, X3, p;
|
||||
uint32_t B4, B7;
|
||||
|
||||
@ -110,7 +110,7 @@ GY65::getPressure () {
|
||||
}
|
||||
|
||||
int32_t
|
||||
GY65::getPressureRaw () {
|
||||
BMPX8X::getPressureRaw () {
|
||||
uint32_t raw;
|
||||
|
||||
i2cWriteReg (BMP085_CONTROL, BMP085_READPRESSURECMD + (oversampling << 6));
|
||||
@ -135,14 +135,14 @@ GY65::getPressureRaw () {
|
||||
}
|
||||
|
||||
int16_t
|
||||
GY65::getTemperatureRaw () {
|
||||
BMPX8X::getTemperatureRaw () {
|
||||
i2cWriteReg (BMP085_CONTROL, BMP085_READTEMPCMD);
|
||||
usleep(5000);
|
||||
return i2cReadReg_16 (BMP085_TEMPDATA);
|
||||
}
|
||||
|
||||
float
|
||||
GY65::getTemperature () {
|
||||
BMPX8X::getTemperature () {
|
||||
int32_t UT, B5; // following ds convention
|
||||
float temp;
|
||||
|
||||
@ -156,13 +156,13 @@ GY65::getTemperature () {
|
||||
}
|
||||
|
||||
int32_t
|
||||
GY65::getSealevelPressure(float altitudeMeters) {
|
||||
BMPX8X::getSealevelPressure(float altitudeMeters) {
|
||||
float pressure = getPressure ();
|
||||
return (int32_t)(pressure / pow(1.0-altitudeMeters/44330, 5.255));
|
||||
}
|
||||
|
||||
float
|
||||
GY65::getAltitude (float sealevelPressure) {
|
||||
BMPX8X::getAltitude (float sealevelPressure) {
|
||||
float altitude;
|
||||
|
||||
float pressure = getPressure ();
|
||||
@ -173,7 +173,7 @@ GY65::getAltitude (float sealevelPressure) {
|
||||
}
|
||||
|
||||
int32_t
|
||||
GY65::computeB5(int32_t UT) {
|
||||
BMPX8X::computeB5(int32_t UT) {
|
||||
int32_t X1 = (UT - (int32_t)ac6) * ((int32_t)ac5) >> 15;
|
||||
int32_t X2 = ((int32_t)mc << 11) / (X1+(int32_t)md);
|
||||
|
||||
@ -181,7 +181,7 @@ GY65::computeB5(int32_t UT) {
|
||||
}
|
||||
|
||||
mraa_result_t
|
||||
GY65::i2cWriteReg (uint8_t reg, uint8_t value) {
|
||||
BMPX8X::i2cWriteReg (uint8_t reg, uint8_t value) {
|
||||
mraa_result_t error = MRAA_SUCCESS;
|
||||
|
||||
uint8_t data[2] = { reg, value };
|
||||
@ -192,7 +192,7 @@ GY65::i2cWriteReg (uint8_t reg, uint8_t value) {
|
||||
}
|
||||
|
||||
uint16_t
|
||||
GY65::i2cReadReg_16 (int reg) {
|
||||
BMPX8X::i2cReadReg_16 (int reg) {
|
||||
uint16_t data;
|
||||
|
||||
mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
|
||||
@ -209,7 +209,7 @@ GY65::i2cReadReg_16 (int reg) {
|
||||
}
|
||||
|
||||
uint8_t
|
||||
GY65::i2cReadReg_8 (int reg) {
|
||||
BMPX8X::i2cReadReg_8 (int reg) {
|
||||
uint8_t data;
|
||||
|
||||
mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
||||
* Contributions: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Credits to Adafruit.
|
||||
@ -61,37 +62,34 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief GY65 & BPM085 atmospheric pressure sensor library
|
||||
* @defgroup gy65 libupm-gy65
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief C++ API for GY65/BMP085 chip (Atmospheric Pressure Sensor)
|
||||
* @brief C++ API for GY65/BMP085 and BMP180 chips (Atmospheric Pressure Sensor)
|
||||
*
|
||||
* The Bosch [BMP085]
|
||||
* (https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf)
|
||||
* is a high precision, ultra-low power consumption pressure sensor. It has a
|
||||
* range of between 30,000 and 110,000 Pa.
|
||||
* The Bosch GY65/BMP085 and BMP180 are high precision, ultra-low
|
||||
* power consumption pressure sensors. They have a range of between
|
||||
* 30,000 and 110,000 Pa.
|
||||
*
|
||||
* @ingroup gy65 i2c
|
||||
* @snippet gy65.cxx Interesting
|
||||
* This module has been tested on the GY65/BMP085 and BMP180 sensors.
|
||||
*
|
||||
* @ingroup bmpx8x i2c
|
||||
* @defgroup bmpx8x libupm-bmpx8x
|
||||
* @snippet bmpx8x.cxx Interesting
|
||||
* @image html bmp085.jpeg
|
||||
*/
|
||||
class GY65 {
|
||||
class BMPX8X {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a GY65 object
|
||||
* Instanciates a BMPX8X object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr address of used i2c device
|
||||
* @param mode BMP085 mode
|
||||
*/
|
||||
GY65 (int bus, int devAddr=0x77, uint8_t mode=BMP085_ULTRAHIGHRES);
|
||||
BMPX8X (int bus, int devAddr=0x77, uint8_t mode=BMP085_ULTRAHIGHRES);
|
||||
|
||||
/**
|
||||
* GY65 object destructor, basicaly it close i2c connection.
|
||||
* BMPX8X object destructor, basicaly it close i2c connection.
|
||||
*/
|
||||
~GY65 ();
|
||||
~BMPX8X ();
|
||||
|
||||
/**
|
||||
* Return calculated pressure
|
8
src/bmpx8x/jsupm_bmpx8x.i
Normal file
8
src/bmpx8x/jsupm_bmpx8x.i
Normal file
@ -0,0 +1,8 @@
|
||||
%module jsupm_bmpx8x
|
||||
%include "../upm.i"
|
||||
|
||||
%{
|
||||
#include "bmpx8x.h"
|
||||
%}
|
||||
|
||||
%include "bmpx8x.h"
|
10
src/bmpx8x/pyupm_bmpx8x.i
Normal file
10
src/bmpx8x/pyupm_bmpx8x.i
Normal file
@ -0,0 +1,10 @@
|
||||
%module pyupm_bmpx8x
|
||||
%include "../upm.i"
|
||||
|
||||
%include "stdint.i"
|
||||
|
||||
%include "bmpx8x.h"
|
||||
%{
|
||||
#include "bmpx8x.h"
|
||||
%}
|
||||
|
@ -1,8 +0,0 @@
|
||||
%module jsupm_gy65
|
||||
%include "../upm.i"
|
||||
|
||||
%{
|
||||
#include "gy65.h"
|
||||
%}
|
||||
|
||||
%include "gy65.h"
|
@ -1,10 +0,0 @@
|
||||
%module pyupm_gy65
|
||||
%include "../upm.i"
|
||||
|
||||
%include "stdint.i"
|
||||
|
||||
%include "gy65.h"
|
||||
%{
|
||||
#include "gy65.h"
|
||||
%}
|
||||
|
Reference in New Issue
Block a user