Skip to content

Commit 40d45d9

Browse files
committed
Reformatted all the files according to clang-format style
1 parent e56ebb8 commit 40d45d9

File tree

179 files changed

+10350
-10919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+10350
-10919
lines changed

.clang-format

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Language: Cpp
3-
AccessModifierOffset: -2
3+
AccessModifierOffset: 2
44
AlignAfterOpenBracket: Align
55
AlignConsecutiveMacros: true
66
AlignConsecutiveAssignments: false
@@ -21,8 +21,8 @@ AlwaysBreakAfterDefinitionReturnType: None
2121
AlwaysBreakAfterReturnType: None
2222
AlwaysBreakBeforeMultilineStrings: false
2323
AlwaysBreakTemplateDeclarations: MultiLine
24-
BinPackArguments: true
25-
BinPackParameters: true
24+
BinPackArguments: false
25+
BinPackParameters: false
2626
BraceWrapping:
2727
AfterCaseLabel: false
2828
AfterClass: false
@@ -52,14 +52,14 @@ BreakStringLiterals: true
5252
ColumnLimit: 140
5353
CommentPragmas: '^ IWYU pragma:'
5454
CompactNamespaces: false
55-
ConstructorInitializerAllOnOneLineOrOnePerLine: false
55+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
5656
ConstructorInitializerIndentWidth: 2
5757
ContinuationIndentWidth: 2
5858
Cpp11BracedListStyle: true
5959
DeriveLineEnding: false
6060
DerivePointerAlignment: false
6161
DisableFormat: false
62-
ExperimentalAutoDetectBinPacking: false
62+
ExperimentalAutoDetectBinPacking: true
6363
FixNamespaceComments: false
6464
ForEachMacros:
6565
- foreach
@@ -90,10 +90,6 @@ MacroBlockBegin: ''
9090
MacroBlockEnd: ''
9191
MaxEmptyLinesToKeep: 1
9292
NamespaceIndentation: All
93-
ObjCBinPackProtocolList: Auto
94-
ObjCBlockIndentWidth: 2
95-
ObjCSpaceAfterProperty: false
96-
ObjCSpaceBeforeProtocolList: true
9793
PenaltyBreakAssignment: 2
9894
PenaltyBreakBeforeFirstCallParameter: 19
9995
PenaltyBreakComment: 300

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ As of now, here is the list of achievements of this project:
7575
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/gettingStarted.md)
7676

7777
### Develop
78-
- [Generate the fonts and symbols](src/displayapp/fonts/Readme.md)
78+
- [Generate the fonts and symbols](src/displayapp/fonts/README.md)
7979
- [Creating a stopwatch in Pinetime(article)](https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html)
8080

8181
### Build, flash and debug

src/BootloaderVersion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ uint32_t BootloaderVersion::Patch() {
1717
return 0;
1818
}
1919

