Skip to content

Commit 5f9d861

Browse files
committed
format C sources
so that they pass the CI check
1 parent af1b84f commit 5f9d861

File tree

4 files changed

+374
-162
lines changed

4 files changed

+374
-162
lines changed

examples/raspberry-pi/algorithm_example_usage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
*/
3131

3232
#include "sensirion_gas_index_algorithm.h"
33-
#include <stdio.h> // printf
3433
#include <math.h>
34+
#include <stdio.h> // printf
3535

3636
#include "sensirion_common.h"
3737
#include "sensirion_i2c_hal.h"

examples/raspberry-pi/low_power_example.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
*/
3131

3232
#include "sensirion_gas_index_algorithm.h"
33-
#include <stdio.h> // printf
3433
#include <math.h>
34+
#include <stdio.h> // printf
3535

3636
#include "sensirion_common.h"
3737
#include "sensirion_i2c_hal.h"
@@ -41,7 +41,6 @@
4141
uint16_t DEFAULT_COMPENSATION_RH = 0x8000; // in ticks as defined by SGP40
4242
uint16_t DEFAULT_COMPENSATION_T = 0x6666; // in ticks as defined by SGP40
4343

44-
4544
void read_compensation_values(uint16_t* compensation_rh,
4645
uint16_t* compensation_t);
4746

@@ -52,30 +51,33 @@ int main(void) {
5251
uint16_t sraw_voc = 0;
5352
int32_t voc_index_value = 0;
5453
// Sampling interval in seconds
55-
// This code uses a fixed heating pulse of ca. 200 ms for the measurement and thus,
56-
// the sampling interval defines the duty cycle
54+
// This code uses a fixed heating pulse of ca. 200 ms for the measurement
55+
// and thus, the sampling interval defines the duty cycle
5756
float sampling_interval = 1.f;
5857

5958
// initialize gas index parameters
6059
GasIndexAlgorithmParams voc_params;
61-
GasIndexAlgorithm_init_with_sampling_interval(&voc_params, GasIndexAlgorithm_ALGORITHM_TYPE_VOC, sampling_interval);
60+
GasIndexAlgorithm_init_with_sampling_interval(
61+
&voc_params, GasIndexAlgorithm_ALGORITHM_TYPE_VOC, sampling_interval);
6262

6363
// initialize i2c communication used for SHT4x and SGP40
6464
sensirion_i2c_hal_init();
6565

6666
for (int i = 0; i < 100; i += 1) {
6767

6868
// 1. Sleep: Total loop time should match the chosen sampling interval
69-
// Therefore we take into account the heater delay and the measurement delays.
70-
sensirion_i2c_hal_sleep_usec(((uint32_t)(sampling_interval*1000)-240)*1000);
69+
// Therefore we take into account the heater delay and the measurement
70+
// delays.
71+
sensirion_i2c_hal_sleep_usec(
72+
((uint32_t)(sampling_interval * 1000) - 240) * 1000);
7173

7274
// 2. Measure SHT4x RH and T signals and convert to SGP40 ticks
7375
read_compensation_values(&compensation_rh, &compensation_t);
7476

7577
// 3. Measure SGP40 signal with low power mode
7678
// 3.1 Request a first measurement to turn the heater on
7779
error = sgp40_measure_raw_signal(compensation_rh, compensation_t,
78-
&sraw_voc);
80+
&sraw_voc);
7981
if (error) {
8082
printf("Error executing sgp40_measure_raw_signals(): %i\n", error);
8183
continue;
@@ -86,7 +88,7 @@ int main(void) {
8688

8789
// 3.3 Request the actual measurement
8890
error = sgp40_measure_raw_signal(compensation_rh, compensation_t,
89-
&sraw_voc);
91+
&sraw_voc);
9092

9193
if (error) {
9294
printf("Error executing sgp40_measure_raw_signals(): %i\n", error);
@@ -105,7 +107,6 @@ int main(void) {
105107
// index values
106108
GasIndexAlgorithm_process(&voc_params, sraw_voc, &voc_index_value);
107109
printf("VOC Raw: %i\tVOC Index: %i\n", sraw_voc, voc_index_value);
108-
109110
}
110111

111112
return 0;
@@ -122,8 +123,8 @@ int main(void) {
122123
void read_compensation_values(uint16_t* compensation_rh,
123124
uint16_t* compensation_t) {
124125
int16_t error = 0;
125-
float s_rh = 0; // %RH
126-
float s_temperature = 0; // degC
126+
float s_rh = 0; // %RH
127+
float s_temperature = 0; // degC
127128
error = sht4x_measure_high_precision(&s_temperature, &s_rh);
128129
if (error) {
129130
printf("Error executing sht4x_measure_high_precision(): %i\n", error);
@@ -134,7 +135,7 @@ void read_compensation_values(uint16_t* compensation_rh,
134135
printf("T: %.2f\tRH: %.2f\n", s_temperature, s_rh);
135136

136137
// convert temperature and humidity to ticks as defined by SGP40
137-
// interface
138+
// interface
138139
// NOTE: in case you read RH and T raw signals check out the
139140
// ticks specification in the datasheet, as they can be different for
140141
// different sensors

0 commit comments

Comments
 (0)