Skip to content

Commit 0dd63fc

Browse files
moonlight83340danieldegrasse
authored andcommitted
samples: shields: x_nucleo_iks02a1: run clang-format
Run clang-format on files. Signed-off-by: Gaetan Perrot <[email protected]>
1 parent f33adc5 commit 0dd63fc

File tree

1 file changed

+23
-30
lines changed
  • samples/shields/x_nucleo_iks02a1/standard/src

1 file changed

+23
-30
lines changed

samples/shields/x_nucleo_iks02a1/standard/src/main.c

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#ifdef CONFIG_IIS2DLPC_TRIGGER
1414
static int iis2dlpc_trig_cnt;
1515

16-
static void iis2dlpc_trigger_handler(const struct device *dev,
17-
const struct sensor_trigger *trig)
16+
static void iis2dlpc_trigger_handler(const struct device *dev, const struct sensor_trigger *trig)
1817
{
1918
sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
2019
iis2dlpc_trig_cnt++;
@@ -24,8 +23,7 @@ static void iis2dlpc_trigger_handler(const struct device *dev,
2423
#ifdef CONFIG_IIS2MDC_TRIGGER
2524
static int iis2mdc_trig_cnt;
2625

27-
static void iis2mdc_trigger_handler(const struct device *dev,
28-
const struct sensor_trigger *trig)
26+
static void iis2mdc_trigger_handler(const struct device *dev, const struct sensor_trigger *trig)
2927
{
3028
sensor_sample_fetch_chan(dev, SENSOR_CHAN_ALL);
3129
iis2mdc_trig_cnt++;
@@ -59,16 +57,16 @@ static void iis2dlpc_config(const struct device *iis2dlpc)
5957
odr_attr.val1 = 100;
6058
odr_attr.val2 = 0;
6159

62-
if (sensor_attr_set(iis2dlpc, SENSOR_CHAN_ACCEL_XYZ,
63-
SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) {
60+
if (sensor_attr_set(iis2dlpc, SENSOR_CHAN_ACCEL_XYZ, SENSOR_ATTR_SAMPLING_FREQUENCY,
61+
&odr_attr) < 0) {
6462
printk("Cannot set sampling frequency for IIS2DLPC accel\n");
6563
return;
6664
}
6765

6866
sensor_g_to_ms2(16, &fs_attr);
6967

70-
if (sensor_attr_set(iis2dlpc, SENSOR_CHAN_ACCEL_XYZ,
71-
SENSOR_ATTR_FULL_SCALE, &fs_attr) < 0) {
68+
if (sensor_attr_set(iis2dlpc, SENSOR_CHAN_ACCEL_XYZ, SENSOR_ATTR_FULL_SCALE, &fs_attr) <
69+
0) {
7270
printk("Cannot set sampling frequency for IIS2DLPC gyro\n");
7371
return;
7472
}
@@ -90,8 +88,8 @@ static void iis2mdc_config(const struct device *iis2mdc)
9088
odr_attr.val1 = 100;
9189
odr_attr.val2 = 0;
9290

93-
if (sensor_attr_set(iis2mdc, SENSOR_CHAN_ALL,
94-
SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) {
91+
if (sensor_attr_set(iis2mdc, SENSOR_CHAN_ALL, SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) <
92+
0) {
9593
printk("Cannot set sampling frequency for IIS2MDC\n");
9694
return;
9795
}
@@ -113,16 +111,16 @@ static void ism330dhcx_config(const struct device *ism330dhcx)
113111
odr_attr.val1 = 416;
114112
odr_attr.val2 = 0;
115113

116-
if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_ACCEL_XYZ,
117-
SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) {
114+
if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_ACCEL_XYZ, SENSOR_ATTR_SAMPLING_FREQUENCY,
115+
&odr_attr) < 0) {
118116
printk("Cannot set sampling frequency for ISM330DHCX accel\n");
119117
return;
120118
}
121119

122120
sensor_g_to_ms2(16, &fs_attr);
123121

124-
if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_ACCEL_XYZ,
125-
SENSOR_ATTR_FULL_SCALE, &fs_attr) < 0) {
122+
if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_ACCEL_XYZ, SENSOR_ATTR_FULL_SCALE, &fs_attr) <
123+
0) {
126124
printk("Cannot set sampling frequency for ISM330DHCX accel\n");
127125
return;
128126
}
@@ -131,16 +129,16 @@ static void ism330dhcx_config(const struct device *ism330dhcx)
131129
odr_attr.val1 = 208;
132130
odr_attr.val2 = 0;
133131

134-
if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_GYRO_XYZ,
135-
SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) {
132+
if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_GYRO_XYZ, SENSOR_ATTR_SAMPLING_FREQUENCY,
133+
&odr_attr) < 0) {
136134
printk("Cannot set sampling frequency for ISM330DHCX gyro\n");
137135
return;
138136
}
139137

140138
sensor_degrees_to_rad(250, &fs_attr);
141139

142-
if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_GYRO_XYZ,
143-
SENSOR_ATTR_FULL_SCALE, &fs_attr) < 0) {
140+
if (sensor_attr_set(ism330dhcx, SENSOR_CHAN_GYRO_XYZ, SENSOR_ATTR_FULL_SCALE, &fs_attr) <
141+
0) {
144142
printk("Cannot set fs for ISM330DHCX gyro\n");
145143
return;
146144
}
@@ -224,27 +222,23 @@ int main(void)
224222
printf("X-NUCLEO-IKS02A1 sensor Mode 1 dashboard\n\n");
225223

226224
printf("IIS2DLPC: Accel (m.s-2): x: %.3f, y: %.3f, z: %.3f\n",
227-
sensor_value_to_double(&accel2[0]),
228-
sensor_value_to_double(&accel2[1]),
229-
sensor_value_to_double(&accel2[2]));
225+
sensor_value_to_double(&accel2[0]), sensor_value_to_double(&accel2[1]),
226+
sensor_value_to_double(&accel2[2]));
230227

