From ed76f702b1f471e8a5b5f583970e35e7c01ff0ad Mon Sep 17 00:00:00 2001 From: coreglitch Date: Fri, 2 Oct 2020 09:32:11 +0300 Subject: [PATCH] always break rule (#154) --- .clang-format | 2 +- core/furi.c | 20 +++++++++++--------- core/furi.h | 13 +++++++------ core/furi_ac.c | 16 ++++++++-------- core/tty_uart.c | 17 +++++++++-------- target_f1/Src/freertos.c | 28 ++++++++++++++++------------ target_f1/Src/system_stm32l4xx.c | 25 +++++++++++++------------ target_f1/Src/usbd_cdc_if.c | 6 ++---- target_f1/Src/usbd_desc.c | 19 ++++++++++--------- target_f2/Src/freertos.c | 28 ++++++++++++++++------------ target_f2/Src/system_stm32l4xx.c | 25 +++++++++++++------------ target_f2/Src/usbd_cdc_if.c | 6 ++---- target_f2/Src/usbd_desc.c | 19 ++++++++++--------- target_lo/Src/lo_os.c | 31 +++++++++++++++++-------------- 14 files changed, 135 insertions(+), 120 deletions(-) diff --git a/.clang-format b/.clang-format index aec6434e..756e3ff9 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,5 @@ AccessModifierOffset: -4 -AlignAfterOpenBracket: Align +AlignAfterOpenBracket: AlwaysBreak AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: Left diff --git a/core/furi.c b/core/furi.c index e85f5ba8..d593314e 100644 --- a/core/furi.c +++ b/core/furi.c @@ -73,12 +73,13 @@ bool furi_create(const char* name, void* value, size_t size) { 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 printf("[FURI] opening %s record\n", name); #endif @@ -233,9 +234,10 @@ bool furi_write(FuriRecordSubscriber* handler, const void* value, size_t size) { if(handler == NULL || handler->record == NULL || value == NULL) { #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 return false; diff --git a/core/furi.h b/core/furi.h index 66aea585..dca99be0 100644 --- a/core/furi.h +++ b/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. \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); /*! diff --git a/core/furi_ac.c b/core/furi_ac.c index 6ddbb142..3c940ebf 100644 --- a/core/furi_ac.c +++ b/core/furi_ac.c @@ -44,14 +44,14 @@ FuriApp* furiac_start(FlipperApplication app, const char* name, void* param) { } // 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 task_buffer[current_buffer_idx].application = app; diff --git a/core/tty_uart.c b/core/tty_uart.c index d70e3183..17d74422 100644 --- a/core/tty_uart.c +++ b/core/tty_uart.c @@ -41,14 +41,15 @@ bool register_tty_uart() { 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); stdout = fp; diff --git a/target_f1/Src/freertos.c b/target_f1/Src/freertos.c index a62f690e..5a957dab 100644 --- a/target_f1/Src/freertos.c +++ b/target_f1/Src/freertos.c @@ -55,14 +55,16 @@ /* USER CODE END FunctionPrototypes */ /* 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) */ -void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer, - StackType_t** ppxTimerTaskStackBuffer, - uint32_t* pulTimerTaskStackSize); +void vApplicationGetTimerTaskMemory( + StaticTask_t** ppxTimerTaskTCBBuffer, + StackType_t** ppxTimerTaskStackBuffer, + uint32_t* pulTimerTaskStackSize); /* Hook prototypes */ void vApplicationIdleHook(void); @@ -85,9 +87,10 @@ __weak void vApplicationIdleHook(void) { static StaticTask_t xIdleTaskTCBBuffer; 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; *ppxIdleTaskStackBuffer = &xIdleStack[0]; *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; @@ -99,9 +102,10 @@ void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer, static StaticTask_t xTimerTaskTCBBuffer; 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; *ppxTimerTaskStackBuffer = &xTimerStack[0]; *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; diff --git a/target_f1/Src/system_stm32l4xx.c b/target_f1/Src/system_stm32l4xx.c index a16bf4c7..3e0801f1 100644 --- a/target_f1/Src/system_stm32l4xx.c +++ b/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 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}; /** * @} */ diff --git a/target_f1/Src/usbd_cdc_if.c b/target_f1/Src/usbd_cdc_if.c index 0e2bdf65..d1e50a51 100644 --- a/target_f1/Src/usbd_cdc_if.c +++ b/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 ---------------------------------------------------------*/ /** diff --git a/target_f1/Src/usbd_desc.c b/target_f1/Src/usbd_desc.c index a57103a1..68c5d9e9 100644 --- a/target_f1/Src/usbd_desc.c +++ b/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) - , - USBD_FS_USR_BOSDescriptor + , + USBD_FS_USR_BOSDescriptor #endif /* (USBD_LPM_ENABLED == 1) */ }; diff --git a/target_f2/Src/freertos.c b/target_f2/Src/freertos.c index a62f690e..5a957dab 100644 --- a/target_f2/Src/freertos.c +++ b/target_f2/Src/freertos.c @@ -55,14 +55,16 @@ /* USER CODE END FunctionPrototypes */ /* 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) */ -void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer, - StackType_t** ppxTimerTaskStackBuffer, - uint32_t* pulTimerTaskStackSize); +void vApplicationGetTimerTaskMemory( + StaticTask_t** ppxTimerTaskTCBBuffer, + StackType_t** ppxTimerTaskStackBuffer, + uint32_t* pulTimerTaskStackSize); /* Hook prototypes */ void vApplicationIdleHook(void); @@ -85,9 +87,10 @@ __weak void vApplicationIdleHook(void) { static StaticTask_t xIdleTaskTCBBuffer; 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; *ppxIdleTaskStackBuffer = &xIdleStack[0]; *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; @@ -99,9 +102,10 @@ void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer, static StaticTask_t xTimerTaskTCBBuffer; 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; *ppxTimerTaskStackBuffer = &xTimerStack[0]; *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; diff --git a/target_f2/Src/system_stm32l4xx.c b/target_f2/Src/system_stm32l4xx.c index b09e171a..f3a3580c 100644 --- a/target_f2/Src/system_stm32l4xx.c +++ b/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 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}; /** * @} */ diff --git a/target_f2/Src/usbd_cdc_if.c b/target_f2/Src/usbd_cdc_if.c index 0e2bdf65..d1e50a51 100644 --- a/target_f2/Src/usbd_cdc_if.c +++ b/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 ---------------------------------------------------------*/ /** diff --git a/target_f2/Src/usbd_desc.c b/target_f2/Src/usbd_desc.c index a57103a1..68c5d9e9 100644 --- a/target_f2/Src/usbd_desc.c +++ b/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) - , - USBD_FS_USR_BOSDescriptor + , + USBD_FS_USR_BOSDescriptor #endif /* (USBD_LPM_ENABLED == 1) */ }; diff --git a/target_lo/Src/lo_os.c b/target_lo/Src/lo_os.c index 2ada054c..bb344ee1 100644 --- a/target_lo/Src/lo_os.c +++ b/target_lo/Src/lo_os.c @@ -30,13 +30,14 @@ void* pthread_wrapper(void* p) { 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)); 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; -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 int* msgid = malloc(sizeof(int)); @@ -108,9 +110,10 @@ QueueHandle_t xQueueCreateStatic(UBaseType_t uxQueueLength, 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->take_counter = 0; pxSemaphoreBuffer->give_counter = 0;