Skip to content

Commit 59370e0

Browse files
committed
Merge branch 'new_c_version' into dev
2 parents 1114383 + 16d1e71 commit 59370e0

File tree

26 files changed

+112
-57
lines changed

26 files changed

+112
-57
lines changed

applications/debug/accessor/helpers/wiegand.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
#include <furi.h>
33
#include <furi_hal.h>
44

5-
volatile unsigned long WIEGAND::_cardTempHigh = 0;
6-
volatile unsigned long WIEGAND::_cardTemp = 0;
7-
volatile unsigned long WIEGAND::_lastWiegand = 0;
5+
unsigned long WIEGAND::_cardTempHigh = 0;
6+
unsigned long WIEGAND::_cardTemp = 0;
7+
unsigned long WIEGAND::_lastWiegand = 0;
88
unsigned long WIEGAND::_code = 0;
99
unsigned long WIEGAND::_codeHigh = 0;
10-
volatile int WIEGAND::_bitCount = 0;
10+
int WIEGAND::_bitCount = 0;
1111
int WIEGAND::_wiegandType = 0;
1212

1313
constexpr uint32_t clocks_in_ms = 64 * 1000;
@@ -98,10 +98,7 @@ void WIEGAND::ReadD1() {
9898
_lastWiegand = DWT->CYCCNT; // Keep track of last wiegand bit received
9999
}
100100

