This commit is contained in:
Willy-JL
2023-11-12 02:20:45 +00:00
498 changed files with 4821 additions and 2206 deletions
@@ -68,7 +68,8 @@ PluginManagerError plugin_manager_load_single(PluginManager* manager, const char
FlipperApplicationLoadStatus load_status = flipper_application_map_to_memory(lib);
if(load_status != FlipperApplicationLoadStatusSuccess) {
FURI_LOG_E(TAG, "Failed to load module_demo_plugin1.fal");
FURI_LOG_E(TAG, "Failed to load %s", path);
error = PluginManagerErrorLoaderError;
break;
}
+1 -1
View File
@@ -48,7 +48,7 @@ static void ibutton_protocols_get_group_by_id(
local_id -= ibutton_protocol_groups[i]->protocol_count;
}
}
furi_crash(NULL);
furi_crash();
}
iButtonProtocols* ibutton_protocols_alloc() {
@@ -48,7 +48,7 @@ void infrared_encoder_nec_reset(void* encoder_ptr, const InfraredMessage* messag
*data2 = (message->command & 0xFFC0) >> 6;
encoder->bits_to_encode = 42;
} else {
furi_assert(0);
furi_crash();
}
}
@@ -23,7 +23,7 @@ void infrared_encoder_sirc_reset(void* encoder_ptr, const InfraredMessage* messa
*data |= (message->address & 0x1FFF) << 7;
encoder->bits_to_encode = 20;
} else {
furi_assert(0);
furi_crash();
}
}
+1 -1
View File
@@ -88,7 +88,7 @@ FuriHalInfraredTxGetDataState
state = FuriHalInfraredTxGetDataStateDone;
}
} else {
furi_crash(NULL);
furi_crash();
}
return state;
+9 -9
View File
@@ -165,7 +165,7 @@ static int32_t infrared_worker_rx_thread(void* thread_context) {
InfraredWorker* instance = thread_context;
uint32_t events = 0;
LevelDuration level_duration;
TickType_t last_blink_time = 0;
uint32_t last_blink_time = 0;
while(1) {
events = furi_thread_flags_wait(INFRARED_WORKER_ALL_RX_EVENTS, 0, FuriWaitForever);
@@ -173,8 +173,8 @@ static int32_t infrared_worker_rx_thread(void* thread_context) {
if(events & INFRARED_WORKER_RX_RECEIVED) {
if(!instance->rx.overrun && instance->blink_enable &&
((xTaskGetTickCount() - last_blink_time) > 80)) {
last_blink_time = xTaskGetTickCount();
((furi_get_tick() - last_blink_time) > 80)) {
last_blink_time = furi_get_tick();
notification_message(instance->notification, &sequence_blink_blue_10);
}
if(instance->signal.timings_cnt == 0)
@@ -367,10 +367,11 @@ static FuriHalInfraredTxGetDataState
*duration = timing.duration;
state = timing.state;
} else {
furi_assert(0);
// Why bother if we crash anyway?..
*level = 0;
*duration = 100;
state = FuriHalInfraredTxGetDataStateDone;
furi_crash();
}
uint32_t flags_set = furi_thread_flags_set(
@@ -414,7 +415,7 @@ static bool infrared_get_new_signal(InfraredWorker* instance) {
} else if(response == InfraredWorkerGetSignalResponseStop) {
new_signal_obtained = false;
} else {
furi_assert(0);
furi_crash();
}
return new_signal_obtained;
@@ -443,9 +444,8 @@ static bool infrared_worker_tx_fill_buffer(InfraredWorker* instance) {
}
if(status == InfraredStatusError) {
furi_assert(0);
new_data_available = false;
break;
furi_crash();
} else if(status == InfraredStatusOk) {
timing.state = FuriHalInfraredTxGetDataStateOk;
} else if(status == InfraredStatusDone) {
@@ -456,7 +456,7 @@ static bool infrared_worker_tx_fill_buffer(InfraredWorker* instance) {
timing.state = FuriHalInfraredTxGetDataStateLastDone;
}
} else {
furi_assert(0);
furi_crash();
}
uint32_t written_size =
furi_stream_buffer_send(instance->stream, &timing, sizeof(InfraredWorkerTiming), 0);
@@ -548,7 +548,7 @@ static int32_t infrared_worker_tx_thread(void* thread_context) {
break;
default:
furi_assert(0);
furi_crash();
break;
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
#include "lfrfid_worker_i.h"
#include <furi.h>
#include <furi_hal.h>
#include <atomic.h>
#include "lfrfid_worker_i.h"
typedef enum {
LFRFIDEventStopThread = (1 << 0),
+2
View File
@@ -28,6 +28,7 @@ static const uint8_t default_config_ntag_i2c[] = {0x01, 0x00, 0xF8, 0x48, 0x08,
static void nfc_generate_mf_ul_uid(uint8_t* uid) {
uid[0] = NXP_MANUFACTURER_ID;
furi_hal_random_fill_buf(&uid[1], 6);
uid[3] |= 0x01; // To avoid forbidden 0x88 value
// I'm not sure how this is generated, but the upper nybble always seems to be 8
uid[6] &= 0x0F;
uid[6] |= 0x80;
@@ -322,6 +323,7 @@ static void nfc_generate_ntag_i2c_plus_2k(NfcDevice* nfc_device) {
static void nfc_generate_mf_classic_uid(uint8_t* uid, uint8_t length) {
uid[0] = NXP_MANUFACTURER_ID;
furi_hal_random_fill_buf(&uid[1], length - 1);
uid[3] |= 0x01; // To avoid forbidden 0x88 value
}
static void
@@ -43,8 +43,6 @@ struct Iso14443_4aPoller {
void* context;
};
Iso14443_4aError iso14443_4a_process_error(Iso14443_3aError error);
const Iso14443_4aData* iso14443_4a_poller_get_data(Iso14443_4aPoller* instance);
Iso14443_4aError iso14443_4a_poller_halt(Iso14443_4aPoller* instance);
@@ -40,8 +40,6 @@ struct Iso14443_4bPoller {
void* context;
};
Iso14443_4bError iso14443_4b_process_error(Iso14443_3bError error);
const Iso14443_4bData* iso14443_4b_poller_get_data(Iso14443_4bPoller* instance);
Iso14443_4bError iso14443_4b_poller_halt(Iso14443_4bPoller* instance);
+2 -1
View File
@@ -1,3 +1,5 @@
#pragma once
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -6,7 +8,6 @@
extern "C" {
#endif
void _putchar(char character);
int __wrap_printf(const char* format, ...);
int __wrap_vsnprintf(char* str, size_t size, const char* format, va_list args);
int __wrap_puts(const char* str);
+1
View File
@@ -13,6 +13,7 @@ env.Append(
File("subghz_file_encoder_worker.h"),
File("transmitter.h"),
File("protocols/raw.h"),
File("protocols/public_api.h"),
File("blocks/const.h"),
File("blocks/decoder.h"),
File("blocks/encoder.h"),
+1 -4
View File
@@ -1,6 +1,7 @@
#pragma once
#include "base.h"
#include "public_api.h"
#define SUBGHZ_PROTOCOL_BIN_RAW_NAME "BinRAW"
@@ -80,10 +81,6 @@ void subghz_protocol_decoder_bin_raw_feed(void* context, bool level, uint32_t du
*/
uint8_t subghz_protocol_decoder_bin_raw_get_hash_data(void* context);
void subghz_protocol_decoder_bin_raw_data_input_rssi(
SubGhzProtocolDecoderBinRAW* instance,
float rssi);
/**
* Serialize data SubGhzProtocolDecoderBinRAW.
* @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
+1 -42
View File
@@ -1,6 +1,7 @@
#pragma once
#include "base.h"
#include "public_api.h"
#define SUBGHZ_PROTOCOL_KEELOQ_NAME "KeeLoq"
@@ -24,48 +25,6 @@ void* subghz_protocol_encoder_keeloq_alloc(SubGhzEnvironment* environment);
*/
void subghz_protocol_encoder_keeloq_free(void* context);
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 28 bit
* @param btn Button number, 4 bit
* @param cnt Counter value, 16 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_keeloq_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name,
SubGhzRadioPreset* preset);
/**
* Key generation for BFT.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 28 bit
* @param btn Button number, 4 bit
* @param cnt Counter value, 16 bit
* @param seed Seed value, 32 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_keeloq_bft_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name,
SubGhzRadioPreset* preset);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
+85
View File
@@ -0,0 +1,85 @@
#pragma once
#include "../types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderSecPlus_v2 instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 32 bit
* @param btn Button number, 8 bit
* @param cnt Container value, 28 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_secplus_v2_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint32_t cnt,
SubGhzRadioPreset* preset);
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 28 bit
* @param btn Button number, 4 bit
* @param cnt Container value, 16 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_keeloq_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name,
SubGhzRadioPreset* preset);
/**
* Key generation for BFT.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 28 bit
* @param btn Button number, 4 bit
* @param cnt Counter value, 16 bit
* @param seed Seed value, 32 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_keeloq_bft_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name,
SubGhzRadioPreset* preset);
typedef struct SubGhzProtocolDecoderBinRAW SubGhzProtocolDecoderBinRAW;
void subghz_protocol_decoder_bin_raw_data_input_rssi(
SubGhzProtocolDecoderBinRAW* instance,
float rssi);
/**
* Validation of fixed parts SubGhzProtocolDecoderSecPlus_v1.
* @param fixed fixed parts
* @return true On success
*/
bool subghz_protocol_secplus_v1_check_fixed(uint32_t fixed);
#ifdef __cplusplus
}
#endif
+2 -7
View File
@@ -1,5 +1,7 @@
#pragma once
#include "base.h"
#include "public_api.h"
#define SUBGHZ_PROTOCOL_SECPLUS_V1_NAME "Security+ 1.0"
@@ -100,13 +102,6 @@ SubGhzProtocolStatus subghz_protocol_decoder_secplus_v1_serialize(
SubGhzProtocolStatus
subghz_protocol_decoder_secplus_v1_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Validation of fixed parts SubGhzProtocolDecoderSecPlus_v1.
* @param fixed fixed parts
* @return true On success
*/
bool subghz_protocol_secplus_v1_check_fixed(uint32_t fixed);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderSecPlus_v1 instance
+2 -19
View File
@@ -1,5 +1,7 @@
#pragma once
#include "base.h"
#include "public_api.h"
#define SUBGHZ_PROTOCOL_SECPLUS_V2_NAME "Security+ 2.0"
@@ -45,25 +47,6 @@ void subghz_protocol_encoder_secplus_v2_stop(void* context);
*/
LevelDuration subghz_protocol_encoder_secplus_v2_yield(void* context);
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderSecPlus_v2 instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 32 bit
* @param btn Button number, 8 bit
* @param cnt Container value, 28 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_secplus_v2_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint32_t cnt,
SubGhzRadioPreset* preset);
/**
* Allocate SubGhzProtocolDecoderSecPlus_v2.
* @param environment Pointer to a SubGhzEnvironment instance
-33
View File
@@ -10,39 +10,6 @@ extern const SubGhzProtocolRegistry subghz_protocol_registry;
typedef struct SubGhzProtocolDecoderBinRAW SubGhzProtocolDecoderBinRAW;
bool subghz_protocol_secplus_v2_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint32_t cnt,
SubGhzRadioPreset* preset);
bool subghz_protocol_keeloq_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name,
SubGhzRadioPreset* preset);
bool subghz_protocol_keeloq_bft_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
uint32_t seed,
const char* manufacture_name,
SubGhzRadioPreset* preset);
void subghz_protocol_decoder_bin_raw_data_input_rssi(
SubGhzProtocolDecoderBinRAW* instance,
float rssi);
bool subghz_protocol_secplus_v1_check_fixed(uint32_t fixed);
bool subghz_protocol_faac_slh_create_data(
void* context,
FlipperFormat* flipper_format,
+1 -1
View File
@@ -112,7 +112,7 @@ bool buffer_stream_send_from_isr(BufferStream* buffer_stream, const uint8_t* dat
return result;
}
Buffer* buffer_stream_receive(BufferStream* buffer_stream, TickType_t timeout) {
Buffer* buffer_stream_receive(BufferStream* buffer_stream, uint32_t timeout) {
Buffer* buffer;
size_t size =
furi_stream_buffer_receive(buffer_stream->stream, &buffer, sizeof(Buffer*), timeout);
+1 -1
View File
@@ -69,7 +69,7 @@ bool buffer_stream_send_from_isr(BufferStream* buffer_stream, const uint8_t* dat
* @param timeout
* @return Buffer*
*/
Buffer* buffer_stream_receive(BufferStream* buffer_stream, TickType_t timeout);
Buffer* buffer_stream_receive(BufferStream* buffer_stream, uint32_t timeout);
/**
* @brief Get stream overrun count