Skip to content

Commit 761e847

Browse files
committed
clang-format
1 parent ecfa6dc commit 761e847

24 files changed

Lines changed: 773 additions & 932 deletions

File tree

apps/peripheral_tests/blinky_test/src/main.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <zephyr/drivers/gpio.h>
1010

1111
/* 1000 msec = 1 sec */
12-
#define SLEEP_TIME_MS 500
12+
#define SLEEP_TIME_MS 500
1313

1414
/* The devicetree node identifier for the "led0" alias. */
1515
#define LED0_NODE DT_ALIAS(led0)
@@ -22,28 +22,28 @@ static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
2222

2323
int main(void)
2424
{
25-
int ret;
26-
bool led_state = true;
27-
28-
if (!gpio_is_ready_dt(&led)) {
29-
return 0;
30-
}
31-
32-
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
33-
if (ret < 0) {
34-
return 0;
35-
}
36-
37-
while (1) {
38-
ret = gpio_pin_toggle_dt(&led);
39-
if (ret < 0) {
40-
return 0;
41-
}
25+
int ret;
26+
bool led_state = true;
27+
28+
if (!gpio_is_ready_dt(&led)) {
29+
return 0;
30+
}
31+
32+
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
33+
if (ret < 0) {
34+
return 0;
35+
}
36+
37+
while (1) {
38+
ret = gpio_pin_toggle_dt(&led);
39+
if (ret < 0) {
40+
return 0;
41+
}
4242
printf("Toggling LED\n");
4343

44-
led_state = !led_state;
45-
printf("LED state: %s\n", led_state ? "ON" : "OFF");
46-
k_msleep(SLEEP_TIME_MS);
47-
}
48-
return 0;
44+
led_state = !led_state;
45+
printf("LED state: %s\n", led_state ? "ON" : "OFF");
46+
k_msleep(SLEEP_TIME_MS);
47+
}
48+
return 0;
4949
}

apps/peripheral_tests/sd_test/src/main.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);
1414
static FATFS fat_fs;
1515

1616
static struct fs_mount_t fatfs_mnt = {
17-
.type = FS_FATFS,
18-
.mnt_point = MOUNT_POINT,
19-
.fs_data = &fat_fs
20-
};
17+
.type = FS_FATFS, .mnt_point = MOUNT_POINT, .fs_data = &fat_fs};
2118

22-
void write_test_log(void) {
19+
void write_test_log(void)
20+
{
2321
struct fs_file_t file;
2422
int ret;
2523
fs_file_t_init(&file);
2624

2725
// Open or create a file for writing
28-
ret = fs_open(&file, MOUNT_POINT "/log.txt", FS_O_CREATE |FS_O_WRITE);
26+
ret = fs_open(&file, MOUNT_POINT "/log.txt", FS_O_CREATE | FS_O_WRITE);
2927
if (ret) {
3028
LOG_ERR("Failed to open file: %d", ret);
3129
return;
@@ -44,7 +42,8 @@ void write_test_log(void) {
4442
fs_close(&file);
4543
}
4644

47-
void mount_sd_card(void) {
45+
void mount_sd_card(void)
46+
{
4847
int ret;
4948

5049
// Initialize the SDMMC disk
@@ -65,7 +64,8 @@ void mount_sd_card(void) {
6564
}
6665
}
6766

68-
int main(void) {
67+
int main(void)
68+
{
6969
LOG_INF("SD Test Application Started");
7070

7171
// Mount the SD card
@@ -75,10 +75,10 @@ int main(void) {
7575
write_test_log();
7676

7777
int res = fs_unmount(&fatfs_mnt);
78-
if (res != 0) {
79-
printk("Error unmounting disk\n");
80-
return res;
81-
}
78+
if (res != 0) {
79+
printk("Error unmounting disk\n");
80+
return res;
81+
}
8282

8383
return 0;
8484
}

apps/peripheral_tests/sensor_test/src/main.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,11 @@ int main(void)
6565
sensor_channel_get(baro_dev, SENSOR_CHAN_AMBIENT_TEMP, &temperature);
6666

6767
LOG_INF("Pressure: %.2f mPa, Temperature: %.2f degC",
68-
sensor_value_to_double(&pressure),
69-
sensor_value_to_double(&temperature));
68+
sensor_value_to_double(&pressure), sensor_value_to_double(&temperature));
7069
} else {
7170
LOG_ERR("Failed to fetch data from barometer sensor");
7271
}
73-
}
72+
}
7473
#endif
7574

7675
#if TEST_GYRO_SENSOR
@@ -81,8 +80,7 @@ int main(void)
8180
sensor_channel_get(gyro_dev, SENSOR_CHAN_GYRO_Z, &gyro_z);
8281

8382
LOG_INF("Gyroscope (rad/s): X=%.2f, Y=%.2f, Z=%.2f",
84-
sensor_value_to_double(&gyro_x),
85-
sensor_value_to_double(&gyro_y),
83+
sensor_value_to_double(&gyro_x), sensor_value_to_double(&gyro_y),
8684
sensor_value_to_double(&gyro_z));
8785
} else {
8886
LOG_ERR("Failed to fetch data from gyroscope");
@@ -98,8 +96,7 @@ int main(void)
9896
sensor_channel_get(accel_dev, SENSOR_CHAN_ACCEL_Z, &accel_z);
9997

10098
LOG_INF("Acceleration (m/s^2): X=%.2f, Y=%.2f, Z=%.2f",
101-
sensor_value_to_double(&accel_x),
102-
sensor_value_to_double(&accel_y),
99+
sensor_value_to_double(&accel_x), sensor_value_to_double(&accel_y),
103100
sensor_value_to_double(&accel_z));
104101
} else {
105102
LOG_ERR("Failed to fetch data from accelerometer");
@@ -111,4 +108,4 @@ int main(void)
111108
k_sleep(K_MSEC(1000));
112109
}
113110
return 0;
114-
}
111+
}

