Parcourir la source

always break rule (#154)

coreglitch il y a 5 ans
Parent
commit
ed76f702b1

+ 1 - 1
.clang-format

@@ -1,5 +1,5 @@
 AccessModifierOffset: -4
 AccessModifierOffset: -4
-AlignAfterOpenBracket: Align
+AlignAfterOpenBracket: AlwaysBreak
 AlignConsecutiveAssignments: false
 AlignConsecutiveAssignments: false
 AlignConsecutiveDeclarations: false
 AlignConsecutiveDeclarations: false
 AlignEscapedNewlines: Left
 AlignEscapedNewlines: Left

+ 11 - 9
core/furi.c

@@ -73,12 +73,13 @@ bool furi_create(const char* name, void* value, size_t size) {
     return true;
     return true;
 }
 }
 
 
-FuriRecordSubscriber* furi_open(const char* name,
-                                bool solo,
-                                bool no_mute,
-                                FlipperRecordCallback value_callback,
-                                FlipperRecordStateCallback state_callback,
-                                void* ctx) {
+FuriRecordSubscriber* furi_open(
+    const char* name,
+    bool solo,
+    bool no_mute,
+    FlipperRecordCallback value_callback,
+    FlipperRecordStateCallback state_callback,
+    void* ctx) {
 #ifdef FURI_DEBUG
 #ifdef FURI_DEBUG
     printf("[FURI] opening %s record\n", name);
     printf("[FURI] opening %s record\n", name);
 #endif
 #endif
@@ -233,9 +234,10 @@ bool furi_write(FuriRecordSubscriber* handler, const void* value, size_t size) {
 
 
     if(handler == NULL || handler->record == NULL || value == NULL) {
     if(handler == NULL || handler->record == NULL || value == NULL) {
 #ifdef FURI_DEBUG
 #ifdef FURI_DEBUG
-        printf("[FURI] write: null param %x %x\n",
-               (uint32_t)(size_t)handler,
-               (uint32_t)(size_t)value);
+        printf(
+            "[FURI] write: null param %x %x\n",
+            (uint32_t)(size_t)handler,
+            (uint32_t)(size_t)value);
 #endif
 #endif
 
 
         return false;
         return false;

+ 7 - 6
core/furi.h

@@ -109,12 +109,13 @@ When appication has exited or record has closed, all handlers is unmuted.
 It may be useful for concurrently acces to resources like framebuffer or beeper.
 It may be useful for concurrently acces to resources like framebuffer or beeper.
 \param[in] no_mute if true, another applications cannot mute this handler.
 \param[in] no_mute if true, another applications cannot mute this handler.
 */
 */
-FuriRecordSubscriber* furi_open(const char* name,
-                                bool solo,
-                                bool no_mute,
-                                FlipperRecordCallback value_callback,
-                                FlipperRecordStateCallback state_callback,
-                                void* ctx);
+FuriRecordSubscriber* furi_open(
+    const char* name,
+    bool solo,
+    bool no_mute,
+    FlipperRecordCallback value_callback,
+    FlipperRecordStateCallback state_callback,
+    void* ctx);
 
 
 /*!
 /*!
 
 

+ 8 - 8
core/furi_ac.c

@@ -44,14 +44,14 @@ FuriApp* furiac_start(FlipperApplication app, const char* name, void* param) {
     }
     }
 
 
     // create task on static stack memory
     // create task on static stack memory
-    task_buffer[current_buffer_idx].handler =
-        xTaskCreateStatic((TaskFunction_t)app,
-                          (const char* const)name,
-                          DEFAULT_STACK_SIZE / 4, // freertos specify stack size in words
-                          (void* const)param,
-                          tskIDLE_PRIORITY + 3, // normal priority
-                          stack_buffer[current_buffer_idx],
-                          &task_info_buffer[current_buffer_idx]);
+    task_buffer[current_buffer_idx].handler = xTaskCreateStatic(
+        (TaskFunction_t)app,
+        (const char* const)name,
+        DEFAULT_STACK_SIZE / 4, // freertos specify stack size in words
+        (void* const)param,
+        tskIDLE_PRIORITY + 3, // normal priority
+        stack_buffer[current_buffer_idx],
+        &task_info_buffer[current_buffer_idx]);
 
 
     // save task
     // save task
     task_buffer[current_buffer_idx].application = app;
     task_buffer[current_buffer_idx].application = app;

+ 9 - 8
core/tty_uart.c

@@ -41,14 +41,15 @@ bool register_tty_uart() {
         return false;
         return false;
     }
     }
 
 
-    FILE* fp = fopencookie(NULL,
-                           "w",
-                           (cookie_io_functions_t){
-                               .read = NULL,
-                               .write = stdout_write,
-                               .seek = NULL,
-                               .close = NULL,
-                           });
+    FILE* fp = fopencookie(
+        NULL,
+        "w",
+        (cookie_io_functions_t){
+            .read = NULL,
+            .write = stdout_write,
+            .seek = NULL,
+            .close = NULL,
+        });
     setvbuf(fp, NULL, _IONBF, 0);
     setvbuf(fp, NULL, _IONBF, 0);
     stdout = fp;
     stdout = fp;
 
 

+ 16 - 12
target_f1/Src/freertos.c

@@ -55,14 +55,16 @@
 /* USER CODE END FunctionPrototypes */
 /* USER CODE END FunctionPrototypes */
 
 
 /* GetIdleTaskMemory prototype (linked to static allocation support) */
 /* GetIdleTaskMemory prototype (linked to static allocation support) */
-void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer,
-                                   StackType_t** ppxIdleTaskStackBuffer,
-                                   uint32_t* pulIdleTaskStackSize);
+void vApplicationGetIdleTaskMemory(
+    StaticTask_t** ppxIdleTaskTCBBuffer,
+    StackType_t** ppxIdleTaskStackBuffer,
+    uint32_t* pulIdleTaskStackSize);
 
 
 /* GetTimerTaskMemory prototype (linked to static allocation support) */
 /* GetTimerTaskMemory prototype (linked to static allocation support) */
-void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer,
-                                    StackType_t** ppxTimerTaskStackBuffer,
-                                    uint32_t* pulTimerTaskStackSize);
+void vApplicationGetTimerTaskMemory(
+    StaticTask_t** ppxTimerTaskTCBBuffer,
+    StackType_t** ppxTimerTaskStackBuffer,
+    uint32_t* pulTimerTaskStackSize);
 
 
 /* Hook prototypes */
 /* Hook prototypes */
 void vApplicationIdleHook(void);
 void vApplicationIdleHook(void);
@@ -85,9 +87,10 @@ __weak void vApplicationIdleHook(void) {
 static StaticTask_t xIdleTaskTCBBuffer;
 static StaticTask_t xIdleTaskTCBBuffer;
 static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
 static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
 
 
-void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer,
-                                   StackType_t** ppxIdleTaskStackBuffer,
-                                   uint32_t* pulIdleTaskStackSize) {
+void vApplicationGetIdleTaskMemory(
+    StaticTask_t** ppxIdleTaskTCBBuffer,
+    StackType_t** ppxIdleTaskStackBuffer,
+    uint32_t* pulIdleTaskStackSize) {
     *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
     *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
     *ppxIdleTaskStackBuffer = &xIdleStack[0];
     *ppxIdleTaskStackBuffer = &xIdleStack[0];
     *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
     *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
@@ -99,9 +102,10 @@ void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer,
 static StaticTask_t xTimerTaskTCBBuffer;
 static StaticTask_t xTimerTaskTCBBuffer;
 static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH];
 static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH];
 
 
-void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer,
-                                    StackType_t** ppxTimerTaskStackBuffer,
-                                    uint32_t* pulTimerTaskStackSize) {
+void vApplicationGetTimerTaskMemory(
+    StaticTask_t** ppxTimerTaskTCBBuffer,
+    StackType_t** ppxTimerTaskStackBuffer,
+    uint32_t* pulTimerTaskStackSize) {
     *ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer;
     *ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer;
     *ppxTimerTaskStackBuffer = &xTimerStack[0];
     *ppxTimerTaskStackBuffer = &xTimerStack[0];
     *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
     *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;

+ 13 - 12
target_f1/Src/system_stm32l4xx.c

@@ -154,18 +154,19 @@ uint32_t SystemCoreClock = 4000000U;
 
 
 const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
 const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
 const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
 const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
-const uint32_t MSIRangeTable[12] = {100000U,
-                                    200000U,
-                                    400000U,
-                                    800000U,
-                                    1000000U,
-                                    2000000U,
-                                    4000000U,
-                                    8000000U,
-                                    16000000U,
-                                    24000000U,
-                                    32000000U,
-                                    48000000U};
+const uint32_t MSIRangeTable[12] = {
+    100000U,
+    200000U,
+    400000U,
+    800000U,
+    1000000U,
+    2000000U,
+    4000000U,
+    8000000U,
+    16000000U,
+    24000000U,
+    32000000U,
+    48000000U};
 /**
 /**
   * @}
   * @}
   */
   */

+ 2 - 4
target_f1/Src/usbd_cdc_if.c

@@ -139,10 +139,8 @@ static int8_t CDC_Receive_FS(uint8_t* pbuf, uint32_t* Len);
   * @}
   * @}
   */
   */
 
 
-USBD_CDC_ItfTypeDef USBD_Interface_fops_FS = {CDC_Init_FS,
-                                              CDC_DeInit_FS,
-                                              CDC_Control_FS,
-                                              CDC_Receive_FS};
+USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
+    {CDC_Init_FS, CDC_DeInit_FS, CDC_Control_FS, CDC_Receive_FS};
 
 
 /* Private functions ---------------------------------------------------------*/
 /* Private functions ---------------------------------------------------------*/
 /**
 /**

+ 10 - 9
target_f1/Src/usbd_desc.c

@@ -135,16 +135,17 @@ uint8_t* USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t* length);
   * @{
   * @{
   */
   */
 
 
-USBD_DescriptorsTypeDef FS_Desc = {USBD_FS_DeviceDescriptor,
-                                   USBD_FS_LangIDStrDescriptor,
-                                   USBD_FS_ManufacturerStrDescriptor,
-                                   USBD_FS_ProductStrDescriptor,
-                                   USBD_FS_SerialStrDescriptor,
-                                   USBD_FS_ConfigStrDescriptor,
-                                   USBD_FS_InterfaceStrDescriptor
+USBD_DescriptorsTypeDef FS_Desc = {
+    USBD_FS_DeviceDescriptor,
+    USBD_FS_LangIDStrDescriptor,
+    USBD_FS_ManufacturerStrDescriptor,
+    USBD_FS_ProductStrDescriptor,
+    USBD_FS_SerialStrDescriptor,
+    USBD_FS_ConfigStrDescriptor,
+    USBD_FS_InterfaceStrDescriptor
 #if(USBD_LPM_ENABLED == 1)
 #if(USBD_LPM_ENABLED == 1)
-                                   ,
-                                   USBD_FS_USR_BOSDescriptor
+    ,
+    USBD_FS_USR_BOSDescriptor
 #endif /* (USBD_LPM_ENABLED == 1) */
 #endif /* (USBD_LPM_ENABLED == 1) */
 };
 };
 
 

+ 16 - 12
target_f2/Src/freertos.c

@@ -55,14 +55,16 @@
 /* USER CODE END FunctionPrototypes */
 /* USER CODE END FunctionPrototypes */
 
 
 /* GetIdleTaskMemory prototype (linked to static allocation support) */
 /* GetIdleTaskMemory prototype (linked to static allocation support) */
-void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer,
-                                   StackType_t** ppxIdleTaskStackBuffer,
-                                   uint32_t* pulIdleTaskStackSize);
+void vApplicationGetIdleTaskMemory(
+    StaticTask_t** ppxIdleTaskTCBBuffer,
+    StackType_t** ppxIdleTaskStackBuffer,
+    uint32_t* pulIdleTaskStackSize);
 
 
 /* GetTimerTaskMemory prototype (linked to static allocation support) */
 /* GetTimerTaskMemory prototype (linked to static allocation support) */
-void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer,
-                                    StackType_t** ppxTimerTaskStackBuffer,
-                                    uint32_t* pulTimerTaskStackSize);
+void vApplicationGetTimerTaskMemory(
+    StaticTask_t** ppxTimerTaskTCBBuffer,
+    StackType_t** ppxTimerTaskStackBuffer,
+    uint32_t* pulTimerTaskStackSize);
 
 
 /* Hook prototypes */
 /* Hook prototypes */
 void vApplicationIdleHook(void);
 void vApplicationIdleHook(void);
