0.3.0 MS5611_SPI

This commit is contained in:
Rob Tillaart 2024-01-19 15:36:10 +01:00
parent e8d0808fad
commit e9dc61408e
14 changed files with 64 additions and 33 deletions

View File

@ -1,4 +1,4 @@
# Change Log MS5611
# Change Log MS5611_SPI
All notable changes to this project will be documented in this file.
@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.0] - 2024-01-19
- fix #11, improve SPI dependency
- solves #6 in a better way.
## [0.2.0] - 2023-11-30
- refactor constructor interface - breaking changes.
- minimize conditional code. -- create SPI_CLASS macro to solve it.

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2014-2023 Rob Tillaart
Copyright (c) 2014-2024 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
//
// FILE: MS5611_SPI.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.2.0
// VERSION: 0.3.0
// PURPOSE: MS5611 (SPI) Temperature & Pressure library for Arduino
// URL: https://github.com/RobTillaart/MS5611_SPI
//
@ -81,10 +81,10 @@ bool MS5611_SPI::begin()
if(_hwSPI)
{
_mySPI->begin(); // FIX #6
_mySPI->end();
_mySPI->begin();
delay(1);
// _mySPI->begin(); // FIX #6
// _mySPI->end();
// _mySPI->begin();
// delay(1);
}
else
{

View File

@ -2,7 +2,7 @@
//
// FILE: MS5611_SPI.h
// AUTHOR: Rob Tillaart
// VERSION: 0.2.0
// VERSION: 0.3.0
// PURPOSE: S5611 (SPI) Temperature & Pressure library for Arduino
// URL: https://github.com/RobTillaart/MS5611_SPI
@ -30,7 +30,7 @@
// CS to GND ==> 0x77
#define MS5611_SPI_LIB_VERSION (F("0.2.0 EXPERIMENTAL"))
#define MS5611_SPI_LIB_VERSION (F("0.3.0 EXPERIMENTAL"))
#ifndef __SPI_CLASS__
#if defined(ARDUINO_ARCH_RP2040)

View File

@ -26,6 +26,13 @@ It is based upon the 0.3.6 version of the I2C library,
see - https://github.com/RobTillaart/MS5611
#### 0.3.0 Breaking change
Version 0.3.0 introduced a breaking change to improve handling the SPI dependency.
The user has to call **SPI.begin()** or equivalent before calling **AD.begin()**.
Optionally the user can provide parameters to the **SPI.begin(...)**
#### 0.2.0 Breaking change
The version 0.2.0 has breaking changes in the interface.

View File

@ -7,6 +7,7 @@
#include "MS5611_SPI.h"
// BREAKOUT MS5611 aka GY63 - see datasheet
//
// SPI I2C
@ -33,12 +34,12 @@
// CLOCK 13 18 14
// MS5611_SPI(select, dataOut, dataIn, clock);
// --------------------------------------------
// MS5611_SPI MS5611(10, 11, 12, 13); // UNO SW SPI (5V problem?
// MS5611_SPI MS5611(10); // UNO HW SPI
// MS5611_SPI(select, dataOut, dataIn, clock);
// --------------------------------------------
// MS5611_SPI MS5611(10, 11, 12, 13); // UNO SW SPI (5V problem?
// MS5611_SPI MS5611(10); // UNO HW SPI
MS5611_SPI MS5611( 5, 23, 19, 18); // ESP32 SW SPI
// MS5611_SPI MS5611(5); // ESP32 HW SPI
// MS5611_SPI MS5611(5); // ESP32 HW SPI
uint32_t start, stop;
@ -53,7 +54,8 @@ void setup()
Serial.print("MS5611_SPI_LIB_VERSION: ");
Serial.println(MS5611_SPI_LIB_VERSION);
// pinMode(LED_BUILTIN, OUTPUT);
// pinMode(LED_BUILTIN, OUTPUT);
SPI.begin();
if (MS5611.begin() == true)
{
@ -65,9 +67,9 @@ void setup()
Serial.println("MS5611 not found. halt.");
while (1)
{
// digitalWrite(LED_BUILTIN, HIGH);
// digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
// digitalWrite(LED_BUILTIN, LOW);
// digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
}
@ -80,4 +82,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -7,6 +7,7 @@
#include "MS5611_SPI.h"
// BREAKOUT MS5611 aka GY63 - see datasheet
//
// SPI I2C
@ -56,6 +57,8 @@ void setup()
Serial.print("MS5611_SPI_LIB_VERSION: ");
Serial.println(MS5611_SPI_LIB_VERSION);
SPI.begin();
if (MS5611.begin() == true)
{
Serial.print("MS5611 found: ");
@ -72,9 +75,9 @@ void setup()
void loop()
{
// MS5611.reset();
// MS5611.reset();
uint32_t start = micros();
MS5611.read(); // note no error checking => "optimistic".
MS5611.read(); // note no error checking => "optimistic".
uint32_t stop = micros();
Serial.print("T:\t");
Serial.print(MS5611.getTemperature(), 2);

View File

@ -7,6 +7,7 @@
#include "MS5611_SPI.h"
// BREAKOUT MS5611 aka GY63 - see datasheet
//
// SPI I2C
@ -60,6 +61,8 @@ void setup()
Serial.print("MS5611_SPI_LIB_VERSION: ");
Serial.println(MS5611_SPI_LIB_VERSION);
SPI.begin();
if (MS5611.begin() == true)
{
Serial.println("MS5611 found.");
@ -80,7 +83,7 @@ void loop()
delay(1000);
start = micros();
int result = MS5611.read(); // uses default OSR_ULTRA_LOW (fastest)
int result = MS5611.read(); // uses default OSR_ULTRA_LOW (fastest)
stop = micros();
if (count % 20 == 0)
@ -103,5 +106,5 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -7,6 +7,7 @@
#include "MS5611_SPI.h"
// BREAKOUT MS5611 aka GY63 - see datasheet
//
// SPI I2C
@ -60,6 +61,8 @@ void setup()
Serial.print("MS5611_SPI_LIB_VERSION: ");
Serial.println(MS5611_SPI_LIB_VERSION);
SPI.begin();
if (MS5611.begin() == true)
{
Serial.println("MS5611 found.");
@ -75,12 +78,12 @@ void setup()
start = micros();
MS5611.read(); // uses default OSR_ULTRA_LOW (fastest)
MS5611.read(); // uses default OSR_ULTRA_LOW (fastest)
stop = micros();
Serial.print( (uint8_t) MS5611.getOversampling());
Serial.print("\t");
Serial.println(stop - start);
delay(10); // to flush serial.
delay(10); // to flush serial.
MS5611.setOversampling(OSR_LOW);
@ -90,7 +93,7 @@ void setup()
Serial.print( (uint8_t) MS5611.getOversampling());
Serial.print("\t");
Serial.println(stop - start);
delay(10); // to flush serial.
delay(10); // to flush serial.
MS5611.setOversampling(OSR_STANDARD);
@ -100,7 +103,7 @@ void setup()
Serial.print( (uint8_t) MS5611.getOversampling());
Serial.print("\t");
Serial.println(stop - start);
delay(10); // to flush serial.
delay(10); // to flush serial.
MS5611.setOversampling(OSR_HIGH);
@ -110,7 +113,7 @@ void setup()
Serial.print( (uint8_t) MS5611.getOversampling());
Serial.print("\t");
Serial.println(stop - start);
delay(10); // to flush serial.
delay(10); // to flush serial.
MS5611.setOversampling(OSR_ULTRA_HIGH);
@ -120,7 +123,7 @@ void setup()
Serial.print( (uint8_t) MS5611.getOversampling());
Serial.print("\t");
Serial.println(stop - start);
delay(10); // to flush serial.
delay(10); // to flush serial.
Serial.println("\ndone...");

View File

@ -7,6 +7,7 @@
#include "MS5611_SPI.h"
// BREAKOUT MS5611 aka GY63 - see datasheet
//
// SPI I2C
@ -62,6 +63,8 @@ void setup()
pinMode(LED_BUILTIN, OUTPUT);
SPI.begin();
if (MS5611.begin() == true)
{
Serial.println("MS5611 found.");

View File

@ -7,6 +7,7 @@
#include "MS5611_SPI.h"
// BREAKOUT MS5611 aka GY63 - see datasheet
//
// SPI I2C
@ -61,6 +62,7 @@ void setup()
Serial.println(MS5611_SPI_LIB_VERSION);
pinMode(LED_BUILTIN, OUTPUT);
SPI.begin();
if (MS5611.begin() == true)
{
@ -79,8 +81,8 @@ void setup()
}
Serial.println();
MS5611.setTemperatureOffset(273.15); // set temp in Kelvin
MS5611.setPressureOffset(-1013); // set pressure relative to 1 ATM
MS5611.setTemperatureOffset(273.15); // set temp in Kelvin
MS5611.setPressureOffset(-1013); // set pressure relative to 1 ATM
}

View File

@ -7,6 +7,7 @@
#include "MS5611_SPI.h"
// BREAKOUT MS5611 aka GY63 - see datasheet
//
// SPI I2C
@ -58,6 +59,7 @@ void setup()
Serial.println(MS5611_SPI_LIB_VERSION);
pinMode(LED_BUILTIN, OUTPUT);
SPI.begin();
Serial.println();
if (MS5611.begin() == true)
@ -76,7 +78,7 @@ void setup()
}
}
Serial.println("TEMP\tPRESSURE");
// scale T & P to same range :)
// scale T & P to same range :)
MS5611.setPressureOffset(-1000);
}

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/MS5611_SPI.git"
},
"version": "0.2.0",
"version": "0.3.0",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=MS5611_SPI
version=0.2.0
version=0.3.0
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library (SPI) for MS5611 temperature and pressure sensor