20-
const char *BootloaderVersion::VersionString() {
20+
const char* BootloaderVersion::VersionString() {
2121
return "0.0.0";
2222
}
2323

src/BootloaderVersion.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Pinetime {
44
class BootloaderVersion {
5-
public:
6-
static uint32_t Major();
7-
static uint32_t Minor();
8-
static uint32_t Patch();
9-
static const char* VersionString();
10-
static bool IsValid();
5+
public:
6+
static uint32_t Major();
7+
static uint32_t Minor();
8+
static uint32_t Patch();
9+
static const char* VersionString();
10+
static bool IsValid();
1111
};
1212
}

src/FreeRTOSConfig.h

+94-98
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@
2626
* 1 tab == 4 spaces!
2727
*/
2828

29-
3029
#ifndef FREERTOS_CONFIG_H
3130
#define FREERTOS_CONFIG_H
3231

3332
#ifdef SOFTDEVICE_PRESENT
34-
#include "nrf_soc.h"
33+
#include "nrf_soc.h"
3534
#endif
3635
#include "app_util_platform.h"
3736

3837
/*-----------------------------------------------------------
3938
* Possible configurations for system timer
4039
*/
41-
#define FREERTOS_USE_RTC 0 /**< Use real time clock for the system */
42-
#define FREERTOS_USE_SYSTICK 1 /**< Use SysTick timer for system */
40+
#define FREERTOS_USE_RTC 0 /**< Use real time clock for the system */
41+
#define FREERTOS_USE_SYSTICK 1 /**< Use SysTick timer for system */
4342

4443
/*-----------------------------------------------------------
4544
* Application specific definitions.
@@ -55,153 +54,150 @@
5554

5655
#define configTICK_SOURCE FREERTOS_USE_RTC
5756

58-
#define configUSE_PREEMPTION 1
57+
#define configUSE_PREEMPTION 1
5958
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
60-
#define configUSE_TICKLESS_IDLE 1
61-
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */
62-
#define configCPU_CLOCK_HZ ( SystemCoreClock )
63-
#define configTICK_RATE_HZ 1024
64-
#define configMAX_PRIORITIES ( 3 )
65-
#define configMINIMAL_STACK_SIZE ( 120 )
66-
#define configTOTAL_HEAP_SIZE ( 1024*16 )
67-
#define configMAX_TASK_NAME_LEN ( 4 )
68-
#define configUSE_16_BIT_TICKS 0
69-
#define configIDLE_SHOULD_YIELD 1
70-
#define configUSE_MUTEXES 1
71-
#define configUSE_RECURSIVE_MUTEXES 1
72-
#define configUSE_COUNTING_SEMAPHORES 1
73-
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
74-
#define configQUEUE_REGISTRY_SIZE 2
75-
#define configUSE_QUEUE_SETS 0
76-
#define configUSE_TIME_SLICING 0
77-
#define configUSE_NEWLIB_REENTRANT 0
78-
#define configENABLE_BACKWARD_COMPATIBILITY 1
59+
#define configUSE_TICKLESS_IDLE 1
60+
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */
61+
#define configCPU_CLOCK_HZ (SystemCoreClock)
62+
#define configTICK_RATE_HZ 1024
63+
#define configMAX_PRIORITIES (3)
64+
#define configMINIMAL_STACK_SIZE (120)
65+
#define configTOTAL_HEAP_SIZE (1024 * 16)
66+
#define configMAX_TASK_NAME_LEN (4)
67+
#define configUSE_16_BIT_TICKS 0
68+
#define configIDLE_SHOULD_YIELD 1
69+
#define configUSE_MUTEXES 1
70+
#define configUSE_RECURSIVE_MUTEXES 1
71+
#define configUSE_COUNTING_SEMAPHORES 1
72+
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
73+
#define configQUEUE_REGISTRY_SIZE 2
74+
#define configUSE_QUEUE_SETS 0
75+
#define configUSE_TIME_SLICING 0
76+
#define configUSE_NEWLIB_REENTRANT 0
77+
#define configENABLE_BACKWARD_COMPATIBILITY 1
7978

8079
/* Hook function related definitions. */
81-
#define configUSE_IDLE_HOOK 1
82-
#define configUSE_TICK_HOOK 0
83-
#define configCHECK_FOR_STACK_OVERFLOW 0
84-
#define configUSE_MALLOC_FAILED_HOOK 0
80+
#define configUSE_IDLE_HOOK 1
81+
#define configUSE_TICK_HOOK 0
82+
#define configCHECK_FOR_STACK_OVERFLOW 0
83+
#define configUSE_MALLOC_FAILED_HOOK 0
8584

8685
/* Run time and task stats gathering related definitions. */
87-
#define configGENERATE_RUN_TIME_STATS 0
88-
#define configUSE_TRACE_FACILITY 1
89-
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
86+
#define configGENERATE_RUN_TIME_STATS 0
87+
#define configUSE_TRACE_FACILITY 1
88+
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
9089

9190
/* Co-routine definitions. */
92-
#define configUSE_CO_ROUTINES 0
93-
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
91+
#define configUSE_CO_ROUTINES 0
92+
#define configMAX_CO_ROUTINE_PRIORITIES (2)
9493

9594
/* Software timer definitions. */
96-
#define configUSE_TIMERS 1
97-
#define configTIMER_TASK_PRIORITY ( 0 )
98-
#define configTIMER_QUEUE_LENGTH 32
99-
#define configTIMER_TASK_STACK_DEPTH ( 300 )
95+
#define configUSE_TIMERS 1
96+
#define configTIMER_TASK_PRIORITY (0)
97+
#define configTIMER_QUEUE_LENGTH 32
98+
#define configTIMER_TASK_STACK_DEPTH (300)
10099

101100
/* Tickless Idle configuration. */
102-
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
101+
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
103102

104103
/* Tickless idle/low power functionality. */
105104

106-
107105
/* Define to trap errors during development. */
108106
#if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
109-
#define configASSERT( x ) ASSERT(x)
107+
#define configASSERT(x) ASSERT(x)
110108
#endif
111109

112110
/* FreeRTOS MPU specific definitions. */
113-
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1
111+
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1
114112

115113
/* Optional functions - most linkers will remove unused functions anyway. */
116-
#define INCLUDE_vTaskPrioritySet 1
117-
#define INCLUDE_uxTaskPriorityGet 1
118-
#define INCLUDE_vTaskDelete 1
119-
#define INCLUDE_vTaskSuspend 1
120-
#define INCLUDE_xResumeFromISR 1
121-
#define INCLUDE_vTaskDelayUntil 1
122-
#define INCLUDE_vTaskDelay 1
123-
#define INCLUDE_xTaskGetSchedulerState 1
124-
#define INCLUDE_xTaskGetCurrentTaskHandle 1
125-
#define INCLUDE_uxTaskGetStackHighWaterMark 1
126-
#define INCLUDE_xTaskGetIdleTaskHandle 1
127-
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
128-
#define INCLUDE_pcTaskGetTaskName 1
129-
#define INCLUDE_eTaskGetState 1
130-
#define INCLUDE_xEventGroupSetBitFromISR 1
131-
#define INCLUDE_xTimerPendFunctionCall 1
114+
#define INCLUDE_vTaskPrioritySet 1
115+
#define INCLUDE_uxTaskPriorityGet 1
116+
#define INCLUDE_vTaskDelete 1
117+
#define INCLUDE_vTaskSuspend 1
118+
#define INCLUDE_xResumeFromISR 1
119+
#define INCLUDE_vTaskDelayUntil 1
120+
#define INCLUDE_vTaskDelay 1
121+
#define INCLUDE_xTaskGetSchedulerState 1
122+
#define INCLUDE_xTaskGetCurrentTaskHandle 1
123+
#define INCLUDE_uxTaskGetStackHighWaterMark 1
124+
#define INCLUDE_xTaskGetIdleTaskHandle 1
125+
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
126+
#define INCLUDE_pcTaskGetTaskName 1
127+
#define INCLUDE_eTaskGetState 1
128+
#define INCLUDE_xEventGroupSetBitFromISR 1
129+
#define INCLUDE_xTimerPendFunctionCall 1
132130

133131
/* The lowest interrupt priority that can be used in a call to a "set priority"
134132
function. */
135-
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
133+
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
136134

137135
/* The highest interrupt priority that can be used by any interrupt service
138136
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
139137
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
140138
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
141-
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY _PRIO_APP_HIGH
142-
139+
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY _PRIO_APP_HIGH
143140

144141
/* Interrupt priorities used by the kernel port layer itself. These are generic
145142
to all Cortex-M ports, and do not rely on any particular library functions. */
146-
#define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY
143+
#define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY
147144
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
148145
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
149-
#define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
146+
#define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
150147

151148
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
152149
standard names - or at least those used in the unmodified vector table. */
153150

154-
#define vPortSVCHandler SVC_Handler
155-
#define xPortPendSVHandler PendSV_Handler
156-
151+
#define vPortSVCHandler SVC_Handler
152+
#define xPortPendSVHandler PendSV_Handler
157153

158154
/*-----------------------------------------------------------
159155
* Settings that are generated automatically
160156
* basing on the settings above
161157
*/
162158
#if (configTICK_SOURCE == FREERTOS_USE_SYSTICK)
163-
// do not define configSYSTICK_CLOCK_HZ for SysTick to be configured automatically
164-
// to CPU clock source
165-
#define xPortSysTickHandler SysTick_Handler
159+
// do not define configSYSTICK_CLOCK_HZ for SysTick to be configured automatically
160+
// to CPU clock source
161+
#define xPortSysTickHandler SysTick_Handler
166162
#elif (configTICK_SOURCE == FREERTOS_USE_RTC)
167-
#define configSYSTICK_CLOCK_HZ ( 32768UL )
168-
#define xPortSysTickHandler RTC1_IRQHandler
163+
#define configSYSTICK_CLOCK_HZ (32768UL)
164+
#define xPortSysTickHandler RTC1_IRQHandler
169165
#else
170-
#error Unsupported configTICK_SOURCE value
166+
#error Unsupported configTICK_SOURCE value
171167
#endif
172168

173169
/* Code below should be only used by the compiler, and not the assembler. */
174170
#if !(defined(__ASSEMBLY__) || defined(__ASSEMBLER__))
175-
#include "nrf.h"
176-
#include "nrf_assert.h"
177-
178-
/* This part of definitions may be problematic in assembly - it uses definitions from files that are not assembly compatible. */
179-
/* Cortex-M specific definitions. */
180-
#ifdef __NVIC_PRIO_BITS
181-
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
182-
#define configPRIO_BITS __NVIC_PRIO_BITS
183-
#else
184-
#error "This port requires __NVIC_PRIO_BITS to be defined"
185-
#endif
186-
187-
/* Access to current system core clock is required only if we are ticking the system by systimer */
188-
#if (configTICK_SOURCE == FREERTOS_USE_SYSTICK)
189-
#include <stdint.h>
190-
extern uint32_t SystemCoreClock;
191-
#endif
171+
#include "nrf.h"
172+
#include "nrf_assert.h"
173+
174+
/* This part of definitions may be problematic in assembly - it uses definitions from files that are not assembly compatible. */
175+
/* Cortex-M specific definitions. */
176+
#ifdef __NVIC_PRIO_BITS
177+
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
178+
#define configPRIO_BITS __NVIC_PRIO_BITS
179+
#else
180+
#error "This port requires __NVIC_PRIO_BITS to be defined"
181+
#endif
182+
183+
/* Access to current system core clock is required only if we are ticking the system by systimer */
184+
#if (configTICK_SOURCE == FREERTOS_USE_SYSTICK)
185+
#include <stdint.h>
186+
extern uint32_t SystemCoreClock;
187+
#endif
192188
#endif /* !assembler */
193189

194190
/** Implementation note: Use this with caution and set this to 1 ONLY for debugging
195191
* ----------------------------------------------------------
196-
* Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction:
197-
* 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely
198-
* one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed
199-
* for the RTOS internal timers to be more accurate.
200-
* 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging
201-
* the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the auto-corrections of
202-
* RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go out of sync but could be
203-
* convenient for debugging.
204-
*/
205-
#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0
192+
* Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction:
193+
* 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely
194+
* one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed
195+
* for the RTOS internal timers to be more accurate.
196+
* 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging
197+
* the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the
198+
* auto-corrections of RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go
199+
* out of sync but could be convenient for debugging.
200+
*/
201+
#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0
206202

207203
#endif /* FREERTOS_CONFIG_H */

0 commit comments

Comments
 (0)