@@ -85,9 +87,10 @@ __weak void vApplicationIdleHook(void) {
 static StaticTask_t xIdleTaskTCBBuffer;
 static StaticTask_t xIdleTaskTCBBuffer;
 static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
 static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
 
 
-void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer,
-                                   StackType_t** ppxIdleTaskStackBuffer,
-                                   uint32_t* pulIdleTaskStackSize) {
+void vApplicationGetIdleTaskMemory(
+    StaticTask_t** ppxIdleTaskTCBBuffer,
+    StackType_t** ppxIdleTaskStackBuffer,
+    uint32_t* pulIdleTaskStackSize) {
     *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
     *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
     *ppxIdleTaskStackBuffer = &xIdleStack[0];
     *ppxIdleTaskStackBuffer = &xIdleStack[0];
     *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
     *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
@@ -99,9 +102,10 @@ void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer,
 static StaticTask_t xTimerTaskTCBBuffer;
 static StaticTask_t xTimerTaskTCBBuffer;
 static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH];
 static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH];
 
 
-void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer,
-                                    StackType_t** ppxTimerTaskStackBuffer,
-                                    uint32_t* pulTimerTaskStackSize) {
+void vApplicationGetTimerTaskMemory(
+    StaticTask_t** ppxTimerTaskTCBBuffer,
+    StackType_t** ppxTimerTaskStackBuffer,
+    uint32_t* pulTimerTaskStackSize) {
     *ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer;
     *ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer;
     *ppxTimerTaskStackBuffer = &xTimerStack[0];
     *ppxTimerTaskStackBuffer = &xTimerStack[0];
     *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
     *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;

+ 13 - 12
target_f2/Src/system_stm32l4xx.c

@@ -156,18 +156,19 @@ uint32_t SystemCoreClock = 4000000U;
 
 
 const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
 const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
 const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
 const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
-const uint32_t MSIRangeTable[12] = {100000U,
-                                    200000U,
-                                    400000U,
-                                    800000U,
-                                    1000000U,
-                                    2000000U,
-                                    4000000U,
-                                    8000000U,
-                                    16000000U,
-                                    24000000U,
-                                    32000000U,
-                                    48000000U};
+const uint32_t MSIRangeTable[12] = {
+    100000U,
+    200000U,
+    400000U,
+    800000U,
+    1000000U,
+    2000000U,
+    4000000U,
+    8000000U,
+    16000000U,
+    24000000U,
+    32000000U,
+    48000000U};
 /**
 /**
   * @}
   * @}
   */
   */

+ 2 - 4
target_f2/Src/usbd_cdc_if.c

@@ -139,10 +139,8 @@ static int8_t CDC_Receive_FS(uint8_t* pbuf, uint32_t* Len);
   * @}
   * @}
   */
   */
 
 
