Skip to content

Commit

Permalink
[BMP183] modification for LinkIt 7697
Browse files Browse the repository at this point in the history
  • Loading branch information
shihhsuan committed Mar 22, 2017
1 parent 8e0b599 commit 8d1d8e1
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions Adafruit_BMP183_Library-master/Adafruit_BMP183.cpp
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/***************************************************
/***************************************************
This is a library for the Adafruit BMP183 Barometric Pressure + Temp sensor
Designed specifically to work with the Adafruit BMP183 Breakout
Designed specifically to work with the Adafruit BMP183 Breakout
----> http://www.adafruit.com/products/1900
These sensors use SPI to communicate, 4 pins are required to
These sensors use SPI to communicate, 4 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

Expand All @@ -22,16 +22,16 @@
#define _delay_ms(t) delay(t)
#endif
#include <SPI.h>

#define _delay_ms(t) delay(t)

Adafruit_BMP183::Adafruit_BMP183(int8_t SPICS ) {
_cs = SPICS;
_clk = _miso = _mosi = -1;
_clk = _miso = _mosi = -1;
}

Adafruit_BMP183::Adafruit_BMP183(int8_t SPICLK,
int8_t SPIMISO,
int8_t SPIMOSI,
Adafruit_BMP183::Adafruit_BMP183(int8_t SPICLK,
int8_t SPIMISO,
int8_t SPIMOSI,
int8_t SPICS) {
_cs = SPICS;
_clk = SPICLK;
Expand All @@ -43,7 +43,8 @@ Adafruit_BMP183::Adafruit_BMP183(int8_t SPICLK,
boolean Adafruit_BMP183::begin(bmp183_mode_t mode) {
if (_clk == -1) {
SPI.begin();
SPI.setDataMode(SPI_MODE0);
//SPI.setDataMode(SPI_MODE0);
SPI.beginTransaction(SPISettings(7000000, MSBFIRST, SPI_MODE0));
#ifdef __AVR__
SPI.setClockDivider(SPI_CLOCK_DIV16);
#endif
Expand Down Expand Up @@ -118,13 +119,13 @@ uint32_t Adafruit_BMP183::readRawPressure(void) {

write8(BMP183_REGISTER_CONTROL, BMP183_REGISTER_READPRESSURECMD + (oversampling << 6));

if (oversampling == BMP183_MODE_ULTRALOWPOWER)
if (oversampling == BMP183_MODE_ULTRALOWPOWER)
_delay_ms(5);
else if (oversampling == BMP183_MODE_STANDARD)
else if (oversampling == BMP183_MODE_STANDARD)
_delay_ms(8);
else if (oversampling == BMP183_MODE_HIGHRES)
else if (oversampling == BMP183_MODE_HIGHRES)
_delay_ms(14);
else
else
_delay_ms(26);

raw = read16(BMP183_REGISTER_PRESSUREDATA);
Expand Down Expand Up @@ -254,7 +255,7 @@ float Adafruit_BMP183::getTemperature(void) {
B5 = X1 + X2;
temp = (B5+8)/pow(2,4);
temp /= 10;

return temp;
}

Expand Down Expand Up @@ -283,7 +284,7 @@ uint8_t Adafruit_BMP183::SPIxfer(uint8_t x) {
digitalWrite(_clk, LOW);
digitalWrite(_mosi, x & (1<<i));
digitalWrite(_clk, HIGH);
if (digitalRead(_miso))
if (digitalRead(_miso))
reply |= 1;
}
return reply;
Expand Down
Empty file modified Adafruit_BMP183_Library-master/Adafruit_BMP183.h
100755 → 100644
Empty file.
Empty file modified Adafruit_BMP183_Library-master/README.txt
100755 → 100644
Empty file.
Empty file.
Empty file modified Adafruit_BMP183_Library-master/keywords.txt
100755 → 100644
Empty file.
Empty file modified Adafruit_BMP183_Library-master/library.properties
100755 → 100644
Empty file.
Empty file modified Adafruit_Sensor-master/Adafruit_Sensor.h
100755 → 100644
Empty file.
Empty file modified Adafruit_Sensor-master/README.md
100755 → 100644
Empty file.
Empty file modified Adafruit_Sensor-master/library.properties
100755 → 100644
Empty file.

0 comments on commit 8d1d8e1

Please sign in to comment.