Skip to content

Commit f839f92

Browse files
authored
Merge pull request #17 from AndreasExner/master
Add Soft Reset and Get Automatic Self-Calibration Status
2 parents 2b5c789 + 771211a commit f839f92

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/SparkFun_SCD30_Arduino_Library.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,25 @@ bool SCD30::setAmbientPressure(uint16_t pressure_mbar)
153153
return sendCommand(COMMAND_CONTINUOUS_MEASUREMENT, pressure_mbar);
154154
}
155155

156+
// SCD30 soft reset
157+
void SCD30::reset()
158+
{
159+
sendCommand(COMMAND_RESET);
160+
161+
}
162+
163+
// Get the current ASC setting
164+
bool SCD30::getAutoSelfCalibration()
165+
{
166+
uint16_t response = readRegister(COMMAND_AUTOMATIC_SELF_CALIBRATION);
167+
if (response == 1) {
168+
return true;
169+
}
170+
else {
171+
return false;
172+
}
173+
}
174+
156175
//Begins continuous measurements
157176
//Continuous measurement status is saved in non-volatile memory. When the sensor
158177
//is powered down while continuous measurement mode is active SCD30 will measure

src/SparkFun_SCD30_Arduino_Library.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#define COMMAND_SET_FORCED_RECALIBRATION_FACTOR 0x5204
4545
#define COMMAND_SET_TEMPERATURE_OFFSET 0x5403
4646
#define COMMAND_SET_ALTITUDE_COMPENSATION 0x5102
47+
#define COMMAND_RESET 0xD304
4748

4849
class SCD30
4950
{
@@ -67,9 +68,12 @@ class SCD30
6768
bool setAutoSelfCalibration(bool enable);
6869
bool setForcedRecalibrationFactor(uint16_t concentration);
6970
bool setTemperatureOffset(float tempOffset);
71+
bool getAutoSelfCalibration(void);
7072

7173
bool dataAvailable();
7274
bool readMeasurement();
75+
76+
void reset();
7377

7478
bool sendCommand(uint16_t command, uint16_t arguments);
7579
bool sendCommand(uint16_t command);

0 commit comments

Comments
 (0)