-USBD_CDC_ItfTypeDef USBD_Interface_fops_FS = {CDC_Init_FS,
-                                              CDC_DeInit_FS,
-                                              CDC_Control_FS,
-                                              CDC_Receive_FS};
+USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
+    {CDC_Init_FS, CDC_DeInit_FS, CDC_Control_FS, CDC_Receive_FS};
 
 
 /* Private functions ---------------------------------------------------------*/
 /* Private functions ---------------------------------------------------------*/
 /**
 /**

+ 10 - 9
target_f2/Src/usbd_desc.c

@@ -135,16 +135,17 @@ uint8_t* USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t* length);
   * @{
   * @{
   */
   */
 
 
-USBD_DescriptorsTypeDef FS_Desc = {USBD_FS_DeviceDescriptor,
-                                   USBD_FS_LangIDStrDescriptor,
-                                   USBD_FS_ManufacturerStrDescriptor,
-                                   USBD_FS_ProductStrDescriptor,
-                                   USBD_FS_SerialStrDescriptor,
-                                   USBD_FS_ConfigStrDescriptor,
-                                   USBD_FS_InterfaceStrDescriptor
+USBD_DescriptorsTypeDef FS_Desc = {
+    USBD_FS_DeviceDescriptor,
+    USBD_FS_LangIDStrDescriptor,
+    USBD_FS_ManufacturerStrDescriptor,
+    USBD_FS_ProductStrDescriptor,
+    USBD_FS_SerialStrDescriptor,
+    USBD_FS_ConfigStrDescriptor,
+    USBD_FS_InterfaceStrDescriptor
 #if(USBD_LPM_ENABLED == 1)
 #if(USBD_LPM_ENABLED == 1)
-                                   ,
-                                   USBD_FS_USR_BOSDescriptor
+    ,
+    USBD_FS_USR_BOSDescriptor
 #endif /* (USBD_LPM_ENABLED == 1) */
 #endif /* (USBD_LPM_ENABLED == 1) */
 };
 };
 
 

