Rewrite API change

This commit is contained in:
Theodor Teslia
2023-05-11 13:57:05 +02:00
parent c5eb409d79
commit c7299a8372
2 changed files with 57 additions and 23 deletions

View File

@@ -28,9 +28,10 @@ namespace sta {
// Function to get Pressure
// Parameter should be Temperature in Celsius * 100 (e.g. 20.3 deg. C -> 2030)
// If currently still processing, use old value
// If currently not processing, start processing to minmize potential wating times
// If currently not processing, start processing to minimize potential waiting times
int32_t getPressure(int32_t temp, uint32_t curTime);
// --- DEPRECATED ---
// Parameterless version of function above
// Calls getTemperature, to get temp
// NOT RECOMMENDED
@@ -40,6 +41,7 @@ namespace sta {
// Deprecated because of time constrains
// NOT RECOMMENDED
int32_t getTemperature();
// --- DEPRECATED ---
void changeOsrLevel(OsrLevel newOsr) {
// Don't I need to write this to the sensor?
@@ -54,11 +56,13 @@ namespace sta {
this->device_->beginTransmission();
}
// Last Presure Value meassured; Used to give any output if still calculating ADC
// Last Pressure Value measured; Used to give any output if still calculating ADC
int32_t lastPresVal;
// Value to store, when adc was started
// On STM32 with HAL_GetTick() (Gives ms since startup)
uint32_t adcStartTime;
// To prevent calculation of adc without reading value
bool presRead;
// STA internal object for SPi abstraction
SpiDevice* device_;
@@ -87,11 +91,13 @@ namespace sta {
int32_t calculatePressure(uint32_t d1, int32_t dT);
int32_t calculateTemperature(uint32_t d2);
int32_t reverseTempCalc(int32_t temp);
void reset();
void readPROM();
// Constants for waiting
const char RESET_DELAY = 2800; // in uS
const uint32_t RESET_DELAY = 2800; // in uS
// Function to get the delay times needed for different OSR Levels
// Values not found in datasheet (facepalm)
@@ -99,7 +105,15 @@ namespace sta {
static uint8_t delayTimes(OsrLevel level) {
switch (level) {
case _256:
return
return 1;
case _512:
return 2;
case _1024:
return 3;
case _2048:
return 5;
case _4096:
return 10;
}
}
};