apps/rockets/cloudburst/src/data.h

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
#include <stdint.h>
55

6-
typedef enum
7-
{
6+
typedef enum {
87
FLIGHT_STATE_STANDBY = 0,
98
FLIGHT_STATE_ASCENT,
109
FLIGHT_STATE_MACH_LOCK,
@@ -14,40 +13,36 @@ typedef enum
1413
} flight_state_id_t;
1514

1615
// Data structures for sensor data
17-
struct imu_data
18-
{
16+
struct imu_data {
1917
float accel[3]; // Acceleration in m/s²
2018
float gyro[3]; // Angular velocity in rad/s
2119
int64_t timestamp; // Timestamp in milliseconds
2220
};
2321

2422
// Per-barometer sensor data
25-
struct baro_sensor_data
26-
{
27-
float pressure; // Pressure in Pa
28-
float temperature; // Temperature in °C
29-
float altitude; // Altitude in meters (from pressure + temp)
30-
float nis; // Normalized innovation squared
31-
uint8_t faults; // Accumulated fault count
32-
bool healthy; // Health status (accepted/rejected)
23+
struct baro_sensor_data {
24+
float pressure; // Pressure in Pa
25+
float temperature; // Temperature in °C
26+
float altitude; // Altitude in meters (from pressure + temp)
27+
float nis; // Normalized innovation squared
28+
uint8_t faults; // Accumulated fault count
29+
bool healthy; // Health status (accepted/rejected)
3330
};
3431

3532
// Combined barometer data (shared with other threads)
36-
struct baro_data
37-
{
38-
struct baro_sensor_data baro0; // Barometer 0
39-
struct baro_sensor_data baro1; // Barometer 1
33+
struct baro_data {
34+
struct baro_sensor_data baro0; // Barometer 0
35+
struct baro_sensor_data baro1; // Barometer 1
4036

41-
float altitude; // Kalman-filtered altitude estimate in meters
42-
float alt_variance; // Kalman filter variance (P)
43-
float velocity; // Vertical velocity estimate (m/s)
44-
float vel_variance; // Velocity variance (P11)
37+
float altitude; // Kalman-filtered altitude estimate in meters
38+
float alt_variance; // Kalman filter variance (P)
39+
float velocity; // Vertical velocity estimate (m/s)
40+
float vel_variance; // Velocity variance (P11)
4541

46-
int64_t timestamp; // Timestamp in milliseconds
42+
int64_t timestamp; // Timestamp in milliseconds
4743
};
4844

49-
struct state_data
50-
{
45+
struct state_data {
5146
flight_state_id_t state;
5247
float ground_altitude;
5348
int64_t timestamp;

apps/rockets/cloudburst/src/log_format.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
#include "data.h"
55
#include <stdint.h>
66

7-
struct log_frame
8-
{
7+
struct log_frame {
98
int64_t log_timestamp;
109

1110
struct imu_data imu;

0 commit comments

Comments
 (0)