Skip to content

Commit 4b1be2c

Browse files
committed
refactor: reformatted files with uncrustify
1 parent 88fd530 commit 4b1be2c

File tree

16 files changed

+401
-361
lines changed

16 files changed

+401
-361
lines changed

components/lifesensor_common/include/macro/queue.h

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,62 @@
66

77
/**
88
* struct lifesensor_queue_t - generic queue struct
9-
* @queue: Holds the FreeRTOS queue.
9+
* @queue: Holds the FreeRTOS queue.
1010
* @handle: Provides a reference to the queue after initialization.
1111
* @buffer: Points to the subsequent queue buffer.
1212
*
1313
* This struct serves as an abstraction for operating with FreeRTOS queues such
1414
* that it includes necessary fields for managing a queues data. It is intended
1515
* to be used with the LIFESENSOR_QUEUE() macro.
1616
*/
17-
typedef struct {
18-
QueueHandle_t handle;
19-
StaticQueue_t queue;
20-
uint8_t buffer[];
17+
typedef struct
18+
{
19+
QueueHandle_t handle;
20+
StaticQueue_t queue;
21+
uint8_t buffer[];
2122
} lifesensor_queue_t;
2223

2324

2425
/**
2526
* LIFESENSOR_QUEUE() - Generic queue struct declaration macro
26-
* @type: The variable type the queue will hold.
27-
* @item_count Provide how many items of `type` fit into the queue..
27+
* @type: The variable type the queue will hold.
28+
* @item_count Provide how many items of `type` fit into the queue..
2829
*
2930
* The macro is used for easier queue struct allocation. The resulting
3031
* queue struct should be initialized through the corresponding
3132
* lifesensor_queue_init() function macro.
3233
*
33-
* NOTE: `queue` houses the actual queue struct of type `lifesensor_queue_t`.
34-
* `lifesensor_queue_t`s buffer attribute of undefined length will
35-
* point to the buffer declared here with size `buffersize`.
34+
* NOTE: `queue` houses the actual queue struct of type `lifesensor_queue_t`.
35+
* `lifesensor_queue_t`s buffer attribute of undefined length will
36+
* point to the buffer declared here with size `buffersize`.
3637
*
3738
*/
38-
#define LIFESENSOR_QUEUE(type, item_count) \
39-
struct { \
40-
lifesensor_queue_t queue; \
41-
type buffer[item_count]; \
42-
}
39+
#define LIFESENSOR_QUEUE(type, item_count) \
40+
struct { \
41+
lifesensor_queue_t queue; \
42+
type buffer[item_count]; \
43+
}
4344

4445

4546
/**
4647
* lifesensor_queue_init() - Initialize a queue generated with LIFESENSOR_QUEUE
47-
* @anon_queue: Pass a pointer to an instacne created with LIFESENSOR_QUEUE.
48+
* @anon_queue: Pass a pointer to an instacne created with LIFESENSOR_QUEUE.
4849
*
4950
* This is a wrapper for `xTaskCreateStatic()` which initializes several
5051
* internal variables. It provides another layer of abstraction to not bother
5152
* much with the FreeRTOS internals and hides redundant code.
5253
*
5354
* Please consult https://www.freertos.org/xTaskCreateStatic.html
5455
*/
55-
#define lifesensor_queue_init(anon_queue) \
56-
{ \
57-
(*anon_queue).queue.handle = xQueueCreateStatic( \
58-
sizeof((*anon_queue).buffer) / sizeof((*anon_queue).buffer[0]), \
59-
sizeof((*anon_queue).buffer[0]), \
60-
(*anon_queue).queue.buffer, \
61-
&(*anon_queue).queue.queue \
62-
); \
63-
}
56+
#define lifesensor_queue_init(anon_queue) \
57+
{ \
58+
(*anon_queue).queue.handle \
59+
= xQueueCreateStatic(sizeof((*anon_queue).buffer) \
60+
/ sizeof((*anon_queue).buffer[0]), \
61+
sizeof((*anon_queue).buffer[0]), \
62+
(*anon_queue).queue.buffer, \
63+
&(*anon_queue).queue.queue \
64+
); \
65+
}
6466

6567
#endif

components/lifesensor_common/include/macro/task.h

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
* that it includes necessary fields for managing a tasks data. It is intended
1515
* to be used together with the LIFESENSOR_TASK() macro.
1616
*/
17-
typedef struct {
18-
TaskHandle_t handle;
19-
StaticTask_t tcb;
20-
StackType_t stack[];
17+
typedef struct
18+
{
19+
TaskHandle_t handle;
20+
StaticTask_t tcb;
21+
StackType_t stack[];
2122
} lifesensor_task_t;
2223

2324

@@ -26,28 +27,28 @@ typedef struct {
2627
* @stacksize: Determines the stack depth used.
2728
*
2829
* The macro is used for easier task struct allocation. The resulting
29-
* task struct should be initialized through the corresponding
30+
* task struct should be initialized through the corresponding
3031
* `lifesensor_task_init()` function macro.
3132
*
32-
* NOTE: `task` houses the actual task struct of type `lifesensor_task_t`.
33-
* `lifesensor_task_t`s stack attribute of undefined length will
34-
* point to the stack declared here with size `stacksize`.
33+
* NOTE: `task` houses the actual task struct of type `lifesensor_task_t`.
34+
* `lifesensor_task_t`s stack attribute of undefined length will
35+
* point to the stack declared here with size `stacksize`.
3536
*
3637
*/
37-
#define LIFESENSOR_TASK(stacksize) \
38-
struct { \
39-
lifesensor_task_t task; \
40-
StackType_t stack[stacksize]; \
41-
}
38+
#define LIFESENSOR_TASK(stacksize) \
39+
struct { \
40+
lifesensor_task_t task; \
41+
StackType_t stack[stacksize]; \
42+
}
4243

4344

4445
/**
4546
* lifesensor_task_init() - Initialize a task generated with LIFESENSOR_TASK
46-
* @anon_task: Pass a pointer to instance created with LIFESENSOR_TASK.
47-
* @name: Name the task to recognize it later.
48-
* @func: Provide a function pointer to execute in task.
49-
* @args: Function arguments that will be fed to `func`.
50-
* @prio: Set the desired task priority.
47+
* @anon_task: Pass a pointer to instance created with LIFESENSOR_TASK.
48+
* @name: Name the task to recognize it later.
49+
* @func: Provide a function pointer to execute in task.
50+
* @args: Function arguments that will be fed to `func`.
51+
* @prio: Set the desired task priority.
5152
*
5253
* This is a wrapper for `xTaskCreateStatic()` which initializes several
5354
* internal variables. It provides another layer of abstraction to not bother
@@ -56,17 +57,20 @@ typedef struct {
5657
* Please consult https://www.freertos.org/xTaskCreateStatic.html
5758
*/
5859

59-
#define lifesensor_task_init(anon_task, name, func, args, prio) \
60-
{ \
61-
(*anon_task).task.handle = xTaskCreateStatic( \
62-
func, \
63-
name, \
64-
sizeof((*anon_task).stack) / sizeof((*anon_task).stack[0]), \
65-
args, \
66-
prio, \
67-
(*anon_task).stack, \
68-
(StaticTask_t*)(&(*anon_task).task.tcb) \
69-
); \
70-
}
60+
#define lifesensor_task_init(anon_task, name, func, args, prio) \
61+
{ \
62+
(*anon_task).task.handle = xTaskCreateStatic(func, \
63+
name, \
64+
sizeof((*anon_task).stack) \
65+
/ sizeof((*anon_task).stack \
66+
[0]), \
67+
args, \
68+
prio, \
69+
(*anon_task).stack, \
70+
(StaticTask_t*) (&(* \
71+
anon_task) \
72+
.task.tcb) \
73+
); \
74+
}
7175

7276
#endif

components/spo2/include/spo2.h

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,57 @@
22
#define __SPO2__
33

44
#include <freertos/FreeRTOS.h>
5-
#include <freertos/task.h>
65
#include <freertos/queue.h>
6+
#include <freertos/task.h>
77

8-
#include "spo2_driver.h"
9-
#include "macro/task.h"
108
#include "macro/queue.h"
9+
#include "macro/task.h"
10+
#include "spo2_driver.h"
1111

1212

1313
/**
1414
* struct _spo2_sample - life-sensor sample struct
15-
* @ird_dc: infrared DC value
16-
* @red_dc: red DC value
17-
* @ird_ac: infrared AC value
18-
* @red_ac: red AC value
19-
* @ird_acdc: infrared error of DC and pre-processed DC
20-
* @red_acdc: red error of DC and pre-processed DC
15+
* @ird_dc: infrared DC value
16+
* @red_dc: red DC value
17+
* @ird_ac: infrared AC value
18+
* @red_ac: red AC value
19+
* @ird_acdc: infrared error of DC and pre-processed DC
20+
* @red_acdc: red error of DC and pre-processed DC
2121
*
2222
* This struct holds pre-processed sensor values
2323
*/
24-
typedef struct {
25-
int32_t ird_dc;
26-
int32_t red_dc;
27-
int32_t ird_ac;
28-
int32_t red_ac;
29-
int32_t ird_acdc;
30-
int32_t red_acdc;
24+
typedef struct
25+
{
26+
int32_t ird_dc;
27+
int32_t red_dc;
28+
int32_t ird_ac;
29+
int32_t red_ac;
30+
int32_t ird_acdc;
31+
int32_t red_acdc;
3132
} spo2_input_sample_t;
3233

3334

3435
/**
3536
* spo2_t - type deffinition of the spo2 unit
3637
*
37-
* @adc_queue: Receives ulp adc measurements.
38-
* @adc_task: Processes adc input data from adc_queue.
38+
* @adc_queue: Receives ulp adc measurements.
39+
* @adc_task: Processes adc input data from adc_queue.
3940
*/
40-
typedef struct {
41-
LIFESENSOR_QUEUE(spo2_adc_sample_t, 16) adc_queue;
42-
LIFESENSOR_TASK(4096) adc_task;
41+
typedef struct
42+
{
43+
LIFESENSOR_QUEUE(spo2_adc_sample_t, 16) adc_queue;
44+
LIFESENSOR_TASK(4096) adc_task;
4345
} spo2_t;
4446

45-
4647
/**
4748
* spo2_init() - spo2 initialization
48-
* @spo2: The only parameter necessary is the unit itself.
49+
* @spo2: The only parameter necessary is the unit itself.
4950
*
5051
* The function initializes queues and tasks of the spo2 unit.
5152
*/
52-
void lifesensor_spo2_init(spo2_t *spo2, const char *name);
53+
void
54+
lifesensor_spo2_init(spo2_t *spo2,
55+
const char *name);
56+
5357

54-
#endif
58+
#endif

components/spo2/include/spo2_driver.h

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
#include <freertos/task.h>
66

77
#define SPO2_READ_PERIOD_MS 200
8-
#define SPO2_READ_PERIOD (SPO2_READ_PERIOD_MS / portTICK_PERIOD_MS)
8+
#define SPO2_READ_PERIOD (SPO2_READ_PERIOD_MS / portTICK_PERIOD_MS)
99

1010
#define SPO2_DCP_STEP_COUNT 100
11-
#define SPO2_DCP_UD_PIN GPIO_NUM_16
12-
#define SPO2_DCP_INC_PIN GPIO_NUM_17
11+
#define SPO2_DCP_UD_PIN GPIO_NUM_16
12+
#define SPO2_DCP_INC_PIN GPIO_NUM_17
1313

14-
#define SPO2_PWM_RED_PIN GPIO_NUM_14
15-
#define SPO2_PWM_IRD_PIN GPIO_NUM_27
16-
#define SPO2_PWM_FREQUENCY 4000
14+
#define SPO2_PWM_RED_PIN GPIO_NUM_14
15+
#define SPO2_PWM_IRD_PIN GPIO_NUM_27
16+
#define SPO2_PWM_FREQUENCY 4000
1717
#define SPO2_PWM_DUTY_16_PERCENT 675
1818

1919
#define SPO2_ADC_ROUNDS 4
20-
#define SPO2_ADC_ATTEN ADC_ATTEN_DB_11
20+
#define SPO2_ADC_ATTEN ADC_ATTEN_DB_11
2121
#define SPO2_ADC_RED_DC ADC1_CHANNEL_4
2222
#define SPO2_ADC_IRD_DC ADC1_CHANNEL_5
2323
#define SPO2_ADC_RED_AC ADC1_CHANNEL_6
@@ -26,22 +26,22 @@
2626

2727
/**
2828
* struct spo2_adc_sample - life-sensor spo2 adc sample struct
29-
* @red_dc: red LED DC value
30-
* @ird_dc: infrared LED DC value
31-
* @red_ac: red LED AC value
32-
* @ird_ac: infrared LED AC value
29+
* @red_dc: red LED DC value
30+
* @ird_dc: infrared LED DC value
31+
* @red_ac: red LED AC value
32+
* @ird_ac: infrared LED AC value
3333
*
3434
* This struct saves an ADC sample necessary for the spo2 calculations.
3535
* NOTE: Only the lower 16 bit are relevant.
3636
*/
37-
typedef struct __attribute__((packed)) {
38-
uint32_t red_dc;
39-
uint32_t ird_dc;
40-
uint32_t red_ac;
41-
uint32_t ird_ac;
37+
typedef struct __attribute__((packed))
38+
{
39+
uint32_t red_dc;
40+
uint32_t ird_dc;
41+
uint32_t red_ac;
42+
uint32_t ird_ac;
4243
} spo2_adc_sample_t;
4344

44-
4545
/**
4646
* spo2_init_peripherals() - initialization of necessary peripherals
4747
*
@@ -52,16 +52,19 @@ typedef struct __attribute__((packed)) {
5252
* controlling two digital potentiometers for automatic gain control of the
5353
* ADC inputs.
5454
*/
55-
void spo2_init_peripherals(void);
55+
void
56+
spo2_init_peripherals(void);
57+
5658

5759
/**
5860
* spo2_read_adc() - read in a complete ADC data set
59-
* @sample single set of ADC readings
61+
* @sample single set of ADC readings
6062
*
6163
* Read all ADC values that are necessary to perform calculations and save
6264
* each of it to data. The data is an average of SPO2_ADC_ROUNDS measurements.
6365
*/
64-
void spo2_read_adc(spo2_adc_sample_t *sample);
66+
void
67+
spo2_read_adc(spo2_adc_sample_t *sample);
6568

66-
#endif
6769

70+
#endif

components/spo2/include/spo2_filter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#define ADC_OFFSET_HALF 2048
88

9-
109
/**
1110
* spo2_filter() - Applies digital filters to adc sample
1211
* @sample: source and(!) target sample that contains (previous) filtered
@@ -16,8 +15,9 @@
1615
* This function applies digital filters to the values from `adc_sample` while
1716
* additionally using the old values from the previous filtered `sample`.
1817
*/
19-
void spo2_filter(spo2_input_sample_t *sample, spo2_adc_sample_t *adc_sample);
18+
void
19+
spo2_filter(spo2_input_sample_t *sample,
20+
spo2_adc_sample_t *adc_sample);
2021

2122

2223
#endif
23-

0 commit comments

Comments
 (0)