231228
/* iis2mdc */
232229
printf("IIS2MDC: Magn (gauss): x: %.3f, y: %.3f, z: %.3f\n",
233-
sensor_value_to_double(&magn[0]),
234-
sensor_value_to_double(&magn[1]),
230+
sensor_value_to_double(&magn[0]), sensor_value_to_double(&magn[1]),
235231
sensor_value_to_double(&magn[2]));
236232

237233
printf("IIS2MDC: Temperature: %.1f C\n", sensor_value_to_double(&die_temp));
238234

239235
printf("ISM330DHCX: Accel (m.s-2): x: %.3f, y: %.3f, z: %.3f\n",
240-
sensor_value_to_double(&accel1[0]),
241-
sensor_value_to_double(&accel1[1]),
242-
sensor_value_to_double(&accel1[2]));
236+
sensor_value_to_double(&accel1[0]), sensor_value_to_double(&accel1[1]),
237+
sensor_value_to_double(&accel1[2]));
243238

244239
printf("ISM330DHCX: GYro (dps): x: %.3f, y: %.3f, z: %.3f\n",
245-
sensor_value_to_double(&gyro[0]),
246-
sensor_value_to_double(&gyro[1]),
247-
sensor_value_to_double(&gyro[2]));
240+
sensor_value_to_double(&gyro[0]), sensor_value_to_double(&gyro[1]),
241+
sensor_value_to_double(&gyro[2]));
248242
#ifdef CONFIG_IIS2DLPC_TRIGGER
249243
printk("%d:: iis2dlpc trig %d\n", cnt, iis2dlpc_trig_cnt);
250244
#endif
@@ -258,7 +252,6 @@ int main(void)
258252
printk("%d:: ism330dhcx gyr trig %d\n", cnt, ism330dhcx_gyr_trig_cnt);
259253
#endif
260254

261-
262255
cnt++;
263256
k_sleep(K_MSEC(2000));
264257
}

0 commit comments

Comments
 (0)