[FL-2733] multitarget support for fbt (#2209)

* First part of multitarget porting
* Delete firmware/targets/f7/Inc directory
* Delete firmware/targets/f7/Src directory
* gpio: cli fixes; about: using version from HAL
* sdk: path fixes
* gui: include fixes
* applications: more include fixes
* gpio: ported to new apis
* hal: introduced furi_hal_target_hw.h; libs: added one_wire
* hal: f18 target
* github: also build f18 by default
* typo fix
* fbt: removed extra checks on app list
* api: explicitly bundling select mlib headers with sdk
* hal: f18: changed INPUT_DEBOUNCE_TICKS to match f7
* cleaned up commented out code
* docs: added info on hw targets
* docs: targets: formatting fixes
* f18: fixed link error
* f18: fixed API version to match f7
* docs: hardware: minor wording fixes
* faploader: added fw target check
* docs: typo fixes
* github: not building komi target by default
* fbt: support for `targets` field for built-in apps
* github: reworked build flow to exclude app_set; fbt: removed komi-specific appset; added additional target buildset check
* github: fixed build; nfc: fixed pvs warnings
* attempt to fix target id
* f7, f18: removed certain HAL function from public API
* apps: debug: enabled bt_debug_app for f18
* Targets: backport input pins configuration routine from F7 to F18

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2023-02-07 19:33:05 +03:00
committed by GitHub
parent 1eda913367
commit 224d0aefe4
152 changed files with 4140 additions and 495 deletions
+21 -45
View File
@@ -5,28 +5,6 @@
#include <furi_hal.h>
#include <lib/toolbox/args.h>
typedef struct {
const GpioPin* pin;
const char* name;
const bool debug;
} CliCommandGpio;
const CliCommandGpio cli_command_gpio_pins[] = {
{.pin = &gpio_ext_pc0, .name = "PC0", .debug = false},
{.pin = &gpio_ext_pc1, .name = "PC1", .debug = false},
{.pin = &gpio_ext_pc3, .name = "PC3", .debug = false},
{.pin = &gpio_ext_pb2, .name = "PB2", .debug = false},
{.pin = &gpio_ext_pb3, .name = "PB3", .debug = false},
{.pin = &gpio_ext_pa4, .name = "PA4", .debug = false},
{.pin = &gpio_ext_pa6, .name = "PA6", .debug = false},
{.pin = &gpio_ext_pa7, .name = "PA7", .debug = false},
/* Dangerous pins, may damage hardware */
{.pin = &gpio_infrared_rx, .name = "PA0", .debug = true},
{.pin = &gpio_usart_rx, .name = "PB7", .debug = true},
{.pin = &gpio_speaker, .name = "PB8", .debug = true},
{.pin = &gpio_infrared_tx, .name = "PB9", .debug = true},
};
void cli_command_gpio_print_usage() {
printf("Usage:\r\n");
printf("gpio <cmd> <args>\r\n");
@@ -38,9 +16,9 @@ void cli_command_gpio_print_usage() {
static bool pin_name_to_int(FuriString* pin_name, size_t* result) {
bool is_debug_mode = furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug);
for(size_t i = 0; i < COUNT_OF(cli_command_gpio_pins); i++) {
if(furi_string_equal(pin_name, cli_command_gpio_pins[i].name)) {
if(!cli_command_gpio_pins[i].debug || is_debug_mode) {
for(size_t i = 0; i < gpio_pins_count; i++) {
if(furi_string_equal(pin_name, gpio_pins[i].name)) {
if(!gpio_pins[i].debug || is_debug_mode) {
*result = i;
return true;
}
@@ -53,9 +31,9 @@ static bool pin_name_to_int(FuriString* pin_name, size_t* result) {
static void gpio_print_pins(void) {
printf("Wrong pin name. Available pins: ");
bool is_debug_mode = furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug);
for(size_t i = 0; i < COUNT_OF(cli_command_gpio_pins); i++) {
if(!cli_command_gpio_pins[i].debug || is_debug_mode) {
printf("%s ", cli_command_gpio_pins[i].name);
for(size_t i = 0; i < gpio_pins_count; i++) {
if(!gpio_pins[i].debug || is_debug_mode) {
printf("%s ", gpio_pins[i].name);
}
}
}
@@ -113,7 +91,7 @@ void cli_command_gpio_mode(Cli* cli, FuriString* args, void* context) {
return;
}
if(cli_command_gpio_pins[num].debug) { //-V779
if(gpio_pins[num].debug) { //-V779
printf(
"Changing this pin mode may damage hardware. Are you sure you want to continue? (y/n)?\r\n");
char c = cli_getc(cli);
@@ -124,12 +102,12 @@ void cli_command_gpio_mode(Cli* cli, FuriString* args, void* context) {
}
if(value == 1) { // output
furi_hal_gpio_write(cli_command_gpio_pins[num].pin, false);
furi_hal_gpio_init_simple(cli_command_gpio_pins[num].pin, GpioModeOutputPushPull);
printf("Pin %s is now an output (low)", cli_command_gpio_pins[num].name);
furi_hal_gpio_write(gpio_pins[num].pin, false);
furi_hal_gpio_init_simple(gpio_pins[num].pin, GpioModeOutputPushPull);
printf("Pin %s is now an output (low)", gpio_pins[num].name);
} else { // input
furi_hal_gpio_init_simple(cli_command_gpio_pins[num].pin, GpioModeInput);
printf("Pin %s is now an input", cli_command_gpio_pins[num].name);
furi_hal_gpio_init_simple(gpio_pins[num].pin, GpioModeInput);
printf("Pin %s is now an input", gpio_pins[num].name);
}
}
@@ -144,15 +122,14 @@ void cli_command_gpio_read(Cli* cli, FuriString* args, void* context) {
}
if(LL_GPIO_MODE_INPUT != //-V779
LL_GPIO_GetPinMode(
cli_command_gpio_pins[num].pin->port, cli_command_gpio_pins[num].pin->pin)) {
printf("Err: pin %s is not set as an input.", cli_command_gpio_pins[num].name);
LL_GPIO_GetPinMode(gpio_pins[num].pin->port, gpio_pins[num].pin->pin)) {
printf("Err: pin %s is not set as an input.", gpio_pins[num].name);
return;
}
uint8_t val = !!furi_hal_gpio_read(cli_command_gpio_pins[num].pin);
uint8_t val = !!furi_hal_gpio_read(gpio_pins[num].pin);
printf("Pin %s <= %u", cli_command_gpio_pins[num].name, val);
printf("Pin %s <= %u", gpio_pins[num].name, val);
}
void cli_command_gpio_set(Cli* cli, FuriString* args, void* context) {
@@ -174,14 +151,13 @@ void cli_command_gpio_set(Cli* cli, FuriString* args, void* context) {
}
if(LL_GPIO_MODE_OUTPUT != //-V779
LL_GPIO_GetPinMode(
cli_command_gpio_pins[num].pin->port, cli_command_gpio_pins[num].pin->pin)) {
printf("Err: pin %s is not set as an output.", cli_command_gpio_pins[num].name);
LL_GPIO_GetPinMode(gpio_pins[num].pin->port, gpio_pins[num].pin->pin)) {
printf("Err: pin %s is not set as an output.", gpio_pins[num].name);
return;
}
// Extra check if debug pins used
if(cli_command_gpio_pins[num].debug) {
if(gpio_pins[num].debug) {
printf(
"Setting this pin may damage hardware. Are you sure you want to continue? (y/n)?\r\n");
char c = cli_getc(cli);
@@ -191,8 +167,8 @@ void cli_command_gpio_set(Cli* cli, FuriString* args, void* context) {
}
}
furi_hal_gpio_write(cli_command_gpio_pins[num].pin, !!value);
printf("Pin %s => %u", cli_command_gpio_pins[num].name, !!value);
furi_hal_gpio_write(gpio_pins[num].pin, !!value);
printf("Pin %s => %u", gpio_pins[num].name, !!value);
}
void cli_command_gpio(Cli* cli, FuriString* args, void* context) {
+1 -1
View File
@@ -1,4 +1,4 @@
#include "dialogs/dialogs_message.h"
#include "dialogs_message.h"
#include "dialogs_i.h"
#include <toolbox/api_lock.h>
#include <assets_icons.h>
@@ -1,6 +1,7 @@
#include "dialogs_i.h"
#include <gui/modules/file_browser.h>
#include <toolbox/api_lock.h>
#include "gui/modules/file_browser.h"
typedef struct {
FuriApiLock lock;
+3 -2
View File
@@ -1,8 +1,9 @@
#pragma once
#include <core/pubsub.h>
#include "gui/view.h"
#include "helpers/dolphin_deed.h"
#include <gui/view.h>
#include <core/pubsub.h>
#include <stdbool.h>
#ifdef __cplusplus
+4 -3
View File
@@ -1,16 +1,17 @@
#include "elements.h"
#include "m-core.h"
#include <m-core.h>
#include <assets_icons.h>
#include "furi_hal_resources.h"
#include <furi_hal_resources.h>
#include <furi_hal.h>
#include "gui/canvas.h"
#include <gui/canvas.h>
#include <gui/icon_i.h>
#include <gui/icon_animation_i.h>
#include <furi.h>
#include "canvas_i.h"
#include <math.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
-1
View File
@@ -1,4 +1,3 @@
#include "gui/canvas.h"
#include "gui_i.h"
#include <assets_icons.h>
@@ -1,12 +1,15 @@
#include "button_menu.h"
#include "gui/canvas.h"
#include "gui/elements.h"
#include "input/input.h"
#include <m-array.h>
#include <gui/canvas.h>
#include <gui/elements.h>
#include <input/input.h>
#include <furi.h>
#include <stdint.h>
#include <assets_icons.h>
#include <stdint.h>
#include <m-array.h>
#define ITEM_FIRST_OFFSET 17
#define ITEM_NEXT_OFFSET 4
#define ITEM_HEIGHT 14
@@ -1,12 +1,15 @@
#include "button_panel.h"
#include "furi_hal_resources.h"
#include "gui/canvas.h"
#include <gui/canvas.h>
#include <gui/elements.h>
#include <furi.h>
#include <furi_hal_resources.h>
#include <stdint.h>
#include <m-array.h>
#include <m-i-list.h>
#include <m-list.h>
#include <furi.h>
#include <gui/elements.h>
#include <stdint.h>
typedef struct {
// uint16_t to support multi-screen, wide button panel
@@ -1,8 +1,9 @@
#include <furi.h>
#include <gui/elements.h>
#include <assets_icons.h>
#include "byte_input.h"
#include <gui/elements.h>
#include <furi.h>
#include <assets_icons.h>
struct ByteInput {
View* view;
};
@@ -1,14 +1,17 @@
#include "file_browser.h"
#include "assets_icons.h"
#include "file_browser_worker.h"
#include <gui/elements.h>
#include <assets_icons.h>
#include <toolbox/path.h>
#include <furi.h>
#include <furi_hal_resources.h>
#include <core/check.h>
#include <core/common_defines.h>
#include <core/log.h>
#include "furi_hal_resources.h"
#include <m-array.h>
#include <gui/elements.h>
#include <furi.h>
#include "toolbox/path.h"
#define LIST_ITEMS 5u
#define MAX_LEN_PX 110
@@ -1,13 +1,16 @@
#include "file_browser_worker.h"
#include <storage/filesystem_api_defines.h>
#include <storage/storage.h>
#include <toolbox/path.h>
#include <core/check.h>
#include <core/common_defines.h>
#include "storage/filesystem_api_defines.h"
#include <furi.h>
#include <m-array.h>
#include <stdbool.h>
#include <storage/storage.h>
#include <furi.h>
#include <stddef.h>
#include "toolbox/path.h"
#define TAG "BrowserWorker"
+5 -4
View File
@@ -1,13 +1,14 @@
#include <stdint.h>
#include <furi.h>
#include <assets_icons.h>
#include "loading.h"
#include <gui/icon_animation.h>
#include <gui/elements.h>
#include <gui/canvas.h>
#include <gui/view.h>
#include <input/input.h>
#include "loading.h"
#include <furi.h>
#include <assets_icons.h>
#include <stdint.h>
struct Loading {
View* view;
+1 -1
View File
@@ -1,9 +1,9 @@
#include "menu.h"
#include <m-array.h>
#include <gui/elements.h>
#include <assets_icons.h>
#include <furi.h>
#include <m-array.h>
struct Menu {
View* view;
+1 -1
View File
@@ -1,8 +1,8 @@
#include "submenu.h"
#include <m-array.h>
#include <gui/elements.h>
#include <furi.h>
#include <m-array.h>
struct Submenu {
View* view;
+2 -2
View File
@@ -1,7 +1,7 @@
#include "text_box.h"
#include "gui/canvas.h"
#include <furi.h>
#include <gui/canvas.h>
#include <gui/elements.h>
#include <furi.h>
#include <stdint.h>
struct TextBox {
@@ -1,6 +1,6 @@
#include <furi.h>
#include "validators.h"
#include <storage/storage.h>
#include <furi.h>
struct ValidatorIsFile {
char* app_path_folder;
@@ -1,6 +1,7 @@
#pragma once
#include <core/common_defines.h>
#include <core/string.h>
#ifdef __cplusplus
extern "C" {
@@ -1,8 +1,8 @@
#include "variable_item_list.h"
#include "gui/canvas.h"
#include <m-array.h>
#include <furi.h>
#include <gui/elements.h>
#include <gui/canvas.h>
#include <furi.h>
#include <m-array.h>
#include <stdint.h>
struct VariableItem {
+2 -2
View File
@@ -1,7 +1,7 @@
#include <furi.h>
#include "widget.h"
#include <m-array.h>
#include "widget_elements/widget_element_i.h"
#include <furi.h>
#include <m-array.h>
ARRAY_DEF(ElementArray, WidgetElement*, M_PTR_OPLIST);
+3 -2
View File
@@ -1,8 +1,9 @@
#include "gui/view.h"
#include <core/memmgr.h>
#include "view_stack.h"
#include "view_i.h"
#include <gui/view.h>
#include <core/memmgr.h>
#define MAX_VIEWS 3
typedef struct {
@@ -1,4 +1,4 @@
#include "furi_hal_light.h"
#include <furi_hal_light.h>
#include <furi.h>
#include <furi_hal.h>
#include <storage/storage.h>
@@ -1,4 +1,4 @@
#include "furi_hal_resources.h"
#include <furi_hal_resources.h>
#include "notification.h"
#include "notification_messages_notes.h"
#include <stddef.h>