Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Soft Reset and Get Automatic Self-Calibration Status #17

Merged
merged 3 commits into from
Dec 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/SparkFun_SCD30_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,25 @@ bool SCD30::setAmbientPressure(uint16_t pressure_mbar)
return sendCommand(COMMAND_CONTINUOUS_MEASUREMENT, pressure_mbar);
}

// SCD30 soft reset
void SCD30::reset()
{
sendCommand(COMMAND_RESET);

}

// Get the current ASC setting
bool SCD30::getAutoSelfCalibration()
{
uint16_t response = readRegister(COMMAND_AUTOMATIC_SELF_CALIBRATION);
if (response == 1) {
return true;
}
else {
return false;
}
}

//Begins continuous measurements
//Continuous measurement status is saved in non-volatile memory. When the sensor
//is powered down while continuous measurement mode is active SCD30 will measure
Expand Down
4 changes: 4 additions & 0 deletions src/SparkFun_SCD30_Arduino_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#define COMMAND_SET_FORCED_RECALIBRATION_FACTOR 0x5204
#define COMMAND_SET_TEMPERATURE_OFFSET 0x5403
#define COMMAND_SET_ALTITUDE_COMPENSATION 0x5102
#define COMMAND_RESET 0xD304

class SCD30
{
Expand All @@ -67,9 +68,12 @@ class SCD30
bool setAutoSelfCalibration(bool enable);
bool setForcedRecalibrationFactor(uint16_t concentration);
bool setTemperatureOffset(float tempOffset);
bool getAutoSelfCalibration(void);

bool dataAvailable();
bool readMeasurement();

void reset();

bool sendCommand(uint16_t command, uint16_t arguments);
bool sendCommand(uint16_t command);
Expand Down