101-
unsigned long WIEGAND::GetCardId(
102-
volatile unsigned long* codehigh,
103-
volatile unsigned long* codelow,
104-
char bitlength) {
101+
unsigned long WIEGAND::GetCardId(unsigned long* codehigh, unsigned long* codelow, char bitlength) {
105102
if(bitlength == 26) // EM tag
106103
return (*codelow & 0x1FFFFFE) >> 1;
107104

applications/debug/accessor/helpers/wiegand.h

+6-8
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ class WIEGAND {
1515

1616
private:
1717
static bool DoWiegandConversion();
18-
static unsigned long GetCardId(
19-
volatile unsigned long* codehigh,
20-
volatile unsigned long* codelow,
21-
char bitlength);
18+
static unsigned long
19+
GetCardId(unsigned long* codehigh, unsigned long* codelow, char bitlength);
2220

23-
static volatile unsigned long _cardTempHigh;
24-
static volatile unsigned long _cardTemp;
25-
static volatile unsigned long _lastWiegand;
26-
static volatile int _bitCount;
21+
static unsigned long _cardTempHigh;
22+
static unsigned long _cardTemp;
23+
static unsigned long _lastWiegand;
24+
static int _bitCount;
2725
static int _wiegandType;
2826
static unsigned long _code;
2927
static unsigned long _codeHigh;

applications/debug/battery_test_app/battery_test_app.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ void battery_test_dialog_callback(DialogExResult result, void* context) {
1212
}
1313
}
1414

15-
uint32_t battery_test_exit_confirm_view() {
15+
uint32_t battery_test_exit_confirm_view(void* context) {
16+
UNUSED(context);
1617
return BatteryTestAppViewExitDialog;
1718
}
1819

applications/drivers/subghz/cc1101_ext/cc1101_ext.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ static bool subghz_device_cc1101_ext_stop_debug() {
548548
return ret;
549549
}
550550

551-
static void subghz_device_cc1101_ext_capture_ISR() {
551+
static void subghz_device_cc1101_ext_capture_ISR(void* context) {
552+
UNUSED(context);
552553
if(!furi_hal_gpio_read(subghz_device_cc1101_ext->g0_pin)) {
553554
if(subghz_device_cc1101_ext->async_rx.capture_callback) {
554555
if(subghz_device_cc1101_ext->async_mirror_pin != NULL)
@@ -727,7 +728,8 @@ static void subghz_device_cc1101_ext_async_tx_refill(uint32_t* buffer, size_t sa
727728
}
728729
}
729730

730-
static void subghz_device_cc1101_ext_async_tx_dma_isr() {
731+
static void subghz_device_cc1101_ext_async_tx_dma_isr(void* context) {
732+
UNUSED(context);
731733
furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx);
732734

733735
#if SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_CHANNEL == LL_DMA_CHANNEL_3

applications/examples/example_plugins_advanced/app_api_table.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ constexpr HashtableApiInterface applicaton_hashtable_api_interface{
1818
.resolver_callback = &elf_resolve_from_hashtable,
1919
},
2020
/* pointers to application's API table boundaries */
21-
.table_cbegin = app_api_table.cbegin(),
22-
.table_cend = app_api_table.cend(),
21+
app_api_table.cbegin(),
22+
app_api_table.cend(),
2323
};
2424

2525
/* Casting to generic resolver to use in Composite API resolver */

applications/main/nfc/api/nfc_app_api_table.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ constexpr HashtableApiInterface nfc_application_hashtable_api_interface{
1818
.resolver_callback = &elf_resolve_from_hashtable,
1919
},
2020
/* pointers to application's API table boundaries */
21-
.table_cbegin = nfc_app_api_table.cbegin(),
22-
.table_cend = nfc_app_api_table.cend(),
21+
nfc_app_api_table.cbegin(),
22+
nfc_app_api_table.cend(),
2323
};
2424

2525
/* Casting to generic resolver to use in Composite API resolver */

applications/services/loader/firmware_api/firmware_api.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ constexpr HashtableApiInterface mock_elf_api_interface{
1717
.api_version_minor = 0,
1818
.resolver_callback = &elf_resolve_from_hashtable,
1919
},
20-
.table_cbegin = nullptr,
21-
.table_cend = nullptr,
20+
nullptr,
21+
nullptr,
2222
};
2323

2424
const ElfApiInterface* const firmware_api_interface = &mock_elf_api_interface;
@@ -29,8 +29,8 @@ constexpr HashtableApiInterface elf_api_interface{
2929
.api_version_minor = (elf_api_version & 0xFFFF),
3030
.resolver_callback = &elf_resolve_from_hashtable,
3131
},
32-
.table_cbegin = elf_api_table.cbegin(),
33-
.table_cend = elf_api_table.cend(),
32+
elf_api_table.cbegin(),
33+
elf_api_table.cend(),
3434
};
3535
const ElfApiInterface* const firmware_api_interface = &elf_api_interface;
3636
#endif

applications/system/js_app/plugin_api/app_api_table.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ constexpr HashtableApiInterface applicaton_hashtable_api_interface{
1818
.resolver_callback = &elf_resolve_from_hashtable,
1919
},
2020
/* pointers to application's API table boundaries */
21-
.table_cbegin = app_api_table.cbegin(),
22-
.table_cend = app_api_table.cend(),
21+
app_api_table.cbegin(),
22+
app_api_table.cend(),
2323
};
2424

2525
/* Casting to generic resolver to use in Composite API resolver */

fbt.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
call "%~dp0scripts\toolchain\fbtenv.cmd" env
2+
call "%~dp0scripts\toolchain\fbtenv.cmd" env || exit /b
33

44
set SCONS_EP=python -m SCons
55

lib/SConscript

+2
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ libs = env.BuildModules(
4848
],
4949
)
5050

51+
env.Append(SDK_HEADERS=[File("#/lib/callback-connector/callback-connector.h")])
52+
5153
Return("libs")

lib/callback-connector/callback-connector.h

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#ifndef CALLBACKCONNECTOR_H
22
#define CALLBACKCONNECTOR_H
3+
4+
#ifdef __cplusplus
35
#include <functional>
46
namespace cbc {
57
namespace Details {
68

7-
template <std::size_t Tag, typename T, typename Ret, typename... Args> class FuncMemberWrapper {
9+
template <std::size_t Tag, typename T, typename Ret, typename... Args>
10+
class FuncMemberWrapper {
811
public:
912
FuncMemberWrapper() = delete;
1013
using member_fun_t = Ret (T::*)(Args...);
@@ -43,7 +46,8 @@ template <std::size_t Tag, typename T, typename Ret, typename... Args>
4346
typename FuncMemberWrapper<Tag, T, Ret, Args...>::const_member_fun_t
4447
FuncMemberWrapper<Tag, T, Ret, Args...>::const_member{};
4548

46-
template <typename Functor, typename Ret, typename... Args> struct FunctorWrapper {
49+
template <typename Functor, typename Ret, typename... Args>
50+
struct FunctorWrapper {
4751
public:
4852
static std::function<Ret(Args...)> functor;
4953
static auto instatiate(Functor fn) {
@@ -75,7 +79,8 @@ auto const_instantiate(T* t, Ret (T::*ptr)(Args...) const) {
7579
return FuncMemberWrapper<tag, T, Ret, Args...>::instantiate(t, ptr);
7680
}
7781

78-
template <std::size_t tag, typename T, typename Func> auto const_instantiate(T* t, Func ptr) {
82+
template <std::size_t tag, typename T, typename Func>
83+
auto const_instantiate(T* t, Func ptr) {
7984
return const_instantiate(t, ptr);
8085
}
8186

@@ -91,9 +96,11 @@ auto obtain_connector(T* t, Ret (T::*ptr)(Args...) const) {
9196
return Details::FuncMemberWrapper<tag, T, Ret, Args...>::instantiate(t, ptr);
9297
}
9398

94-
template <typename Functor> auto obtain_connector(Functor functor) {
99+
template <typename Functor>
100+
auto obtain_connector(Functor functor) {
95101
return Details::deducer(std::move(functor), &Functor::operator());
96102
}
97103
} //end of cbc scope
98104

105+
#endif // __cplusplus
99106
#endif // CALLBACKCONNECTOR_H
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
#Flipper Zero serial port
1+
# Flipper Zero serial port
22
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ATTRS{manufacturer}=="Flipper Devices Inc.", TAG+="uaccess", GROUP="dialout"
3-
#Flipper Zero DFU
3+
4+
# Flipper Zero DFU
45
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ATTRS{manufacturer}=="STMicroelectronics", TAG+="uaccess", GROUP="dialout"
5-
#Flipper ESP32s2 BlackMagic
6+
7+
# Flipper ESP32s2 BlackMagic
68
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="40??", ATTRS{manufacturer}=="Flipper Devices Inc.", TAG+="uaccess", GROUP="dialout"
7-
#Flipper U2F
9+
10+
# Flipper ESP32s2 in DAP mode
11+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="40??", ATTRS{manufacturer}=="CMSIS-DAP", TAG+="uaccess", GROUP="dialout"
12+
13+
# Flipper U2F
814
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5741", ATTRS{manufacturer}=="Flipper Devices Inc.", ENV{ID_SECURITY_TOKEN}="1"
9-
#ST-Link-V3
15+
16+
# ST-Link-V3
1017
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="37??", ATTRS{manufacturer}=="STMicroelectronics", TAG+="uaccess", GROUP="dialout"

scripts/debug/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Installing udev rules
2+
3+
On Linux, unprivileged users need to be in the `dialout` group to access serial ports and other USB devices.
4+
5+
To add your user to the `dialout` group, run the following command:
6+
7+
```bash
8+
sudo usermod -a -G dialout $USER
9+
```
10+
11+
To install the udev rules needed for debugging & CLI access to Flipper, run the following command:
12+
13+
```bash
14+
sudo cp 41-flipper.rules /etc/udev/rules.d/
15+
sudo udevadm control --reload-rules
16+
sudo udevadm trigger
17+
```
18+
19+
Note that not all possible debug interfaces are listed the `41-flipper.rules` file. If your interface is not supported out of the box, you may need to add a a rule for it. You can do so by adding a new line to the file according to udev rules syntax. Use `lsusb -v` to find the vendor and product IDs of your device.

scripts/toolchain/fbtenv.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if not ["%FBT_NOENV%"] == [""] (
1313
exit /b 0
1414
)
1515

16-
set "FLIPPER_TOOLCHAIN_VERSION=28"
16+
set "FLIPPER_TOOLCHAIN_VERSION=32"
1717

1818
if ["%FBT_TOOLCHAIN_PATH%"] == [""] (
1919
set "FBT_TOOLCHAIN_PATH=%FBT_ROOT%"

scripts/toolchain/fbtenv.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# public variables
66
DEFAULT_SCRIPT_PATH="$(pwd -P)";
7-
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"28"}";
7+
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"32"}";
88

99
if [ -z ${FBT_TOOLCHAIN_PATH+x} ] ; then
1010
FBT_TOOLCHAIN_PATH_WAS_SET=0;
@@ -208,7 +208,9 @@ fbtenv_show_unpack_percentage()
208208
fbtenv_unpack_toolchain()
209209
{
210210
echo "Unpacking toolchain to '$FBT_TOOLCHAIN_PATH/toolchain':";
211-
rm "$FBT_TOOLCHAIN_PATH/toolchain/current" || true;
211+
if [ -L "$FBT_TOOLCHAIN_PATH/toolchain/current" ]; then
212+
rm "$FBT_TOOLCHAIN_PATH/toolchain/current";
213+
fi
212214
tar -xvf "$FBT_TOOLCHAIN_PATH/toolchain/$TOOLCHAIN_TAR" -C "$FBT_TOOLCHAIN_PATH/toolchain" 2>&1 | fbtenv_show_unpack_percentage;
213215
mkdir -p "$FBT_TOOLCHAIN_PATH/toolchain" || return 1;
214216
mv "$FBT_TOOLCHAIN_PATH/toolchain/$TOOLCHAIN_DIR" "$TOOLCHAIN_ARCH_DIR" || return 1;

scripts/toolchain/windows-toolchain-download.ps1

+11-3
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ $toolchain_zip = "$toolchain_dist_folder-$toolchain_version.zip"
1313
$toolchain_zip_temp_path = "$download_dir\$toolchain_zip"
1414
$toolchain_dist_temp_path = "$download_dir\$toolchain_dist_folder"
1515

16+
try {
17+
1618
if (Test-Path -LiteralPath "$toolchain_target_path") {
1719
Write-Host -NoNewline "Removing old Windows toolchain.."
1820
Remove-Item -LiteralPath "$toolchain_target_path" -Force -Recurse
1921
Write-Host "done!"
2022
}
2123

22-
if (Test-path -Path "$toolchain_target_path\..\current") {
24+
if (Test-path -LiteralPath "$toolchain_target_path\..\current") {
2325
Write-Host -NoNewline "Unlinking 'current'.."
2426
Remove-Item -LiteralPath "$toolchain_target_path\..\current" -Force
2527
Write-Host "done!"
2628
}
2729

28-
if (!(Test-Path -Path "$toolchain_zip_temp_path" -PathType Leaf)) {
30+
if (!(Test-Path -LiteralPath "$toolchain_zip_temp_path" -PathType Leaf)) {
2931
Write-Host -NoNewline "Downloading Windows toolchain.."
3032
$wc = New-Object net.webclient
3133
$wc.Downloadfile("$toolchain_url", "$toolchain_zip_temp_path")
@@ -57,4 +59,10 @@ Write-Host -NoNewline "Cleaning up temporary files.."
5759
Remove-Item -LiteralPath "$toolchain_zip_temp_path" -Force
5860
Write-Host "done!"
5961

60-
# dasdasd
62+
} catch {
63+
Write-Host "An error occurred"
64+
Write-Host $_
65+
Write-Host "Please close VSCode and any other programs that may be using the toolchain and try again."
66+
$host.SetShouldExit(1)
67+
Exit 1
68+
}

site_scons/cc.scons

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Import("ENV")
33

44
ENV.AppendUnique(
55
CFLAGS=[
6-
"-std=gnu17",
6+
"-std=gnu2x",
77
],
88
CXXFLAGS=[
9-
"-std=c++17",
9+
"-std=c++20",
1010
"-fno-rtti",
1111
"-fno-use-cxa-atexit",
1212
"-fno-exceptions",

targets/f18/api_symbols.csv

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Header,+,applications/services/storage/storage.h,,
4040
Header,+,lib/bit_lib/bit_lib.h,,
4141
Header,+,lib/ble_profile/extra_profiles/hid_profile.h,,
4242
Header,+,lib/ble_profile/extra_services/hid_service.h,,
43+
Header,+,lib/callback-connector/callback-connector.h,,
4344
Header,+,lib/datetime/datetime.h,,
4445
Header,+,lib/digital_signal/digital_sequence.h,,
4546
Header,+,lib/digital_signal/digital_signal.h,,

targets/f7/api_symbols.csv

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Header,+,applications/services/storage/storage.h,,
4141
Header,+,lib/bit_lib/bit_lib.h,,
4242
Header,+,lib/ble_profile/extra_profiles/hid_profile.h,,
4343
Header,+,lib/ble_profile/extra_services/hid_service.h,,
44+
Header,+,lib/callback-connector/callback-connector.h,,
4445
Header,+,lib/datetime/datetime.h,,
4546
Header,+,lib/digital_signal/digital_sequence.h,,
4647
Header,+,lib/digital_signal/digital_signal.h,,

targets/f7/furi_hal/furi_hal_ibutton.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ typedef struct {
2525

2626
FuriHalIbutton* furi_hal_ibutton = NULL;
2727

28-
static void furi_hal_ibutton_emulate_isr() {
28+
static void furi_hal_ibutton_emulate_isr(void* context) {
29+
UNUSED(context);
2930
if(LL_TIM_IsActiveFlag_UPDATE(FURI_HAL_IBUTTON_TIMER)) {
3031
LL_TIM_ClearFlag_UPDATE(FURI_HAL_IBUTTON_TIMER);
3132
furi_hal_ibutton->callback(furi_hal_ibutton->context);

targets/f7/furi_hal/furi_hal_infrared.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ bool furi_hal_infrared_get_debug_out_status(void) {
9797
return infrared_external_output;
9898
}
9999

100-
static void furi_hal_infrared_tim_rx_isr() {
100+
static void furi_hal_infrared_tim_rx_isr(void* context) {
101+
UNUSED(context);
102+
101103
static uint32_t previous_captured_ch2 = 0;
102104

103105
/* Timeout */
@@ -262,7 +264,8 @@ static uint8_t furi_hal_infrared_get_current_dma_tx_buffer(void) {
262264
return buf_num;
263265
}
264266

265-
static void furi_hal_infrared_tx_dma_polarity_isr() {
267+
static void furi_hal_infrared_tx_dma_polarity_isr(void* context) {
268+
UNUSED(context);
266269
#if INFRARED_DMA_CH1_CHANNEL == LL_DMA_CHANNEL_1
267270
if(LL_DMA_IsActiveFlag_TE1(INFRARED_DMA)) {
268271
LL_DMA_ClearFlag_TE1(INFRARED_DMA);
@@ -284,7 +287,8 @@ static void furi_hal_infrared_tx_dma_polarity_isr() {
284287
#endif
285288
}
286289

287-
static void furi_hal_infrared_tx_dma_isr() {
290+
static void furi_hal_infrared_tx_dma_isr(void* context) {
291+
UNUSED(context);
288292
#if INFRARED_DMA_CH2_CHANNEL == LL_DMA_CHANNEL_2
289293
if(LL_DMA_IsActiveFlag_TE2(INFRARED_DMA)) {
290294
LL_DMA_ClearFlag_TE2(INFRARED_DMA);

targets/f7/furi_hal/furi_hal_nfc_irq.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
#include <lib/drivers/st25r3916.h>
44
#include <furi_hal_resources.h>
55

6-
static void furi_hal_nfc_int_callback() {
6+
static void furi_hal_nfc_int_callback(void* context) {
7+
UNUSED(context);
78
furi_hal_nfc_event_set(FuriHalNfcEventInternalTypeIrq);
89
}
910

targets/f7/furi_hal/furi_hal_rfid.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ void furi_hal_rfid_tim_read_capture_stop() {
315315
furi_hal_bus_disable(RFID_CAPTURE_TIM_BUS);
316316
}
317317

318-
static void furi_hal_rfid_dma_isr() {
318+
static void furi_hal_rfid_dma_isr(void* context) {
319+
UNUSED(context);
319320
#if RFID_DMA_CH1_CHANNEL == LL_DMA_CHANNEL_1
320321
if(LL_DMA_IsActiveFlag_HT1(RFID_DMA)) {
321322
LL_DMA_ClearFlag_HT1(RFID_DMA);

0 commit comments

Comments
 (0)