Skip to content

Commit 779b193

Browse files
Changed status_t to CCS811Core::status
1 parent ed6a181 commit 779b193

File tree

10 files changed

+153
-138
lines changed

10 files changed

+153
-138
lines changed

examples/BME280Compensated/BME280Compensated.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void setup()
4949
Serial.println("Apply BME280 data to CCS811 for compensation.");
5050

5151
//This begins the CCS811 sensor and prints error status of .begin()
52-
status_t returnCode = myCCS811.begin();
52+
CCS811Core::status returnCode = myCCS811.begin();
5353
Serial.print("CCS811 begin exited with: ");
5454
//Pass the error code to a function to print the results
5555
printDriverError( returnCode );
@@ -156,28 +156,28 @@ void printInfoSerial()
156156

157157
}
158158

159-
//printDriverError decodes the status_t type and prints the
159+
//printDriverError decodes the CCS811Core::status type and prints the
160160
//type of error to the serial terminal.
161161
//
162-
//Save the return value of any function of type status_t, then pass
162+
//Save the return value of any function of type CCS811Core::status, then pass
163163
//to this function to see what the output was.
164-
void printDriverError( status_t errorCode )
164+
void printDriverError( CCS811Core::status errorCode )
165165
{
166166
switch ( errorCode )
167167
{
168-
case SENSOR_SUCCESS:
168+
case CCS811Core::SENSOR_SUCCESS:
169169
Serial.print("SUCCESS");
170170
break;
171-
case SENSOR_ID_ERROR:
171+
case CCS811Core::SENSOR_ID_ERROR:
172172
Serial.print("ID_ERROR");
173173
break;
174-
case SENSOR_I2C_ERROR:
174+
case CCS811Core::SENSOR_I2C_ERROR:
175175
Serial.print("I2C_ERROR");
176176
break;
177-
case SENSOR_INTERNAL_ERROR:
177+
case CCS811Core::SENSOR_INTERNAL_ERROR:
178178
Serial.print("INTERNAL_ERROR");
179179
break;
180-
case SENSOR_GENERIC_ERROR:
180+
case CCS811Core::SENSOR_GENERIC_ERROR:
181181
Serial.print("GENERIC_ERROR");
182182
break;
183183
default:

examples/BaselineOperator/BaselineOperator.ino

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void setup()
6363
Serial.println();
6464
Serial.println("CCS811 Baseline Example");
6565

66-
status_t returnCode = mySensor.begin();
66+
CCS811Core::status returnCode = mySensor.begin();
6767
Serial.print("begin exited with: ");
6868
printDriverError( returnCode );
6969
Serial.println();
@@ -92,7 +92,7 @@ void loop()
9292
char c;
9393
unsigned int result;
9494
unsigned int baselineToApply;
95-
status_t errorStatus;
95+
CCS811Core::status errorStatus;
9696
if (Serial.available())
9797
{
9898
c = Serial.read();
@@ -123,7 +123,7 @@ void loop()
123123
Serial.println(baselineToApply, HEX);
124124
//This programs the baseline into the sensor and monitors error states
125125
errorStatus = mySensor.setBaseline( baselineToApply );
126-
if ( errorStatus == SENSOR_SUCCESS )
126+
if ( errorStatus == CCS811Core::SENSOR_SUCCESS )
127127
{
128128
Serial.println("Baseline written to CCS811.");
129129
}
@@ -170,28 +170,28 @@ void loop()
170170
delay(10);
171171
}
172172

173-
//printDriverError decodes the status_t type and prints the
173+
//printDriverError decodes the CCS811Core::status type and prints the
174174
//type of error to the serial terminal.
175175
//
176-
//Save the return value of any function of type status_t, then pass
176+
//Save the return value of any function of type CCS811Core::status, then pass
177177
//to this function to see what the output was.
178-
void printDriverError( status_t errorCode )
178+
void printDriverError( CCS811Core::status errorCode )
179179
{
180180
switch ( errorCode )
181181
{
182-
case SENSOR_SUCCESS:
182+
case CCS811Core::SENSOR_SUCCESS:
183183
Serial.print("SUCCESS");
184184
break;
185-
case SENSOR_ID_ERROR:
185+
case CCS811Core::SENSOR_ID_ERROR:
186186
Serial.print("ID_ERROR");
187187
break;
188-
case SENSOR_I2C_ERROR:
188+
case CCS811Core::SENSOR_I2C_ERROR:
189189
Serial.print("I2C_ERROR");
190190
break;
191-
case SENSOR_INTERNAL_ERROR:
191+
case CCS811Core::SENSOR_INTERNAL_ERROR:
192192
Serial.print("INTERNAL_ERROR");
193193
break;
194-
case SENSOR_GENERIC_ERROR:
194+
case CCS811Core::SENSOR_GENERIC_ERROR:
195195
Serial.print("GENERIC_ERROR");
196196
break;
197197
default:

examples/BasicReadings/BasicReadings.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ void setup()
5050

5151
//It is recommended to check return status on .begin(), but it is not
5252
//required.
53-
status_t returnCode = mySensor.begin();
54-
if (returnCode != SENSOR_SUCCESS)
53+
CCS811Core::status returnCode = mySensor.begin();
54+
if (returnCode != CCS811Core::SENSOR_SUCCESS)
5555
{
5656
Serial.println(".begin() returned with an error.");
5757
while (1); //Hang if there was a problem.

examples/Core/Core.ino

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,29 @@ void setup()
5151
Serial.println("CCS811 Core Example");
5252

5353
//This setup routiene is similar to what is used in the subclass' .begin() function
54-
status_t returnCode = mySensor.beginCore();
54+
CCS811Core::status returnCode = mySensor.beginCore();
5555
Serial.print("beginCore exited with: ");
5656
switch ( returnCode )
5757
{
58-
case SENSOR_SUCCESS:
59-
Serial.println("SUCCESS");
58+
case CCS811Core::SENSOR_SUCCESS:
59+
Serial.print("SUCCESS");
6060
break;
61-
case SENSOR_ID_ERROR:
62-
Serial.println("ID_ERROR");
61+
case CCS811Core::SENSOR_ID_ERROR:
62+
Serial.print("ID_ERROR");
6363
break;
64-
case SENSOR_I2C_ERROR:
65-
Serial.println("I2C_ERROR");
64+
case CCS811Core::SENSOR_I2C_ERROR:
65+
Serial.print("I2C_ERROR");
6666
break;
67-
case SENSOR_INTERNAL_ERROR:
68-
Serial.println("INTERNAL_ERROR");
67+
case CCS811Core::SENSOR_INTERNAL_ERROR:
68+
Serial.print("INTERNAL_ERROR");
69+
break;
70+
case CCS811Core::SENSOR_GENERIC_ERROR:
71+
Serial.print("GENERIC_ERROR");
6972
break;
7073
default:
71-
Serial.println("Unspecified error.");
74+
Serial.print("Unspecified error.");
7275
}
73-
76+
7477
//Write to this register to start app
7578
Wire.beginTransmission(CCS811_ADDR);
7679
Wire.write(CSS811_APP_START);

examples/NTCCompensated/NTCCompensated.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void setup()
4343
Serial.begin(9600);
4444
Serial.println();
4545
Serial.println("Apply NTC data to CCS811 for compensation.");
46-
status_t returnCode = myCCS811.begin();
46+
CCS811Core::status returnCode = myCCS811.begin();
4747
Serial.print("CCS811 begin exited with: ");
4848
printDriverError( returnCode );
4949
Serial.println();
@@ -100,28 +100,28 @@ void loop()
100100
delay(10); //Don't spam the I2C bus
101101
}
102102

103-
//printDriverError decodes the status_t type and prints the
103+
//printDriverError decodes the CCS811Core::status type and prints the
104104
//type of error to the serial terminal.
105105
//
106-
//Save the return value of any function of type status_t, then pass
106+
//Save the return value of any function of type CCS811Core::status, then pass
107107
//to this function to see what the output was.
108-
void printDriverError( status_t errorCode )
108+
void printDriverError( CCS811Core::status errorCode )
109109
{
110110
switch ( errorCode )
111111
{
112-
case SENSOR_SUCCESS:
112+
case CCS811Core::SENSOR_SUCCESS:
113113
Serial.print("SUCCESS");
114114
break;
115-
case SENSOR_ID_ERROR:
115+
case CCS811Core::SENSOR_ID_ERROR:
116116
Serial.print("ID_ERROR");
117117
break;
118-
case SENSOR_I2C_ERROR:
118+
case CCS811Core::SENSOR_I2C_ERROR:
119119
Serial.print("I2C_ERROR");
120120
break;
121-
case SENSOR_INTERNAL_ERROR:
121+
case CCS811Core::SENSOR_INTERNAL_ERROR:
122122
Serial.print("INTERNAL_ERROR");
123123
break;
124-
case SENSOR_GENERIC_ERROR:
124+
case CCS811Core::SENSOR_GENERIC_ERROR:
125125
Serial.print("GENERIC_ERROR");
126126
break;
127127
default:

examples/TwentyMinuteTest/TwentyMinuteTest.ino

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void setup()
4848
Serial.println("20 minute test");
4949

5050
//This begins the CCS811 sensor and prints error status of .begin()
51-
status_t returnCode = myCCS811.begin();
51+
CCS811Core::status returnCode = myCCS811.begin();
5252
Serial.print("begin exited with: ");
5353
printDriverError( returnCode );
5454
Serial.println();
@@ -98,28 +98,33 @@ void printRunTime()
9898
if (hours == 0 && minutes < 20) Serial.print(" Not yet valid");
9999
}
100100

101-
//printDriverError decodes the status_t type and prints the
101+
//printDriverError decodes the CCS811Core::status type and prints the
102102
//type of error to the serial terminal.
103103
//
104-
//Save the return value of any function of type status_t, then pass
104+
//Save the return value of any function of type CCS811Core::status, then pass
105105
//to this function to see what the output was.
106-
void printDriverError( status_t errorCode )
106+
//printDriverError decodes the CCS811Core::status type and prints the
107+
//type of error to the serial terminal.
108+
//
109+
//Save the return value of any function of type CCS811Core::status, then pass
110+
//to this function to see what the output was.
111+
void printDriverError( CCS811Core::status errorCode )
107112
{
108113
switch ( errorCode )
109114
{
110-
case SENSOR_SUCCESS:
115+
case CCS811Core::SENSOR_SUCCESS:
111116
Serial.print("SUCCESS");
112117
break;
113-
case SENSOR_ID_ERROR:
118+
case CCS811Core::SENSOR_ID_ERROR:
114119
Serial.print("ID_ERROR");
115120
break;
116-
case SENSOR_I2C_ERROR:
121+
case CCS811Core::SENSOR_I2C_ERROR:
117122
Serial.print("I2C_ERROR");
118123
break;
119-
case SENSOR_INTERNAL_ERROR:
124+
case CCS811Core::SENSOR_INTERNAL_ERROR:
120125
Serial.print("INTERNAL_ERROR");
121126
break;
122-
case SENSOR_GENERIC_ERROR:
127+
case CCS811Core::SENSOR_GENERIC_ERROR:
123128
Serial.print("GENERIC_ERROR");
124129
break;
125130
default:

examples/WakeAndInterrupt/WakeAndInterrupt.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void setup()
6262
Serial.println();
6363
Serial.println("...");
6464

65-
status_t returnCode;
65+
CCS811Core::status returnCode;
6666

6767
//This begins the CCS811 sensor and prints error status of .begin()
6868
returnCode = myCCS811.begin();
@@ -120,28 +120,28 @@ void loop()
120120
}
121121

122122

123-
//printDriverError decodes the status_t type and prints the
123+
//printDriverError decodes the CCS811Core::status type and prints the
124124
//type of error to the serial terminal.
125125
//
126-
//Save the return value of any function of type status_t, then pass
126+
//Save the return value of any function of type CCS811Core::status, then pass
127127
//to this function to see what the output was.
128-
void printDriverError( status_t errorCode )
128+
void printDriverError( CCS811Core::status errorCode )
129129
{
130130
switch ( errorCode )
131131
{
132-
case SENSOR_SUCCESS:
132+
case CCS811Core::SENSOR_SUCCESS:
133133
Serial.print("SUCCESS");
134134
break;
135-
case SENSOR_ID_ERROR:
135+
case CCS811Core::SENSOR_ID_ERROR:
136136
Serial.print("ID_ERROR");
137137
break;
138-
case SENSOR_I2C_ERROR:
138+
case CCS811Core::SENSOR_I2C_ERROR:
139139
Serial.print("I2C_ERROR");
140140
break;
141-
case SENSOR_INTERNAL_ERROR:
141+
case CCS811Core::SENSOR_INTERNAL_ERROR:
142142
Serial.print("INTERNAL_ERROR");
143143
break;
144-
case SENSOR_GENERIC_ERROR:
144+
case CCS811Core::SENSOR_GENERIC_ERROR:
145145
Serial.print("GENERIC_ERROR");
146146
break;
147147
default:

examples/setEnvironmentalReadings/setEnvironmentalReadings.ino

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void setup()
4848
Serial.println("CCS811 EnvironmentalReadings Example");
4949

5050
//This begins the CCS811 sensor and prints error status of .begin()
51-
status_t returnCode = myCCS811.begin();
51+
CCS811Core::status returnCode = myCCS811.begin();
5252
Serial.print("begin exited with: ");
5353
printDriverError( returnCode );
5454
Serial.println();
@@ -100,33 +100,38 @@ void loop()
100100
}
101101

102102

103-
//printDriverError decodes the status_t type and prints the
103+
//printDriverError decodes the CCS811Core::status type and prints the
104104
//type of error to the serial terminal.
105105
//
106-
//Save the return value of any function of type status_t, then pass
106+
//Save the return value of any function of type CCS811Core::status, then pass
107107
//to this function to see what the output was.
108-
void printDriverError( status_t errorCode )
108+
//printDriverError decodes the CCS811Core::status type and prints the
109+
//type of error to the serial terminal.
110+
//
111+
//Save the return value of any function of type CCS811Core::status, then pass
112+
//to this function to see what the output was.
113+
void printDriverError( CCS811Core::status errorCode )
109114
{
110-
switch( errorCode )
111-
{
112-
case SENSOR_SUCCESS:
113-
Serial.print("SUCCESS");
114-
break;
115-
case SENSOR_ID_ERROR:
116-
Serial.print("ID_ERROR");
117-
break;
118-
case SENSOR_I2C_ERROR:
119-
Serial.print("I2C_ERROR");
120-
break;
121-
case SENSOR_INTERNAL_ERROR:
122-
Serial.print("INTERNAL_ERROR");
123-
break;
124-
case SENSOR_GENERIC_ERROR:
125-
Serial.print("GENERIC_ERROR");
126-
break;
127-
default:
128-
Serial.print("Unspecified error.");
129-
}
115+
switch ( errorCode )
116+
{
117+
case CCS811Core::SENSOR_SUCCESS:
118+
Serial.print("SUCCESS");
119+
break;
120+
case CCS811Core::SENSOR_ID_ERROR:
121+
Serial.print("ID_ERROR");
122+
break;
123+
case CCS811Core::SENSOR_I2C_ERROR:
124+
Serial.print("I2C_ERROR");
125+
break;
126+
case CCS811Core::SENSOR_INTERNAL_ERROR:
127+
Serial.print("INTERNAL_ERROR");
128+
break;
129+
case CCS811Core::SENSOR_GENERIC_ERROR:
130+
Serial.print("GENERIC_ERROR");
131+
break;
132+
default:
133+
Serial.print("Unspecified error.");
134+
}
130135
}
131136

132137
//printSensorError gets, clears, then prints the errors

0 commit comments

Comments
 (0)