mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
always break rule (#154)
This commit is contained in:
parent
12e319e6d9
commit
ed76f702b1
14 changed files with 135 additions and 120 deletions
|
@ -1,5 +1,5 @@
|
|||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
|
|
20
core/furi.c
20
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;
|
||||
|
|
13
core/furi.h
13
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);
|
||||
|
||||
/*!
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -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 ---------------------------------------------------------*/
|
||||
/**
|
||||
|
|
|
@ -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) */
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -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 ---------------------------------------------------------*/
|
||||
/**
|
||||
|
|
|
@ -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) */
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue