mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-21 19:05:06 +00:00
code style aligned
added .clang-format and updated projects Furi and NanoBake with it
This commit is contained in:
parent
c4a576e4af
commit
6282011634
67
.clang-format
Normal file
67
.clang-format
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# Generated from CLion C/C++ Code Style settings
|
||||||
|
# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: BlockIndent
|
||||||
|
AlignConsecutiveAssignments: None
|
||||||
|
AlignOperands: Align
|
||||||
|
AllowAllArgumentsOnNextLine: false
|
||||||
|
AllowAllConstructorInitializersOnNextLine: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: Always
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
ColumnLimit: 0
|
||||||
|
CompactNamespaces: false
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentWidth: 4
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
NamespaceIndentation: All
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReflowComments: false
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCpp11BracedList: true
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <furi_config.h>
|
#include <furi_config.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -6,8 +6,10 @@
|
|||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
PLACE_IN_SECTION("MB_MEM2") const char* __furi_check_message = NULL;
|
PLACE_IN_SECTION("MB_MEM2")
|
||||||
PLACE_IN_SECTION("MB_MEM2") uint32_t __furi_check_registers[13] = {0};
|
const char* __furi_check_message = NULL;
|
||||||
|
PLACE_IN_SECTION("MB_MEM2")
|
||||||
|
uint32_t __furi_check_registers[13] = {0};
|
||||||
|
|
||||||
/** Load r12 value to __furi_check_message and store registers to __furi_check_registers */
|
/** Load r12 value to __furi_check_message and store registers to __furi_check_registers */
|
||||||
/*#define GET_MESSAGE_AND_STORE_REGISTERS() \
|
/*#define GET_MESSAGE_AND_STORE_REGISTERS() \
|
||||||
@ -79,22 +81,26 @@ static void __furi_print_stack_info() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void __furi_print_bt_stack_info() {
|
static void __furi_print_bt_stack_info() {
|
||||||
// const FuriHalBtHardfaultInfo* fault_info = furi_hal_bt_get_hardfault_info();
|
/*
|
||||||
// if(fault_info == NULL) {
|
const FuriHalBtHardfaultInfo* fault_info = furi_hal_bt_get_hardfault_info();
|
||||||
// furi_hal_console_puts("\r\n\tcore2: not faulted");
|
if(fault_info == NULL) {
|
||||||
// } else {
|
furi_hal_console_puts("\r\n\tcore2: not faulted");
|
||||||
// furi_hal_console_puts("\r\n\tcore2: hardfaulted.\r\n\tPC: ");
|
} else {
|
||||||
// __furi_put_uint32_as_hex(fault_info->source_pc);
|
furi_hal_console_puts("\r\n\tcore2: hardfaulted.\r\n\tPC: ");
|
||||||
// furi_hal_console_puts("\r\n\tLR: ");
|
__furi_put_uint32_as_hex(fault_info->source_pc);
|
||||||
// __furi_put_uint32_as_hex(fault_info->source_lr);
|
furi_hal_console_puts("\r\n\tLR: ");
|
||||||
// furi_hal_console_puts("\r\n\tSP: ");
|
__furi_put_uint32_as_hex(fault_info->source_lr);
|
||||||
// __furi_put_uint32_as_hex(fault_info->source_sp);
|
furi_hal_console_puts("\r\n\tSP: ");
|
||||||
// }
|
__furi_put_uint32_as_hex(fault_info->source_sp);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __furi_print_heap_info() {
|
static void __furi_print_heap_info() {
|
||||||
// furi_hal_console_puts("\r\n\t heap total: ");
|
/*
|
||||||
// __furi_put_uint32_as_text(xPortGetTotalHeapSize());
|
furi_hal_console_puts("\r\n\t heap total: ");
|
||||||
|
__furi_put_uint32_as_text(xPortGetTotalHeapSize());
|
||||||
|
*/
|
||||||
furi_hal_console_puts("\r\n\t heap free: ");
|
furi_hal_console_puts("\r\n\t heap free: ");
|
||||||
__furi_put_uint32_as_text(xPortGetFreeHeapSize());
|
__furi_put_uint32_as_text(xPortGetFreeHeapSize());
|
||||||
furi_hal_console_puts("\r\n\t heap watermark: ");
|
furi_hal_console_puts("\r\n\t heap watermark: ");
|
||||||
|
|||||||
@ -13,8 +13,8 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <m-core.h>
|
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
#include <m-core.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "event_flag.h"
|
#include "event_flag.h"
|
||||||
#include "common_defines.h"
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "common_defines.h"
|
||||||
|
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/event_groups.h>
|
#include <freertos/event_groups.h>
|
||||||
@ -92,7 +92,8 @@ uint32_t furi_event_flag_wait(
|
|||||||
FuriEventFlag* instance,
|
FuriEventFlag* instance,
|
||||||
uint32_t flags,
|
uint32_t flags,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
uint32_t timeout) {
|
uint32_t timeout
|
||||||
|
) {
|
||||||
furi_assert(!FURI_IS_IRQ_MODE());
|
furi_assert(!FURI_IS_IRQ_MODE());
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
furi_assert((flags & FURI_EVENT_FLAG_INVALID_BITS) == 0U);
|
furi_assert((flags & FURI_EVENT_FLAG_INVALID_BITS) == 0U);
|
||||||
@ -115,7 +116,8 @@ uint32_t furi_event_flag_wait(
|
|||||||
}
|
}
|
||||||
|
|
||||||
rflags = xEventGroupWaitBits(
|
rflags = xEventGroupWaitBits(
|
||||||
hEventGroup, (EventBits_t)flags, exit_clr, wait_all, (TickType_t)timeout);
|
hEventGroup, (EventBits_t)flags, exit_clr, wait_all, (TickType_t)timeout
|
||||||
|
);
|
||||||
|
|
||||||
if (options & FuriFlagWaitAll) {
|
if (options & FuriFlagWaitAll) {
|
||||||
if ((flags & rflags) != flags) {
|
if ((flags & rflags) != flags) {
|
||||||
|
|||||||
@ -63,7 +63,8 @@ uint32_t furi_event_flag_wait(
|
|||||||
FuriEventFlag* instance,
|
FuriEventFlag* instance,
|
||||||
uint32_t flags,
|
uint32_t flags,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
uint32_t timeout);
|
uint32_t timeout
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,18 +2,12 @@
|
|||||||
#include "common_defines.h"
|
#include "common_defines.h"
|
||||||
#include "furi_string.h"
|
#include "furi_string.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define TAG "FuriHalConsole"
|
#define TAG "FuriHalConsole"
|
||||||
|
|
||||||
#ifdef HEAP_PRINT_DEBUG
|
|
||||||
#define CONSOLE_BAUDRATE 1843200
|
|
||||||
#else
|
|
||||||
#define CONSOLE_BAUDRATE 230400
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool alive;
|
bool alive;
|
||||||
FuriHalConsoleTxCallback tx_callback;
|
FuriHalConsoleTxCallback tx_callback;
|
||||||
@ -27,21 +21,14 @@ FuriHalConsole furi_hal_console = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void furi_hal_console_init() {
|
void furi_hal_console_init() {
|
||||||
// furi_hal_uart_init(FuriHalUartIdUSART1, CONSOLE_BAUDRATE);
|
|
||||||
furi_hal_console.alive = true;
|
furi_hal_console.alive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void furi_hal_console_enable() {
|
void furi_hal_console_enable() {
|
||||||
// furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, NULL, NULL);
|
|
||||||
// while(!LL_USART_IsActiveFlag_TC(USART1))
|
|
||||||
// ;
|
|
||||||
// furi_hal_uart_set_br(FuriHalUartIdUSART1, CONSOLE_BAUDRATE);
|
|
||||||
furi_hal_console.alive = true;
|
furi_hal_console.alive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void furi_hal_console_disable() {
|
void furi_hal_console_disable() {
|
||||||
// while(!LL_USART_IsActiveFlag_TC(USART1))
|
|
||||||
// ;
|
|
||||||
furi_hal_console.alive = false;
|
furi_hal_console.alive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +43,6 @@ void furi_hal_console_tx(const uint8_t* buffer, size_t buffer_size) {
|
|||||||
if (!furi_hal_console.alive) return;
|
if (!furi_hal_console.alive) return;
|
||||||
|
|
||||||
FURI_CRITICAL_ENTER();
|
FURI_CRITICAL_ENTER();
|
||||||
// Transmit data
|
|
||||||
|
|
||||||
if (furi_hal_console.tx_callback) {
|
if (furi_hal_console.tx_callback) {
|
||||||
furi_hal_console.tx_callback(buffer, buffer_size, furi_hal_console.tx_callback_context);
|
furi_hal_console.tx_callback(buffer, buffer_size, furi_hal_console.tx_callback_context);
|
||||||
}
|
}
|
||||||
@ -67,10 +52,6 @@ void furi_hal_console_tx(const uint8_t* buffer, size_t buffer_size) {
|
|||||||
safe_buffer[buffer_size] = 0;
|
safe_buffer[buffer_size] = 0;
|
||||||
|
|
||||||
ESP_LOGI(TAG, "%s", safe_buffer);
|
ESP_LOGI(TAG, "%s", safe_buffer);
|
||||||
// furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t*)buffer, buffer_size);
|
|
||||||
//// Wait for TC flag to be raised for last char
|
|
||||||
// while(!LL_USART_IsActiveFlag_TC(USART1))
|
|
||||||
// ;
|
|
||||||
FURI_CRITICAL_EXIT();
|
FURI_CRITICAL_EXIT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,13 +65,6 @@ void furi_hal_console_tx_with_new_line(const uint8_t* buffer, size_t buffer_size
|
|||||||
safe_buffer[buffer_size] = 0;
|
safe_buffer[buffer_size] = 0;
|
||||||
ESP_LOGI(TAG, "%s", safe_buffer);
|
ESP_LOGI(TAG, "%s", safe_buffer);
|
||||||
|
|
||||||
// Transmit data
|
|
||||||
// furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t*)buffer, buffer_size);
|
|
||||||
// Transmit new line symbols
|
|
||||||
// furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t*)"\r\n", 2);
|
|
||||||
// Wait for TC flag to be raised for last char
|
|
||||||
// while(!LL_USART_IsActiveFlag_TC(USART1))
|
|
||||||
// ;
|
|
||||||
FURI_CRITICAL_EXIT();
|
FURI_CRITICAL_EXIT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,11 +4,11 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <m-core.h>
|
#include <m-core.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -418,7 +418,8 @@ size_t furi_string_replace_str(
|
|||||||
FuriString* string,
|
FuriString* string,
|
||||||
const char needle[],
|
const char needle[],
|
||||||
const char replace[],
|
const char replace[],
|
||||||
size_t start);
|
size_t start
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Replace all occurrences of 'needle' string into 'replace' string.
|
* @brief Replace all occurrences of 'needle' string into 'replace' string.
|
||||||
@ -429,7 +430,8 @@ size_t furi_string_replace_str(
|
|||||||
void furi_string_replace_all(
|
void furi_string_replace_all(
|
||||||
FuriString* string,
|
FuriString* string,
|
||||||
const FuriString* needle,
|
const FuriString* needle,
|
||||||
const FuriString* replace);
|
const FuriString* replace
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Replace all occurrences of 'needle' C string into 'replace' C string.
|
* @brief Replace all occurrences of 'needle' C string into 'replace' C string.
|
||||||
@ -638,7 +640,8 @@ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnico
|
|||||||
FURI_STRING_SELECT3, \
|
FURI_STRING_SELECT3, \
|
||||||
furi_string_search, \
|
furi_string_search, \
|
||||||
furi_string_search_str, \
|
furi_string_search_str, \
|
||||||
M_DEFAULT_ARGS(3, (0), __VA_ARGS__))
|
M_DEFAULT_ARGS(3, (0), __VA_ARGS__) \
|
||||||
|
)
|
||||||
/**
|
/**
|
||||||
* @brief Search for a C string in a string
|
* @brief Search for a C string in a string
|
||||||
* (string, cstring[, start=0])
|
* (string, cstring[, start=0])
|
||||||
@ -692,7 +695,8 @@ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnico
|
|||||||
FURI_STRING_SELECT4, \
|
FURI_STRING_SELECT4, \
|
||||||
furi_string_replace, \
|
furi_string_replace, \
|
||||||
furi_string_replace_str, \
|
furi_string_replace_str, \
|
||||||
M_DEFAULT_ARGS(4, (0), __VA_ARGS__))
|
M_DEFAULT_ARGS(4, (0), __VA_ARGS__) \
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Replace a C string to another C string in a string.
|
* @brief Replace a C string to another C string in a string.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "kernel.h"
|
|
||||||
#include "message_queue.h"
|
#include "message_queue.h"
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "kernel.h"
|
||||||
|
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/queue.h>
|
#include <freertos/queue.h>
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
#include "record.h"
|
#include "record.h"
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "mutex.h"
|
|
||||||
#include "event_flag.h"
|
#include "event_flag.h"
|
||||||
|
#include "mutex.h"
|
||||||
|
|
||||||
#include <m-dict.h>
|
|
||||||
#include "m_cstr_dup.h"
|
#include "m_cstr_dup.h"
|
||||||
|
#include <m-dict.h>
|
||||||
|
|
||||||
#define FURI_RECORD_FLAG_READY (0x1)
|
#define FURI_RECORD_FLAG_READY (0x1)
|
||||||
|
|
||||||
@ -127,7 +127,9 @@ void* furi_record_open(const char* name) {
|
|||||||
record_data->flags,
|
record_data->flags,
|
||||||
FURI_RECORD_FLAG_READY,
|
FURI_RECORD_FLAG_READY,
|
||||||
FuriFlagWaitAny | FuriFlagNoClear,
|
FuriFlagWaitAny | FuriFlagNoClear,
|
||||||
FuriWaitForever) == FURI_RECORD_FLAG_READY);
|
FuriWaitForever
|
||||||
|
) == FURI_RECORD_FLAG_READY
|
||||||
|
);
|
||||||
|
|
||||||
return record_data->data;
|
return record_data->data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "core_defines.h"
|
#include "core_defines.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -21,7 +21,7 @@ extern "C" {
|
|||||||
#define FURI_RECORD_TRANSACTION(record_name, variable_name, code) \
|
#define FURI_RECORD_TRANSACTION(record_name, variable_name, code) \
|
||||||
{ \
|
{ \
|
||||||
NbGui*(variable_name) = (NbGui*)furi_record_open(record_name); \
|
NbGui*(variable_name) = (NbGui*)furi_record_open(record_name); \
|
||||||
code \
|
code; \
|
||||||
furi_record_close(record_name); \
|
furi_record_close(record_name); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
#include "stream_buffer.h"
|
||||||
#include "base.h"
|
#include "base.h"
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "stream_buffer.h"
|
|
||||||
#include "common_defines.h"
|
#include "common_defines.h"
|
||||||
|
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
@ -29,7 +29,8 @@ size_t furi_stream_buffer_send(
|
|||||||
FuriStreamBuffer* stream_buffer,
|
FuriStreamBuffer* stream_buffer,
|
||||||
const void* data,
|
const void* data,
|
||||||
size_t length,
|
size_t length,
|
||||||
uint32_t timeout) {
|
uint32_t timeout
|
||||||
|
) {
|
||||||
size_t ret;
|
size_t ret;
|
||||||
|
|
||||||
if (FURI_IS_IRQ_MODE()) {
|
if (FURI_IS_IRQ_MODE()) {
|
||||||
@ -47,7 +48,8 @@ size_t furi_stream_buffer_receive(
|
|||||||
FuriStreamBuffer* stream_buffer,
|
FuriStreamBuffer* stream_buffer,
|
||||||
void* data,
|
void* data,
|
||||||
size_t length,
|
size_t length,
|
||||||
uint32_t timeout) {
|
uint32_t timeout
|
||||||
|
) {
|
||||||
size_t ret;
|
size_t ret;
|
||||||
|
|
||||||
if (FURI_IS_IRQ_MODE()) {
|
if (FURI_IS_IRQ_MODE()) {
|
||||||
|
|||||||
@ -12,8 +12,10 @@
|
|||||||
* interrupt that will read from the buffer (the reader).
|
* interrupt that will read from the buffer (the reader).
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "base.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -72,7 +74,8 @@ size_t furi_stream_buffer_send(
|
|||||||
FuriStreamBuffer* stream_buffer,
|
FuriStreamBuffer* stream_buffer,
|
||||||
const void* data,
|
const void* data,
|
||||||
size_t length,
|
size_t length,
|
||||||
uint32_t timeout);
|
uint32_t timeout
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Receives bytes from a stream buffer.
|
* @brief Receives bytes from a stream buffer.
|
||||||
@ -93,7 +96,8 @@ size_t furi_stream_buffer_receive(
|
|||||||
FuriStreamBuffer* stream_buffer,
|
FuriStreamBuffer* stream_buffer,
|
||||||
void* data,
|
void* data,
|
||||||
size_t length,
|
size_t length,
|
||||||
uint32_t timeout);
|
uint32_t timeout
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Queries a stream buffer to see how much data it contains, which is equal to
|
* @brief Queries a stream buffer to see how much data it contains, which is equal to
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "kernel.h"
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "common_defines.h"
|
#include "common_defines.h"
|
||||||
#include "furi_string.h"
|
#include "furi_string.h"
|
||||||
|
#include "kernel.h"
|
||||||
|
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|
||||||
@ -15,6 +15,13 @@
|
|||||||
|
|
||||||
#define THREAD_NOTIFY_INDEX 1 // Index 0 is used for stream buffers
|
#define THREAD_NOTIFY_INDEX 1 // Index 0 is used for stream buffers
|
||||||
|
|
||||||
|
// Limits
|
||||||
|
#define MAX_BITS_TASK_NOTIFY 31U
|
||||||
|
#define MAX_BITS_EVENT_GROUPS 24U
|
||||||
|
|
||||||
|
#define THREAD_FLAGS_INVALID_BITS (~((1UL << MAX_BITS_TASK_NOTIFY) - 1U))
|
||||||
|
#define EVENT_FLAGS_INVALID_BITS (~((1UL << MAX_BITS_EVENT_GROUPS) - 1U))
|
||||||
|
|
||||||
typedef struct FuriThreadStdout FuriThreadStdout;
|
typedef struct FuriThreadStdout FuriThreadStdout;
|
||||||
|
|
||||||
struct FuriThreadStdout {
|
struct FuriThreadStdout {
|
||||||
@ -81,24 +88,28 @@ static void furi_thread_body(void* context) {
|
|||||||
furi_assert(thread->state == FuriThreadStateStarting);
|
furi_assert(thread->state == FuriThreadStateStarting);
|
||||||
furi_thread_set_state(thread, FuriThreadStateRunning);
|
furi_thread_set_state(thread, FuriThreadStateRunning);
|
||||||
|
|
||||||
// TaskHandle_t task_handle = xTaskGetCurrentTaskHandle();
|
/*
|
||||||
// if(thread->heap_trace_enabled == true) {
|
TaskHandle_t task_handle = xTaskGetCurrentTaskHandle();
|
||||||
// memmgr_heap_enable_thread_trace((FuriThreadId)task_handle);
|
if(thread->heap_trace_enabled == true) {
|
||||||
// }
|
memmgr_heap_enable_thread_trace((FuriThreadId)task_handle);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
thread->ret = thread->callback(thread->context);
|
thread->ret = thread->callback(thread->context);
|
||||||
|
|
||||||
// if(thread->heap_trace_enabled == true) {
|
/*
|
||||||
// furi_delay_ms(33);
|
if(thread->heap_trace_enabled == true) {
|
||||||
// thread->heap_size = memmgr_heap_get_thread_memory((FuriThreadId)task_handle);
|
furi_delay_ms(33);
|
||||||
// furi_log_print_format(
|
thread->heap_size = memmgr_heap_get_thread_memory((FuriThreadId)task_handle);
|
||||||
// thread->heap_size ? FuriLogLevelError : FuriLogLevelInfo,
|
furi_log_print_format(
|
||||||
// TAG,
|
thread->heap_size ? FuriLogLevelError : FuriLogLevelInfo,
|
||||||
// "%s allocation balance: %zu",
|
TAG,
|
||||||
// thread->name ? thread->name : "Thread",
|
"%s allocation balance: %zu",
|
||||||
// thread->heap_size);
|
thread->name ? thread->name : "Thread",
|
||||||
// memmgr_heap_disable_thread_trace((FuriThreadId)task_handle);
|
thread->heap_size);
|
||||||
// }
|
memmgr_heap_disable_thread_trace((FuriThreadId)task_handle);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
furi_assert(thread->state == FuriThreadStateRunning);
|
furi_assert(thread->state == FuriThreadStateRunning);
|
||||||
|
|
||||||
@ -106,7 +117,8 @@ static void furi_thread_body(void* context) {
|
|||||||
ESP_LOGI(
|
ESP_LOGI(
|
||||||
TAG,
|
TAG,
|
||||||
"%s service thread TCB memory will not be reclaimed",
|
"%s service thread TCB memory will not be reclaimed",
|
||||||
thread->name ? thread->name : "<unnamed service>");
|
thread->name ? thread->name : "<unnamed service>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// flush stdout
|
// flush stdout
|
||||||
@ -145,7 +157,8 @@ FuriThread* furi_thread_alloc() {
|
|||||||
thread->heap_trace_enabled = true;
|
thread->heap_trace_enabled = true;
|
||||||
} else if(mode == FuriHalRtcHeapTrackModeTree && furi_thread_get_current_id()) {
|
} else if(mode == FuriHalRtcHeapTrackModeTree && furi_thread_get_current_id()) {
|
||||||
if(parent) thread->heap_trace_enabled = parent->heap_trace_enabled;
|
if(parent) thread->heap_trace_enabled = parent->heap_trace_enabled;
|
||||||
} else */{
|
} else */
|
||||||
|
{
|
||||||
thread->heap_trace_enabled = false;
|
thread->heap_trace_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +169,8 @@ FuriThread* furi_thread_alloc_ex(
|
|||||||
const char* name,
|
const char* name,
|
||||||
uint32_t stack_size,
|
uint32_t stack_size,
|
||||||
FuriThreadCallback callback,
|
FuriThreadCallback callback,
|
||||||
void* context) {
|
void* context
|
||||||
|
) {
|
||||||
FuriThread* thread = furi_thread_alloc();
|
FuriThread* thread = furi_thread_alloc();
|
||||||
furi_thread_set_name(thread, name);
|
furi_thread_set_name(thread, name);
|
||||||
furi_thread_set_stack_size(thread, stack_size);
|
furi_thread_set_stack_size(thread, stack_size);
|
||||||
@ -275,10 +289,12 @@ void furi_thread_start(FuriThread* thread) {
|
|||||||
thread,
|
thread,
|
||||||
priority,
|
priority,
|
||||||
malloc(sizeof(StackType_t) * stack),
|
malloc(sizeof(StackType_t) * stack),
|
||||||
malloc(sizeof(StaticTask_t)));
|
malloc(sizeof(StaticTask_t))
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
BaseType_t ret = xTaskCreate(
|
BaseType_t ret = xTaskCreate(
|
||||||
furi_thread_body, thread->name, stack, thread, priority, &thread->task_handle);
|
furi_thread_body, thread->name, stack, thread, priority, &thread->task_handle
|
||||||
|
);
|
||||||
furi_check(ret == pdPASS);
|
furi_check(ret == pdPASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,13 +370,6 @@ void furi_thread_yield() {
|
|||||||
taskYIELD();
|
taskYIELD();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Limits */
|
|
||||||
#define MAX_BITS_TASK_NOTIFY 31U
|
|
||||||
#define MAX_BITS_EVENT_GROUPS 24U
|
|
||||||
|
|
||||||
#define THREAD_FLAGS_INVALID_BITS (~((1UL << MAX_BITS_TASK_NOTIFY) - 1U))
|
|
||||||
#define EVENT_FLAGS_INVALID_BITS (~((1UL << MAX_BITS_EVENT_GROUPS) - 1U))
|
|
||||||
|
|
||||||
uint32_t furi_thread_flags_set(FuriThreadId thread_id, uint32_t flags) {
|
uint32_t furi_thread_flags_set(FuriThreadId thread_id, uint32_t flags) {
|
||||||
TaskHandle_t hTask = (TaskHandle_t)thread_id;
|
TaskHandle_t hTask = (TaskHandle_t)thread_id;
|
||||||
uint32_t rflags;
|
uint32_t rflags;
|
||||||
@ -376,7 +385,8 @@ uint32_t furi_thread_flags_set(FuriThreadId thread_id, uint32_t flags) {
|
|||||||
|
|
||||||
(void)xTaskNotifyIndexedFromISR(hTask, THREAD_NOTIFY_INDEX, flags, eSetBits, &yield);
|
(void)xTaskNotifyIndexedFromISR(hTask, THREAD_NOTIFY_INDEX, flags, eSetBits, &yield);
|
||||||
(void)xTaskNotifyAndQueryIndexedFromISR(
|
(void)xTaskNotifyAndQueryIndexedFromISR(
|
||||||
hTask, THREAD_NOTIFY_INDEX, 0, eNoAction, &rflags, NULL);
|
hTask, THREAD_NOTIFY_INDEX, 0, eNoAction, &rflags, NULL
|
||||||
|
);
|
||||||
|
|
||||||
portYIELD_FROM_ISR(yield);
|
portYIELD_FROM_ISR(yield);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
#include "base.h"
|
#include "base.h"
|
||||||
#include "common_defines.h"
|
#include "common_defines.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -76,7 +76,8 @@ FuriThread* furi_thread_alloc_ex(
|
|||||||
const char* name,
|
const char* name,
|
||||||
uint32_t stack_size,
|
uint32_t stack_size,
|
||||||
FuriThreadCallback callback,
|
FuriThreadCallback callback,
|
||||||
void* context);
|
void* context
|
||||||
|
);
|
||||||
|
|
||||||
/** Release FuriThread
|
/** Release FuriThread
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "desktop.h"
|
#include "desktop.h"
|
||||||
#include "nb_hardware.h"
|
|
||||||
#include "core_defines.h"
|
#include "core_defines.h"
|
||||||
|
#include "nb_hardware.h"
|
||||||
|
|
||||||
static int32_t prv_desktop_main(void* param) {
|
static int32_t prv_desktop_main(void* param) {
|
||||||
UNUSED(param);
|
UNUSED(param);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "gui_i.h"
|
|
||||||
#include "core_defines.h"
|
|
||||||
#include "record.h"
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "core_defines.h"
|
||||||
|
#include "gui_i.h"
|
||||||
|
#include "record.h"
|
||||||
|
|
||||||
#define TAG "gui"
|
#define TAG "gui"
|
||||||
|
|
||||||
@ -100,9 +100,11 @@ void gui_remove_view_port(NbGui* gui, ViewPort* view_port) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if(gui->ongoing_input_view_port == view_port) {
|
/*
|
||||||
// gui->ongoing_input_view_port = NULL;
|
if(gui->ongoing_input_view_port == view_port) {
|
||||||
// }
|
gui->ongoing_input_view_port = NULL;
|
||||||
|
}
|
||||||
|
*/
|
||||||
gui_unlock(gui);
|
gui_unlock(gui);
|
||||||
|
|
||||||
// Request redraw
|
// Request redraw
|
||||||
@ -213,13 +215,13 @@ __attribute((__noreturn__)) int32_t prv_gui_main(void* parameter) {
|
|||||||
FuriWaitForever
|
FuriWaitForever
|
||||||
);
|
);
|
||||||
// Process and dispatch input
|
// Process and dispatch input
|
||||||
if (flags & GUI_THREAD_FLAG_INPUT) {
|
/*if (flags & GUI_THREAD_FLAG_INPUT) {
|
||||||
// // Process till queue become empty
|
// Process till queue become empty
|
||||||
// InputEvent input_event;
|
InputEvent input_event;
|
||||||
// while(furi_message_queue_get(gui->input_queue, &input_event, 0) == FuriStatusOk) {
|
while(furi_message_queue_get(gui->input_queue, &input_event, 0) == FuriStatusOk) {
|
||||||
// gui_input(gui, &input_event);
|
gui_input(gui, &input_event);
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
// Process and dispatch draw call
|
// Process and dispatch draw call
|
||||||
if (flags & GUI_THREAD_FLAG_DRAW) {
|
if (flags & GUI_THREAD_FLAG_DRAW) {
|
||||||
// Clear flags that arrived on input step
|
// Clear flags that arrived on input step
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "view_port.h"
|
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "nb_app.h"
|
#include "nb_app.h"
|
||||||
|
#include "view_port.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -37,7 +37,8 @@ typedef void (*GuiCanvasCommitCallback)(
|
|||||||
uint8_t* data,
|
uint8_t* data,
|
||||||
size_t size,
|
size_t size,
|
||||||
CanvasOrientation orientation,
|
CanvasOrientation orientation,
|
||||||
void* context);
|
void* context
|
||||||
|
);
|
||||||
|
|
||||||
#define RECORD_GUI "gui"
|
#define RECORD_GUI "gui"
|
||||||
|
|
||||||
|
|||||||
@ -1,169 +1,175 @@
|
|||||||
#include "gui_i.h"
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "gui_i.h"
|
||||||
|
|
||||||
static void gui_redraw_status_bar(NbGui* gui, bool need_attention) {
|
static void gui_redraw_status_bar(NbGui* gui, bool need_attention) {
|
||||||
// ViewPortArray_it_t it;
|
/*
|
||||||
// uint8_t left_used = 0;
|
ViewPortArray_it_t it;
|
||||||
// uint8_t right_used = 0;
|
uint8_t left_used = 0;
|
||||||
// uint8_t width;
|
uint8_t right_used = 0;
|
||||||
//
|
uint8_t width;
|
||||||
// canvas_frame_set(
|
|
||||||
// gui->lvgl_parent, GUI_STATUS_BAR_X, GUI_STATUS_BAR_Y, GUI_DISPLAY_WIDTH, GUI_STATUS_BAR_HEIGHT);
|
canvas_frame_set(
|
||||||
//
|
gui->lvgl_parent, GUI_STATUS_BAR_X, GUI_STATUS_BAR_Y, GUI_DISPLAY_WIDTH, GUI_STATUS_BAR_HEIGHT);
|
||||||
// /* for support black theme - paint white area and
|
|
||||||
// * draw icon with transparent white color
|
// for support black theme - paint white area and
|
||||||
// */
|
// draw icon with transparent white color
|
||||||
// canvas_set_color(gui->canvas, ColorWhite);
|
|
||||||
// canvas_draw_box(gui->canvas, 1, 1, 9, 7);
|
canvas_set_color(gui->canvas, ColorWhite);
|
||||||
// canvas_draw_box(gui->canvas, 7, 3, 58, 6);
|
canvas_draw_box(gui->canvas, 1, 1, 9, 7);
|
||||||
// canvas_draw_box(gui->canvas, 61, 1, 32, 7);
|
canvas_draw_box(gui->canvas, 7, 3, 58, 6);
|
||||||
// canvas_draw_box(gui->canvas, 89, 3, 38, 6);
|
canvas_draw_box(gui->canvas, 61, 1, 32, 7);
|
||||||
// canvas_set_color(gui->canvas, ColorBlack);
|
canvas_draw_box(gui->canvas, 89, 3, 38, 6);
|
||||||
// canvas_set_bitmap_mode(gui->canvas, 1);
|
canvas_set_color(gui->canvas, ColorBlack);
|
||||||
// canvas_draw_icon(gui->canvas, 0, 0, &I_Background_128x11);
|
canvas_set_bitmap_mode(gui->canvas, 1);
|
||||||
// canvas_set_bitmap_mode(gui->canvas, 0);
|
canvas_draw_icon(gui->canvas, 0, 0, &I_Background_128x11);
|
||||||
//
|
canvas_set_bitmap_mode(gui->canvas, 0);
|
||||||
// // Right side
|
|
||||||
// uint8_t x = GUI_DISPLAY_WIDTH - 1;
|
// Right side
|
||||||
// ViewPortArray_it(it, gui->layers[GuiLayerStatusBarRight]);
|
uint8_t x = GUI_DISPLAY_WIDTH - 1;
|
||||||
// while(!ViewPortArray_end_p(it) && right_used < GUI_STATUS_BAR_WIDTH) {
|
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarRight]);
|
||||||
// ViewPort* view_port = *ViewPortArray_ref(it);
|
while(!ViewPortArray_end_p(it) && right_used < GUI_STATUS_BAR_WIDTH) {
|
||||||
// if(view_port_is_enabled(view_port)) {
|
ViewPort* view_port = *ViewPortArray_ref(it);
|
||||||
// width = view_port_get_width(view_port);
|
if(view_port_is_enabled(view_port)) {
|
||||||
// if(!width) width = 8;
|
width = view_port_get_width(view_port);
|
||||||
// // Recalculate next position
|
if(!width) width = 8;
|
||||||
// right_used += (width + 2);
|
// Recalculate next position
|
||||||
// x -= (width + 2);
|
right_used += (width + 2);
|
||||||
// // Prepare work area background
|
x -= (width + 2);
|
||||||
// canvas_frame_set(
|
// Prepare work area background
|
||||||
// gui->canvas,
|
canvas_frame_set(
|
||||||
// x - 1,
|
gui->canvas,
|
||||||
// GUI_STATUS_BAR_Y + 1,
|
x - 1,
|
||||||
// width + 2,
|
GUI_STATUS_BAR_Y + 1,
|
||||||
// GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
width + 2,
|
||||||
// canvas_set_color(gui->canvas, ColorWhite);
|
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||||
// canvas_draw_box(
|
canvas_set_color(gui->canvas, ColorWhite);
|
||||||
// gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
canvas_draw_box(
|
||||||
// canvas_set_color(gui->canvas, ColorBlack);
|
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
||||||
// // ViewPort draw
|
canvas_set_color(gui->canvas, ColorBlack);
|
||||||
// canvas_frame_set(
|
// ViewPort draw
|
||||||
// gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
canvas_frame_set(
|
||||||
// view_port_draw(view_port, gui->canvas);
|
gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
||||||
// }
|
view_port_draw(view_port, gui->canvas);
|
||||||
// ViewPortArray_next(it);
|
}
|
||||||
// }
|
ViewPortArray_next(it);
|
||||||
// // Draw frame around icons on the right
|
}
|
||||||
// if(right_used) {
|
// Draw frame around icons on the right
|
||||||
// canvas_frame_set(
|
if(right_used) {
|
||||||
// gui->canvas,
|
canvas_frame_set(
|
||||||
// GUI_DISPLAY_WIDTH - 3 - right_used,
|
gui->canvas,
|
||||||
// GUI_STATUS_BAR_Y,
|
GUI_DISPLAY_WIDTH - 3 - right_used,
|
||||||
// right_used + 3,
|
GUI_STATUS_BAR_Y,
|
||||||
// GUI_STATUS_BAR_HEIGHT);
|
right_used + 3,
|
||||||
// canvas_set_color(gui->canvas, ColorBlack);
|
GUI_STATUS_BAR_HEIGHT);
|
||||||
// canvas_draw_rframe(
|
canvas_set_color(gui->canvas, ColorBlack);
|
||||||
// gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
canvas_draw_rframe(
|
||||||
// canvas_draw_line(
|
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
||||||
// gui->canvas,
|
canvas_draw_line(
|
||||||
// canvas_width(gui->canvas) - 2,
|
gui->canvas,
|
||||||
// 1,
|
canvas_width(gui->canvas) - 2,
|
||||||
// canvas_width(gui->canvas) - 2,
|
1,
|
||||||
// canvas_height(gui->canvas) - 2);
|
canvas_width(gui->canvas) - 2,
|
||||||
// canvas_draw_line(
|
canvas_height(gui->canvas) - 2);
|
||||||
// gui->canvas,
|
canvas_draw_line(
|
||||||
// 1,
|
gui->canvas,
|
||||||
// canvas_height(gui->canvas) - 2,
|
1,
|
||||||
// canvas_width(gui->canvas) - 2,
|
canvas_height(gui->canvas) - 2,
|
||||||
// canvas_height(gui->canvas) - 2);
|
canvas_width(gui->canvas) - 2,
|
||||||
// }
|
canvas_height(gui->canvas) - 2);
|
||||||
//
|
}
|
||||||
// // Left side
|
|
||||||
// x = 2;
|
// Left side
|
||||||
// ViewPortArray_it(it, gui->layers[GuiLayerStatusBarLeft]);
|
x = 2;
|
||||||
// while(!ViewPortArray_end_p(it) && (right_used + left_used) < GUI_STATUS_BAR_WIDTH) {
|
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarLeft]);
|
||||||
// ViewPort* view_port = *ViewPortArray_ref(it);
|
while(!ViewPortArray_end_p(it) && (right_used + left_used) < GUI_STATUS_BAR_WIDTH) {
|
||||||
// if(view_port_is_enabled(view_port)) {
|
ViewPort* view_port = *ViewPortArray_ref(it);
|
||||||
// width = view_port_get_width(view_port);
|
if(view_port_is_enabled(view_port)) {
|
||||||
// if(!width) width = 8;
|
width = view_port_get_width(view_port);
|
||||||
// // Prepare work area background
|
if(!width) width = 8;
|
||||||
// canvas_frame_set(
|
// Prepare work area background
|
||||||
// gui->canvas,
|
canvas_frame_set(
|
||||||
// x - 1,
|
gui->canvas,
|
||||||
// GUI_STATUS_BAR_Y + 1,
|
x - 1,
|
||||||
// width + 2,
|
GUI_STATUS_BAR_Y + 1,
|
||||||
// GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
width + 2,
|
||||||
// canvas_set_color(gui->canvas, ColorWhite);
|
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||||
// canvas_draw_box(
|
canvas_set_color(gui->canvas, ColorWhite);
|
||||||
// gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
canvas_draw_box(
|
||||||
// canvas_set_color(gui->canvas, ColorBlack);
|
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
||||||
// // ViewPort draw
|
canvas_set_color(gui->canvas, ColorBlack);
|
||||||
// canvas_frame_set(
|
// ViewPort draw
|
||||||
// gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
canvas_frame_set(
|
||||||
// view_port_draw(view_port, gui->canvas);
|
gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
||||||
// // Recalculate next position
|
view_port_draw(view_port, gui->canvas);
|
||||||
// left_used += (width + 2);
|
// Recalculate next position
|
||||||
// x += (width + 2);
|
left_used += (width + 2);
|
||||||
// }
|
x += (width + 2);
|
||||||
// ViewPortArray_next(it);
|
}
|
||||||
// }
|
ViewPortArray_next(it);
|
||||||
// // Extra notification
|
}
|
||||||
// if(need_attention) {
|
// Extra notification
|
||||||
// width = icon_get_width(&I_Hidden_window_9x8);
|
if(need_attention) {
|
||||||
// // Prepare work area background
|
width = icon_get_width(&I_Hidden_window_9x8);
|
||||||
// canvas_frame_set(
|
// Prepare work area background
|
||||||
// gui->canvas,
|
canvas_frame_set(
|
||||||
// x - 1,
|
gui->canvas,
|
||||||
// GUI_STATUS_BAR_Y + 1,
|
x - 1,
|
||||||
// width + 2,
|
GUI_STATUS_BAR_Y + 1,
|
||||||
// GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
width + 2,
|
||||||
// canvas_set_color(gui->canvas, ColorWhite);
|
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||||
// canvas_draw_box(gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
canvas_set_color(gui->canvas, ColorWhite);
|
||||||
// canvas_set_color(gui->canvas, ColorBlack);
|
canvas_draw_box(gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
||||||
// // Draw Icon
|
canvas_set_color(gui->canvas, ColorBlack);
|
||||||
// canvas_frame_set(
|
// Draw Icon
|
||||||
// gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
canvas_frame_set(
|
||||||
// canvas_draw_icon(gui->canvas, 0, 0, &I_Hidden_window_9x8);
|
gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
||||||
// // Recalculate next position
|
canvas_draw_icon(gui->canvas, 0, 0, &I_Hidden_window_9x8);
|
||||||
// left_used += (width + 2);
|
// Recalculate next position
|
||||||
// x += (width + 2);
|
left_used += (width + 2);
|
||||||
// }
|
x += (width + 2);
|
||||||
// // Draw frame around icons on the left
|
}
|
||||||
// if(left_used) {
|
// Draw frame around icons on the left
|
||||||
// canvas_frame_set(gui->canvas, 0, 0, left_used + 3, GUI_STATUS_BAR_HEIGHT);
|
if(left_used) {
|
||||||
// canvas_draw_rframe(
|
canvas_frame_set(gui->canvas, 0, 0, left_used + 3, GUI_STATUS_BAR_HEIGHT);
|
||||||
// gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
canvas_draw_rframe(
|
||||||
// canvas_draw_line(
|
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
||||||
// gui->canvas,
|
canvas_draw_line(
|
||||||
// canvas_width(gui->canvas) - 2,
|
gui->canvas,
|
||||||
// 1,
|
canvas_width(gui->canvas) - 2,
|
||||||
// canvas_width(gui->canvas) - 2,
|
1,
|
||||||
// canvas_height(gui->canvas) - 2);
|
canvas_width(gui->canvas) - 2,
|
||||||
// canvas_draw_line(
|
canvas_height(gui->canvas) - 2);
|
||||||
// gui->canvas,
|
canvas_draw_line(
|
||||||
// 1,
|
gui->canvas,
|
||||||
// canvas_height(gui->canvas) - 2,
|
1,
|
||||||
// canvas_width(gui->canvas) - 2,
|
canvas_height(gui->canvas) - 2,
|
||||||
// canvas_height(gui->canvas) - 2);
|
canvas_width(gui->canvas) - 2,
|
||||||
// }
|
canvas_height(gui->canvas) - 2);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gui_redraw_window(NbGui* gui) {
|
static bool gui_redraw_window(NbGui* gui) {
|
||||||
// canvas_frame_set(gui->lvgl_parent, GUI_WINDOW_X, GUI_WINDOW_Y, GUI_WINDOW_WIDTH, GUI_WINDOW_HEIGHT);
|
/*
|
||||||
// ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerWindow]);
|
canvas_frame_set(gui->lvgl_parent, GUI_WINDOW_X, GUI_WINDOW_Y, GUI_WINDOW_WIDTH, GUI_WINDOW_HEIGHT);
|
||||||
// if(view_port) {
|
ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerWindow]);
|
||||||
// view_port_draw(view_port, gui->lvgl_parent);
|
if(view_port) {
|
||||||
// return true;
|
view_port_draw(view_port, gui->lvgl_parent);
|
||||||
// }
|
return true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gui_redraw_desktop(NbGui* gui) {
|
static bool gui_redraw_desktop(NbGui* gui) {
|
||||||
// canvas_frame_set(gui->lvgl_parent, 0, 0, GUI_DISPLAY_WIDTH, GUI_DISPLAY_HEIGHT);
|
/*
|
||||||
// ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerDesktop]);
|
canvas_frame_set(gui->lvgl_parent, 0, 0, GUI_DISPLAY_WIDTH, GUI_DISPLAY_HEIGHT);
|
||||||
// if(view_port) {
|
ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerDesktop]);
|
||||||
// view_port_draw(view_port, gui->lvgl_parent);
|
if(view_port) {
|
||||||
// return true;
|
view_port_draw(view_port, gui->lvgl_parent);
|
||||||
// }
|
return true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
|
||||||
#include <m-array.h>
|
|
||||||
#include <m-algo.h>
|
#include <m-algo.h>
|
||||||
|
#include <m-array.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "message_queue.h"
|
||||||
|
#include "mutex.h"
|
||||||
|
#include "pubsub.h"
|
||||||
#include "view_port.h"
|
#include "view_port.h"
|
||||||
#include "view_port_i.h"
|
#include "view_port_i.h"
|
||||||
#include "message_queue.h"
|
|
||||||
#include "pubsub.h"
|
|
||||||
#include "mutex.h"
|
|
||||||
|
|
||||||
#define GUI_DISPLAY_WIDTH 128
|
#define GUI_DISPLAY_WIDTH 128
|
||||||
#define GUI_DISPLAY_HEIGHT 64
|
#define GUI_DISPLAY_HEIGHT 64
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
#include "view_port_i.h"
|
#include "check.h"
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "gui_i.h"
|
#include "gui_i.h"
|
||||||
#include "check.h"
|
#include "view_port_i.h"
|
||||||
|
|
||||||
#define TAG "viewport"
|
#define TAG "viewport"
|
||||||
|
|
||||||
@ -10,7 +9,8 @@ _Static_assert(ViewPortOrientationMAX == 4, "Incorrect ViewPortOrientation count
|
|||||||
_Static_assert(
|
_Static_assert(
|
||||||
(ViewPortOrientationHorizontal == 0 && ViewPortOrientationHorizontalFlip == 1 &&
|
(ViewPortOrientationHorizontal == 0 && ViewPortOrientationHorizontalFlip == 1 &&
|
||||||
ViewPortOrientationVertical == 2 && ViewPortOrientationVerticalFlip == 3),
|
ViewPortOrientationVertical == 2 && ViewPortOrientationVerticalFlip == 3),
|
||||||
"Incorrect ViewPortOrientation order");
|
"Incorrect ViewPortOrientation order"
|
||||||
|
);
|
||||||
|
|
||||||
ViewPort* view_port_alloc() {
|
ViewPort* view_port_alloc() {
|
||||||
ViewPort* view_port = malloc(sizeof(ViewPort));
|
ViewPort* view_port = malloc(sizeof(ViewPort));
|
||||||
|
|||||||
@ -64,4 +64,3 @@ void view_port_update(ViewPort* view_port);
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "gui_i.h"
|
#include "gui_i.h"
|
||||||
#include "view_port.h"
|
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
|
#include "view_port.h"
|
||||||
|
|
||||||
struct ViewPort {
|
struct ViewPort {
|
||||||
NbGui* gui;
|
NbGui* gui;
|
||||||
@ -12,8 +12,10 @@ struct ViewPort {
|
|||||||
ViewPortDrawCallback draw_callback;
|
ViewPortDrawCallback draw_callback;
|
||||||
void* draw_callback_context;
|
void* draw_callback_context;
|
||||||
|
|
||||||
// ViewPortInputCallback input_callback;
|
/*
|
||||||
// void* input_callback_context;
|
ViewPortInputCallback input_callback;
|
||||||
|
void* input_callback_context;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Set GUI reference.
|
/** Set GUI reference.
|
||||||
@ -35,10 +37,10 @@ void view_port_gui_set(ViewPort* view_port, NbGui* gui);
|
|||||||
void view_port_draw(ViewPort* view_port, lv_obj_t* parent);
|
void view_port_draw(ViewPort* view_port, lv_obj_t* parent);
|
||||||
|
|
||||||
/** Process input. Calls input callback.
|
/** Process input. Calls input callback.
|
||||||
// *
|
*
|
||||||
// * To be used by GUI, called on input dispatch.
|
* To be used by GUI, called on input dispatch.
|
||||||
// *
|
*
|
||||||
// * @param view_port ViewPort instance
|
* @param view_port ViewPort instance
|
||||||
// * @param event pointer to input event
|
* @param event pointer to input event
|
||||||
// */
|
*/
|
||||||
//void view_port_input(ViewPort* view_port, InputEvent* event);
|
//void view_port_input(ViewPort* view_port, InputEvent* event);
|
||||||
|
|||||||
@ -3,10 +3,12 @@
|
|||||||
/** ViewPort Input callback
|
/** ViewPort Input callback
|
||||||
* @warning called from GUI thread
|
* @warning called from GUI thread
|
||||||
*/
|
*/
|
||||||
//typedef void (*ViewPortInputCallback)(InputEvent* event, void* context);
|
/*
|
||||||
|
typedef void (*ViewPortInputCallback)(InputEvent* event, void* context);
|
||||||
|
|
||||||
//void view_port_input_callback_set(
|
void view_port_input_callback_set(
|
||||||
// ViewPort* view_port,
|
ViewPort* view_port,
|
||||||
// ViewPortInputCallback callback,
|
ViewPortInputCallback callback,
|
||||||
// void* context);
|
void* context);
|
||||||
//
|
|
||||||
|
*/
|
||||||
@ -1,6 +1,6 @@
|
|||||||
#include "system_info.h"
|
#include "system_info.h"
|
||||||
#include "nanobake.h"
|
|
||||||
#include "core_defines.h"
|
#include "core_defines.h"
|
||||||
|
#include "nanobake.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
static int32_t system_info_entry_point(void* param) {
|
static int32_t system_info_entry_point(void* param) {
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
#include "nanobake.h"
|
#include "nanobake.h"
|
||||||
#include "nb_hardware_i.h"
|
|
||||||
#include "nb_lvgl_i.h"
|
|
||||||
#include "nb_app_i.h"
|
|
||||||
#include "applications/nb_applications.h"
|
#include "applications/nb_applications.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "m-list.h"
|
#include "m-list.h"
|
||||||
|
#include "nb_app_i.h"
|
||||||
|
#include "nb_hardware_i.h"
|
||||||
|
#include "nb_lvgl_i.h"
|
||||||
// Furi
|
// Furi
|
||||||
#include "thread.h"
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "record.h"
|
#include "record.h"
|
||||||
|
#include "thread.h"
|
||||||
|
|
||||||
M_LIST_DEF(thread_ids, FuriThreadId);
|
M_LIST_DEF(thread_ids, FuriThreadId);
|
||||||
|
|
||||||
@ -36,10 +36,7 @@ size_t nanobake_get_app_thread_count() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void prv_start_app(const NbApp _Nonnull* app) {
|
static void prv_start_app(const NbApp _Nonnull* app) {
|
||||||
ESP_LOGI(TAG, "Starting %s app \"%s\"",
|
ESP_LOGI(TAG, "Starting %s app \"%s\"", nb_app_type_to_string(app->type), app->name);
|
||||||
nb_app_type_to_string(app->type),
|
|
||||||
app->name
|
|
||||||
);
|
|
||||||
|
|
||||||
FuriThread* thread = furi_thread_alloc_ex(
|
FuriThread* thread = furi_thread_alloc_ex(
|
||||||
app->name,
|
app->name,
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "nb_hardware.h"
|
|
||||||
#include "nb_app.h"
|
#include "nb_app.h"
|
||||||
#include "nb_config.h"
|
#include "nb_config.h"
|
||||||
|
#include "nb_hardware.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "nb_app_i.h"
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "nb_app_i.h"
|
||||||
|
|
||||||
const char* prv_type_service = "service";
|
const char* prv_type_service = "service";
|
||||||
const char* prv_type_system = "system";
|
const char* prv_type_system = "system";
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "nb_app.h"
|
||||||
#include "nb_display.h"
|
#include "nb_display.h"
|
||||||
#include "nb_touch.h"
|
#include "nb_touch.h"
|
||||||
#include "nb_app.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "nb_hardware_i.h"
|
#include "check.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "check.h"
|
#include "nb_hardware_i.h"
|
||||||
|
|
||||||
#define TAG "hardware"
|
#define TAG "hardware"
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "nb_hardware.h"
|
|
||||||
#include "nb_config.h"
|
#include "nb_config.h"
|
||||||
|
#include "nb_hardware.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "nb_lvgl_i.h"
|
|
||||||
#include "esp_lvgl_port.h"
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
#include "esp_lvgl_port.h"
|
||||||
|
#include "nb_lvgl_i.h"
|
||||||
|
|
||||||
#define TAG "lvgl"
|
#define TAG "lvgl"
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "nb_lvgl.h"
|
|
||||||
#include "nb_hardware.h"
|
#include "nb_hardware.h"
|
||||||
|
#include "nb_lvgl.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esp_lcd_touch.h"
|
|
||||||
#include "esp_lcd_panel_io.h"
|
#include "esp_lcd_panel_io.h"
|
||||||
|
#include "esp_lcd_touch.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user