+ 17 - 14
target_lo/Src/lo_os.c

@@ -30,13 +30,14 @@ void* pthread_wrapper(void* p) {
     return NULL;
     return NULL;
 }
 }
 
 
-TaskHandle_t xTaskCreateStatic(TaskFunction_t pxTaskCode,
-                               const char* const pcName,
-                               const uint32_t ulStackDepth,
-                               void* const pvParameters,
-                               UBaseType_t uxPriority,
-                               StackType_t* const puxStackBuffer,
-                               StaticTask_t* const pxTaskBuffer) {
+TaskHandle_t xTaskCreateStatic(
+    TaskFunction_t pxTaskCode,
+    const char* const pcName,
+    const uint32_t ulStackDepth,
+    void* const pvParameters,
+    UBaseType_t uxPriority,
+    StackType_t* const puxStackBuffer,
+    StaticTask_t* const pxTaskBuffer) {
     TaskHandle_t thread = malloc(sizeof(TaskHandle_t));
     TaskHandle_t thread = malloc(sizeof(TaskHandle_t));
     PthreadTask* task = malloc(sizeof(PthreadTask));
     PthreadTask* task = malloc(sizeof(PthreadTask));
 
 
@@ -93,10 +94,11 @@ BaseType_t xQueueReceive(QueueHandle_t xQueue, void* pvBuffer, TickType_t xTicks
 
 
 static uint32_t queue_global_id = 0;
 static uint32_t queue_global_id = 0;
 
 
-QueueHandle_t xQueueCreateStatic(UBaseType_t uxQueueLength,
-                                 UBaseType_t uxItemSize,
-                                 uint8_t* pucQueueStorageBuffer,
-                                 StaticQueue_t* pxQueueBuffer) {
+QueueHandle_t xQueueCreateStatic(
+    UBaseType_t uxQueueLength,
+    UBaseType_t uxItemSize,
+    uint8_t* pucQueueStorageBuffer,
+    StaticQueue_t* pxQueueBuffer) {
     // TODO: check this implementation
     // TODO: check this implementation
     int* msgid = malloc(sizeof(int));
     int* msgid = malloc(sizeof(int));
 
 
@@ -108,9 +110,10 @@ QueueHandle_t xQueueCreateStatic(UBaseType_t uxQueueLength,
     return (QueueHandle_t)msgid;
     return (QueueHandle_t)msgid;
 }
 }
 
 
-SemaphoreHandle_t xSemaphoreCreateCountingStatic(UBaseType_t uxMaxCount,
-                                                 UBaseType_t uxInitialCount,
-                                                 StaticSemaphore_t* pxSemaphoreBuffer) {
+SemaphoreHandle_t xSemaphoreCreateCountingStatic(
+    UBaseType_t uxMaxCount,
+    UBaseType_t uxInitialCount,
+    StaticSemaphore_t* pxSemaphoreBuffer) {
     pxSemaphoreBuffer->type = SemaphoreTypeCounting;
     pxSemaphoreBuffer->type = SemaphoreTypeCounting;
     pxSemaphoreBuffer->take_counter = 0;
     pxSemaphoreBuffer->take_counter = 0;
     pxSemaphoreBuffer->give_counter = 0;
     pxSemaphoreBuffer->give_counter = 0;