[FL-2520] FW build with -Wextra (#1185)

* Fixing compiler warnings with -Wextra
* More warnings suppression, WIP
* Even more warning fixes
* Added new lines at end of text files.
* Padding fix
* Additional fixes to warnings on different build configurations; added -Wextra to default build pipeline
* Fixes for Secplus v1
* -additional warnings
* +-Wredundant-decls fixes
* FuriHal: print stack overflow task name in console
* FuriHal: add missing include

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2022-05-06 16:37:10 +03:00
committed by GitHub
parent 1ca98170d9
commit 4d6b170769
461 changed files with 940 additions and 519 deletions
+1
View File
@@ -14,6 +14,7 @@ static volatile PlatformIrqCallback platform_irq_callback = NULL;
static const GpioPin pin = {ST25R_INT_PORT, ST25R_INT_PIN};
void nfc_isr(void* _ctx) {
UNUSED(_ctx);
if(platform_irq_callback && platformGpioIsHigh(ST25R_INT_PORT, ST25R_INT_PIN)) {
osThreadFlagsSet(platform_irq_thread_id, 0x1);
}
+1
View File
@@ -118,6 +118,7 @@ ReturnCode rfalT4TPollerComposeCAPDU(const rfalT4tCApduParam* apduParam) {
}
/* Check whether requested Lc fits */
#pragma GCC diagnostic ignored "-Wtype-limits"
if((uint16_t)apduParam->Lc >
(uint16_t)(RFAL_FEATURE_ISO_DEP_APDU_MAX_LEN - RFAL_T4T_LE_LEN)) {
return ERR_PARAM; /* PRQA S 2880 # MISRA 2.1 - Unreachable code due to configuration option being set/unset */
@@ -609,7 +609,8 @@ bool st25r3916CheckReg(uint8_t reg, uint8_t mask, uint8_t val) {
/*******************************************************************************/
bool st25r3916IsRegValid(uint8_t reg) {
if(!(((int16_t)reg >= (int16_t)ST25R3916_REG_IO_CONF1) &&
#pragma GCC diagnostic ignored "-Wtype-limits"
if(!(((int16_t)reg >= (int32_t)ST25R3916_REG_IO_CONF1) &&
(reg <= (ST25R3916_SPACE_B | ST25R3916_REG_IC_IDENTITY)))) {
return false;
}
+3 -1
View File
@@ -1,3 +1,4 @@
#pragma once
/******************************************************************************
* @attention
*
@@ -38,7 +39,8 @@
* INCLUDES
******************************************************************************
*/
#include "platform.h"
#include <stdint.h>
#include <stdbool.h>
/*
******************************************************************************
+3
View File
@@ -232,6 +232,7 @@ bool file_worker_write_hex(FileWorker* file_worker, const uint8_t* buffer, uint1
}
void file_worker_show_error(FileWorker* file_worker, const char* error_text) {
UNUSED(file_worker);
DialogsApp* dialogs = furi_record_open("dialogs");
DialogMessage* message = dialog_message_alloc();
@@ -251,6 +252,7 @@ bool file_worker_file_select(
char* result,
uint8_t result_size,
const char* selected_filename) {
UNUSED(file_worker);
DialogsApp* dialogs = furi_record_open("dialogs");
bool ret =
dialog_file_select_show(dialogs, path, extension, result, result_size, selected_filename);
@@ -259,6 +261,7 @@ bool file_worker_file_select(
}
bool file_worker_check_common_errors(FileWorker* file_worker) {
UNUSED(file_worker);
//TODO remove
/* TODO: [FL-1431] Add return value to file_parser.get_sd_api().check_error() and replace get_fs_info(). */
return true;
+1 -1
View File
@@ -6,4 +6,4 @@ public:
virtual ~GenericScene(){};
private:
};
};
@@ -43,4 +43,4 @@ public:
private:
const char* name;
TRecordClass* value;
};
};
+2 -2
View File
@@ -141,7 +141,7 @@ public:
* @param tick_length_ms tick event length in milliseconds
*/
void process(
uint32_t tick_length_ms = 100,
uint32_t /* tick_length_ms */ = 100,
typename TApp::SceneType start_scene_index = TApp::SceneType::Start) {
typename TApp::Event event;
bool consumed;
@@ -240,4 +240,4 @@ private:
return scene_index;
}
};
};
+1 -1
View File
@@ -9,4 +9,4 @@ public:
void set(const char* text...);
const uint8_t text_size;
char* text;
};
};
@@ -118,4 +118,4 @@ template <> struct std::hash<ext::type_index> {
result_type operator()(argument_type const& t) const noexcept {
return t.hash_code();
}
};
};
@@ -34,4 +34,4 @@ public:
private:
ByteInput* byte_input;
};
};
@@ -70,4 +70,4 @@ public:
private:
DialogEx* dialog_ex;
};
};
@@ -7,4 +7,4 @@ public:
virtual ~GenericViewModule(){};
virtual View* get_view() = 0;
virtual void clean() = 0;
};
};
@@ -65,4 +65,4 @@ public:
private:
Popup* popup;
};
};
@@ -39,4 +39,4 @@ public:
private:
Submenu* submenu;
};
};
@@ -38,4 +38,4 @@ public:
private:
TextInput* text_input;
};
};
+1 -1
View File
@@ -110,4 +110,4 @@ template <class TState, class TEvent> uint8_t AppTemplate<TState, TEvent>::exit(
template <class TState, class TEvent> void AppTemplate<TState, TEvent>::update_gui(void) {
view_port_update(view_port);
}
}
+1 -1
View File
@@ -96,4 +96,4 @@ template <typename Functor> auto obtain_connector(Functor functor) {
}
} //end of cbc scope
#endif // CALLBACKCONNECTOR_H
#endif // CALLBACKCONNECTOR_H
+3 -3
View File
@@ -47,7 +47,7 @@ bool bq27220_set_parameter_u16(FuriHalI2cBusHandle* handle, uint16_t address, ui
uint8_t checksum = bq27220_get_checksum(buffer, 4);
buffer[0] = checksum;
buffer[1] = 6;
ret = furi_hal_i2c_write_mem(
ret &= furi_hal_i2c_write_mem(
handle, BQ27220_ADDRESS, CommandMACDataSum, buffer, 2, BQ27220_I2C_TIMEOUT);
furi_hal_delay_us(10000);
@@ -62,13 +62,13 @@ bool bq27220_init(FuriHalI2cBusHandle* handle, const ParamCEDV* cedv) {
return true;
}
FURI_LOG_I(TAG, "Start updating battery profile");
OperationStatus status = {};
OperationStatus status = {0};
if(!bq27220_control(handle, Control_ENTER_CFG_UPDATE)) {
FURI_LOG_E(TAG, "Can't configure update");
return false;
};
while((status.CFGUPDATE != 1) && (timeout-- > 0)) {
while((status.CFGUPDATE != true) && (timeout-- > 0)) {
bq27220_get_operation_status(handle, &status);
}
bq27220_set_parameter_u16(handle, AddressGaugingConfig, cedv->cedv_conf.gauge_conf_raw);
+1 -8
View File
@@ -148,13 +148,6 @@ uint32_t cc1101_set_intermediate_frequency(FuriHalSpiBusHandle* handle, uint32_t
*/
void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]);
/** Set Power Amplifier level table, ramp
*
* @param handle - pointer to FuriHalSpiHandle
* @param value - array of power level values
*/
void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]);
/** Write FIFO
*
* @param handle - pointer to FuriHalSpiHandle
@@ -177,4 +170,4 @@ uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* si
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -209,4 +209,4 @@ typedef struct {
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -1059,7 +1059,7 @@ DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Internal error, 2..0x7FFFFFFF:Cluste
break;
}
}
/* go to default */
__attribute__ ((fallthrough));
#endif
default:
val = 1; /* Internal error */
@@ -5430,7 +5430,7 @@ FRESULT f_mkfs (
ch = 0xFFFF; st = 2; break; /* Compress the no-case block if run is >= 128 */
}
st = 1; /* Do not compress short run */
/* go to next case */
__attribute__ ((fallthrough));
case 1:
ch = si++; /* Fill the short run */
if (--j == 0) st = 0;
+1
View File
@@ -79,6 +79,7 @@ uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path)
*/
uint8_t FATFS_UnLinkDriverEx(char *path, uint8_t lun)
{
(void)lun;
uint8_t DiskNum = 0;
uint8_t ret = 1;
+1 -1
View File
@@ -584,4 +584,4 @@ bool flipper_format_insert_or_update_hex(
}
return result;
}
}
+1 -1
View File
@@ -622,4 +622,4 @@ bool flipper_format_insert_or_update_hex(
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -16,4 +16,4 @@ Stream* flipper_format_get_raw_stream(FlipperFormat* flipper_format);
#ifdef __cplusplus
}
#endif
#endif
+3 -3
View File
@@ -295,7 +295,7 @@ bool flipper_format_stream_write_value_line(Stream* stream, FlipperStreamWriteDa
furi_crash("Unknown FF type");
}
if((i + 1) < write_data->data_size) {
if((size_t)(i + 1) < write_data->data_size) {
string_cat(value, " ");
}
@@ -340,7 +340,7 @@ bool flipper_format_stream_read_value_line(
string_t value;
string_init(value);
for(uint16_t i = 0; i < data_size; i++) {
for(size_t i = 0; i < data_size; i++) {
bool last = false;
result = flipper_format_stream_read_value(stream, value, &last);
if(result) {
@@ -507,4 +507,4 @@ bool flipper_format_stream_write_comment_cstr(Stream* stream, const char* data)
} while(false);
return result;
}
}
+1 -1
View File
@@ -92,4 +92,4 @@ bool flipper_format_stream_write_comment_cstr(Stream* stream, const char* data);
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -31,4 +31,4 @@ bool flipper_format_stream_seek_to_key(Stream* stream, const char* key, bool str
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -7,4 +7,4 @@ uint32_t fnv1a_buffer_hash(const uint8_t* buffer, uint32_t length, uint32_t hash
hash = (hash ^ buffer[i]) * 16777619ULL;
}
return hash;
}
}
+1 -1
View File
@@ -36,4 +36,4 @@ inline uint32_t fnv1a_string_hash(const char* str) {
}
return hash;
}
#endif
#endif
+1
View File
@@ -232,6 +232,7 @@ HSE_poll_res heatshrink_encoder_poll(heatshrink_encoder *hse,
break;
case HSES_FLUSH_BITS:
hse->state = st_flush_bit_buffer(hse, &oi);
/* fall through */
case HSES_DONE:
return HSER_POLL_EMPTY;
default:
@@ -12,7 +12,9 @@ static void infrared_common_decoder_reset_state(InfraredCommonDecoder* decoder);
static inline size_t consume_samples(uint32_t* array, size_t len, size_t shift) {
furi_assert(len >= shift);
len -= shift;
for(int i = 0; i < len; ++i) array[i] = array[i + shift];
for(size_t i = 0; i < len; ++i) {
array[i] = array[i + shift];
}
return len;
}
@@ -83,8 +85,8 @@ static InfraredStatus infrared_common_decode_bits(InfraredCommonDecoder* decoder
if(timings->min_split_time && !level) {
if(timing > timings->min_split_time) {
/* long low timing - check if we're ready for any of protocol modification */
for(int i = 0; decoder->protocol->databit_len[i] &&
(i < COUNT_OF(decoder->protocol->databit_len));
for(size_t i = 0; decoder->protocol->databit_len[i] &&
(i < COUNT_OF(decoder->protocol->databit_len));
++i) {
if(decoder->protocol->databit_len[i] == decoder->databit_cnt) {
return InfraredStatusReady;
@@ -153,8 +155,8 @@ InfraredStatus
InfraredStatus
infrared_common_decode_manchester(InfraredCommonDecoder* decoder, bool level, uint32_t timing) {
furi_assert(decoder);
uint16_t bit = decoder->protocol->timings.bit1_mark;
uint16_t tolerance = decoder->protocol->timings.bit_tolerance;
uint32_t bit = decoder->protocol->timings.bit1_mark;
uint32_t tolerance = decoder->protocol->timings.bit_tolerance;
bool* switch_detect = &decoder->switch_detect;
furi_assert((*switch_detect == true) || (*switch_detect == false));
@@ -196,7 +198,7 @@ InfraredMessage* infrared_common_decoder_check_ready(InfraredCommonDecoder* deco
InfraredMessage* message = NULL;
bool found_length = false;
for(int i = 0;
for(size_t i = 0;
decoder->protocol->databit_len[i] && (i < COUNT_OF(decoder->protocol->databit_len));
++i) {
if(decoder->protocol->databit_len[i] == decoder->databit_cnt) {
@@ -280,7 +282,7 @@ void* infrared_common_decoder_alloc(const InfraredCommonProtocolSpec* protocol)
furi_assert(protocol);
/* protocol->databit_len[0] has to contain biggest value of bits that can be decoded */
for(int i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
for(size_t i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
furi_assert(protocol->databit_len[i] <= protocol->databit_len[0]);
}
@@ -146,7 +146,7 @@ void* infrared_common_encoder_alloc(const InfraredCommonProtocolSpec* protocol)
}
/* protocol->databit_len[0] has to contain biggest value of bits that can be decoded */
for(int i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
for(size_t i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
furi_assert(protocol->databit_len[i] <= protocol->databit_len[0]);
}
@@ -174,7 +174,7 @@ void infrared_common_encoder_reset(InfraredCommonEncoder* encoder) {
uint8_t max_databit_len = 0;
for(int i = 0; i < COUNT_OF(encoder->protocol->databit_len); ++i) {
for(size_t i = 0; i < COUNT_OF(encoder->protocol->databit_len); ++i) {
max_databit_len = MAX(max_databit_len, encoder->protocol->databit_len[i]);
}
+6 -6
View File
@@ -123,7 +123,7 @@ const InfraredMessage*
InfraredMessage* message = NULL;
InfraredMessage* result = NULL;
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
if(infrared_encoder_decoder[i].decoder.decode) {
message = infrared_encoder_decoder[i].decoder.decode(handler->ctx[i], level, duration);
if(!result && message) {
@@ -139,7 +139,7 @@ InfraredDecoderHandler* infrared_alloc_decoder(void) {
InfraredDecoderHandler* handler = malloc(sizeof(InfraredDecoderHandler));
handler->ctx = malloc(sizeof(void*) * COUNT_OF(infrared_encoder_decoder));
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
handler->ctx[i] = 0;
if(infrared_encoder_decoder[i].decoder.alloc)
handler->ctx[i] = infrared_encoder_decoder[i].decoder.alloc();
@@ -153,7 +153,7 @@ void infrared_free_decoder(InfraredDecoderHandler* handler) {
furi_assert(handler);
furi_assert(handler->ctx);
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
if(infrared_encoder_decoder[i].decoder.free)
infrared_encoder_decoder[i].decoder.free(handler->ctx[i]);
}
@@ -163,7 +163,7 @@ void infrared_free_decoder(InfraredDecoderHandler* handler) {
}
void infrared_reset_decoder(InfraredDecoderHandler* handler) {
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
if(infrared_encoder_decoder[i].decoder.reset)
infrared_encoder_decoder[i].decoder.reset(handler->ctx[i]);
}
@@ -175,7 +175,7 @@ const InfraredMessage* infrared_check_decoder_ready(InfraredDecoderHandler* hand
InfraredMessage* message = NULL;
InfraredMessage* result = NULL;
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
if(infrared_encoder_decoder[i].decoder.check_ready) {
message = infrared_encoder_decoder[i].decoder.check_ready(handler->ctx[i]);
if(!result && message) {
@@ -209,7 +209,7 @@ void infrared_free_encoder(InfraredEncoderHandler* handler) {
}
static int infrared_find_index_by_protocol(InfraredProtocol protocol) {
for(int i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) {
if(infrared_encoder_decoder[i].get_protocol_spec(protocol)) {
return i;
}
@@ -20,7 +20,9 @@ bool infrared_decoder_nec_interpret(InfraredCommonDecoder* decoder) {
uint8_t address_inverse = decoder->data[1];
uint8_t command = decoder->data[2];
uint8_t command_inverse = decoder->data[3];
if((command == (uint8_t)~command_inverse) && (address == (uint8_t)~address_inverse)) {
uint8_t inverse_command_inverse = (uint8_t)~command_inverse;
uint8_t inverse_address_inverse = (uint8_t)~address_inverse;
if((command == inverse_command_inverse) && (address == inverse_address_inverse)) {
decoder->message.protocol = InfraredProtocolNEC;
decoder->message.address = address;
decoder->message.command = command;
@@ -60,8 +60,8 @@ InfraredStatus infrared_decoder_rc6_decode_manchester(
uint32_t timing) {
// 4th bit lasts 2x times more
InfraredStatus status = InfraredStatusError;
uint16_t bit = decoder->protocol->timings.bit1_mark;
uint16_t tolerance = decoder->protocol->timings.bit_tolerance;
uint32_t bit = decoder->protocol->timings.bit1_mark;
uint32_t tolerance = decoder->protocol->timings.bit_tolerance;
bool single_timing = MATCH_TIMING(timing, bit, tolerance);
bool double_timing = MATCH_TIMING(timing, 2 * bit, tolerance);
@@ -17,8 +17,9 @@ bool infrared_decoder_samsung32_interpret(InfraredCommonDecoder* decoder) {
uint8_t address2 = decoder->data[1];
uint8_t command = decoder->data[2];
uint8_t command_inverse = decoder->data[3];
uint8_t inverse_command_inverse = (uint8_t)~command_inverse;
if((address1 == address2) && (command == (uint8_t)~command_inverse)) {
if((address1 == address2) && (command == inverse_command_inverse)) {
decoder->message.command = command;
decoder->message.address = address1;
decoder->message.protocol = InfraredProtocolSamsung32;
@@ -38,7 +38,7 @@ InfraredStatus infrared_encoder_sirc_encode_repeat(
bool* level) {
furi_assert(encoder);
furi_assert(encoder->timings_encoded == (1 + 2 + encoder->bits_to_encode * 2 - 1));
furi_assert(encoder->timings_encoded == (1u + 2 + encoder->bits_to_encode * 2 - 1));
furi_assert(encoder->timings_sum < INFRARED_SIRC_REPEAT_PERIOD);
*duration = INFRARED_SIRC_REPEAT_PERIOD - encoder->timings_sum;
+1
View File
@@ -597,6 +597,7 @@ void infrared_worker_set_raw_signal(
InfraredWorkerGetSignalResponse
infrared_worker_tx_get_signal_steady_callback(void* context, InfraredWorker* instance) {
UNUSED(context);
InfraredWorkerGetSignalResponse response = instance->tx.steady_signal_sent ?
InfraredWorkerGetSignalResponseSame :
InfraredWorkerGetSignalResponseNew;
+3 -1
View File
@@ -4,6 +4,9 @@
#ifdef FURI_NDEBUG
#define LFS_NO_ASSERT
#define LFS_ASSERT(x)
#else
#define LFS_ASSERT furi_assert
#endif
#define LFS_TAG "Lfs"
@@ -16,7 +19,6 @@
#define LFS_ERROR(...) FURI_LOG_E(LFS_TAG, __VA_ARGS__);
#define LFS_ASSERT furi_assert
// Because crc
#undef LFS_CONFIG
+1
View File
@@ -97,6 +97,7 @@ uECC_VLI_API uECC_word_t uECC_vli_add(uECC_word_t *result,
}
#define asm_add 1
#pragma GCC diagnostic ignored "-Wredundant-decls"
uECC_VLI_API uECC_word_t uECC_vli_sub(uECC_word_t *result,
const uECC_word_t *left,
const uECC_word_t *right,
+1
View File
@@ -542,6 +542,7 @@ static void mod_sqrt_secp224r1_rp(uECC_word_t *d1,
/* Compute a = sqrt(a) (mod curve_p). */
/* Routine 3.2.8 mp_mod_sqrt_224; from http://www.nsa.gov/ia/_files/nist-routines.pdf */
static void mod_sqrt_secp224r1(uECC_word_t *a, uECC_Curve curve) {
(void)curve;
bitcount_t i;
uECC_word_t e1[num_words_secp224r1];
uECC_word_t f1[num_words_secp224r1];
+2 -1
View File
@@ -36,6 +36,7 @@ uint8_t mf_classic_get_total_sectors_num(MfClassicReader* reader) {
}
bool mf_classic_check_card_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) {
UNUSED(ATQA1);
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08)) {
return true;
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
@@ -52,6 +53,7 @@ bool mf_classic_get_type(
uint8_t ATQA1,
uint8_t SAK,
MfClassicReader* reader) {
UNUSED(ATQA1);
furi_assert(uid);
furi_assert(reader);
memset(reader, 0, sizeof(MfClassicReader));
@@ -204,7 +206,6 @@ bool mf_classic_read_block(
MfClassicBlock* block) {
furi_assert(tx_rx);
furi_assert(crypto);
furi_assert(block_num < MF_CLASSIC_TOTAL_BLOCKS_MAX);
furi_assert(block);
bool read_block_success = false;
+1 -1
View File
@@ -444,4 +444,4 @@ bool mf_df_parse_read_data_response(uint8_t* buf, uint16_t len, MifareDesfireFil
out->contents = malloc(len);
memcpy(out->contents, buf, len);
return true;
}
}
+1 -1
View File
@@ -123,4 +123,4 @@ bool mf_ul_prepare_emulation_response(
uint8_t* buff_tx,
uint16_t* buff_tx_len,
uint32_t* data_type,
void* context);
void* context);
-16
View File
@@ -45,19 +45,3 @@ uint8_t nfc_util_even_parity32(uint32_t data) {
uint8_t nfc_util_odd_parity8(uint8_t data) {
return nfc_util_odd_byte_parity[data];
}
void nfc_util_merge_data_and_parity(
uint8_t* data,
uint16_t data_len,
uint8_t* parity,
uint16_t parity_len,
uint8_t* res,
uint16_t* res_len);
void nfc_util_split_data_and_parity(
uint8_t* data,
uint16_t data_len,
uint8_t* parity,
uint16_t parity_len,
uint8_t* res,
uint16_t* res_len);
-16
View File
@@ -9,19 +9,3 @@ uint64_t nfc_util_bytes2num(uint8_t* src, uint8_t len);
uint8_t nfc_util_even_parity32(uint32_t data);
uint8_t nfc_util_odd_parity8(uint8_t data);
void nfc_util_merge_data_and_parity(
uint8_t* data,
uint16_t data_len,
uint8_t* parity,
uint16_t parity_len,
uint8_t* res,
uint16_t* res_len);
void nfc_util_split_data_and_parity(
uint8_t* data,
uint16_t data_len,
uint8_t* parity,
uint16_t parity_len,
uint8_t* res,
uint16_t* res_len);
+1 -1
View File
@@ -52,4 +52,4 @@ bool nfca_emulation_handler(
}
return sleep;
}
}
@@ -51,4 +51,4 @@ void encoder_cyfral_get_pulse(EncoderCyfral* cyfral, bool* polarity, uint32_t* l
#ifdef __cplusplus
}
#endif
#endif
@@ -51,4 +51,4 @@ void encoder_metakom_get_pulse(EncoderMetakom* metakom, bool* polarity, uint32_t
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -118,4 +118,4 @@ bool ibutton_key_dallas_crc_is_valid(iButtonKey* key) {
bool ibutton_key_dallas_is_1990_key(iButtonKey* key) {
return (key->data[0] == 0x01);
}
}
+1 -1
View File
@@ -142,4 +142,4 @@ bool ibutton_key_dallas_is_1990_key(iButtonKey* key);
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -25,4 +25,4 @@
#define TM01_CMD_SWITCH_TO_CYFRAL 0xCA
#define TM01_CMD_SWITCH_TO_METAKOM 0xCB
#define DS1990_CMD_READ_ROM 0x33
#define DS1990_CMD_READ_ROM 0x33
+1 -1
View File
@@ -110,4 +110,4 @@ void ibutton_worker_stop(iButtonWorker* worker);
#ifdef __cplusplus
}
#endif
#endif
+4 -4
View File
@@ -27,9 +27,9 @@ typedef enum {
typedef struct {
const uint32_t quant;
const void (*start)(iButtonWorker* worker);
const void (*tick)(iButtonWorker* worker);
const void (*stop)(iButtonWorker* worker);
void (*const start) (iButtonWorker* worker);
void (*const tick) (iButtonWorker* worker);
void (*const stop) (iButtonWorker* worker);
} iButtonWorkerModeType;
typedef enum {
@@ -76,4 +76,4 @@ void ibutton_worker_switch_mode(iButtonWorker* worker, iButtonWorkerMode mode);
#ifdef __cplusplus
}
#endif
#endif
+8 -1
View File
@@ -49,12 +49,15 @@ const iButtonWorkerModeType ibutton_worker_modes[] = {
/*********************** IDLE ***********************/
void ibutton_worker_mode_idle_start(iButtonWorker* worker) {
UNUSED(worker);
}
void ibutton_worker_mode_idle_tick(iButtonWorker* worker) {
UNUSED(worker);
}
void ibutton_worker_mode_idle_stop(iButtonWorker* worker) {
UNUSED(worker);
}
/*********************** READ ***********************/
@@ -151,6 +154,7 @@ bool ibutton_worker_read_dallas(iButtonWorker* worker) {
}
void ibutton_worker_mode_read_start(iButtonWorker* worker) {
UNUSED(worker);
furi_hal_power_enable_otg();
}
@@ -172,6 +176,7 @@ void ibutton_worker_mode_read_tick(iButtonWorker* worker) {
}
void ibutton_worker_mode_read_stop(iButtonWorker* worker) {
UNUSED(worker);
furi_hal_power_disable_otg();
}
@@ -251,6 +256,7 @@ void ibutton_worker_emulate_timer_start(iButtonWorker* worker) {
}
void ibutton_worker_emulate_timer_stop(iButtonWorker* worker) {
UNUSED(worker);
furi_hal_ibutton_emulate_stop();
}
@@ -272,6 +278,7 @@ void ibutton_worker_mode_emulate_start(iButtonWorker* worker) {
}
void ibutton_worker_mode_emulate_tick(iButtonWorker* worker) {
UNUSED(worker);
}
void ibutton_worker_mode_emulate_stop(iButtonWorker* worker) {
@@ -327,4 +334,4 @@ void ibutton_worker_mode_write_tick(iButtonWorker* worker) {
void ibutton_worker_mode_write_stop(iButtonWorker* worker) {
furi_hal_power_disable_otg();
onewire_host_stop(worker->host);
}
}
+1 -1
View File
@@ -57,4 +57,4 @@ void ibutton_writer_stop(iButtonWriter* writer);
#ifdef __cplusplus
}
#endif
#endif
@@ -35,4 +35,4 @@ PulseProtocol* protocol_cyfral_get_protocol(ProtocolCyfral* cyfral);
#ifdef __cplusplus
}
#endif
#endif
@@ -35,4 +35,4 @@ PulseProtocol* protocol_metakom_get_protocol(ProtocolMetakom* metakom);
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -13,4 +13,4 @@ uint8_t maxim_crc8(const uint8_t* data, const uint8_t data_size, const uint8_t c
}
}
return crc;
}
}
+1 -1
View File
@@ -11,4 +11,4 @@ uint8_t maxim_crc8(const uint8_t* data, const uint8_t data_size, const uint8_t c
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -71,4 +71,4 @@ uint8_t* onewire_device_get_id_p(OneWireDevice* device);
#ifdef __cplusplus
}
#endif
#endif
+5
View File
@@ -23,6 +23,7 @@ void onewire_host_free(OneWireHost* host) {
}
bool onewire_host_reset(OneWireHost* host) {
UNUSED(host);
uint8_t r;
uint8_t retries = 125;
@@ -52,6 +53,7 @@ bool onewire_host_reset(OneWireHost* host) {
}
bool onewire_host_read_bit(OneWireHost* host) {
UNUSED(host);
bool result;
// drive low
@@ -88,6 +90,7 @@ void onewire_host_read_bytes(OneWireHost* host, uint8_t* buffer, uint16_t count)
}
void onewire_host_write_bit(OneWireHost* host, bool value) {
UNUSED(host);
if(value) {
// drive low
furi_hal_ibutton_pin_low();
@@ -120,10 +123,12 @@ void onewire_host_skip(OneWireHost* host) {
}
void onewire_host_start(OneWireHost* host) {
UNUSED(host);
furi_hal_ibutton_start_drive();
}
void onewire_host_stop(OneWireHost* host) {
UNUSED(host);
furi_hal_ibutton_stop();
}
+1 -1
View File
@@ -118,4 +118,4 @@ uint8_t onewire_host_search(OneWireHost* host, uint8_t* newAddr, OneWireHostSear
#ifdef __cplusplus
}
#endif
#endif
+2
View File
@@ -37,6 +37,7 @@ struct OneWireSlave {
/*********************** PRIVATE ***********************/
uint32_t onewire_slave_wait_while_gpio_is(OneWireSlave* bus, uint32_t time, const bool pin_value) {
UNUSED(bus);
uint32_t start = DWT->CYCCNT;
uint32_t time_ticks = time * furi_hal_delay_instructions_per_microsecond();
uint32_t time_captured;
@@ -253,6 +254,7 @@ void onewire_slave_start(OneWireSlave* bus) {
}
void onewire_slave_stop(OneWireSlave* bus) {
UNUSED(bus);
furi_hal_ibutton_stop();
furi_hal_ibutton_remove_interrupt();
}
+1 -1
View File
@@ -67,4 +67,4 @@ void pulse_decoder_get_data(PulseDecoder* decoder, int32_t index, uint8_t* data,
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -23,4 +23,4 @@ void pulse_glue_pop(PulseGlue* pulse_glue, uint32_t* length, uint32_t* period);
#ifdef __cplusplus
}
#endif
#endif
@@ -64,4 +64,4 @@ void pulse_protocol_get_data(PulseProtocol* protocol, uint8_t* data, size_t leng
if(protocol->get_data_cb != NULL) {
protocol->get_data_cb(protocol->context, data, length);
}
}
}
@@ -119,4 +119,4 @@ void pulse_protocol_reset(PulseProtocol* protocol);
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -972,4 +972,4 @@ bool qrcode_getModule(QRCode* qrcode, uint8_t x, uint8_t y) {
uint32_t offset = y * qrcode->size + x;
return (qrcode->modules[offset >> 3] & (1 << (7 - (offset & 0x07)))) != 0;
}
}
+1 -1
View File
@@ -96,4 +96,4 @@ bool qrcode_getModule(QRCode* qrcode, uint8_t x, uint8_t y);
}
#endif /* __cplusplus */
#endif /* __QRCODE_H_ */
#endif /* __QRCODE_H_ */
+2
View File
@@ -76,6 +76,7 @@ const SubGhzProtocol subghz_protocol_came = {
};
void* subghz_protocol_encoder_came_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderCame* instance = malloc(sizeof(SubGhzProtocolEncoderCame));
instance->base.protocol = &subghz_protocol_came;
@@ -182,6 +183,7 @@ LevelDuration subghz_protocol_encoder_came_yield(void* context) {
}
void* subghz_protocol_decoder_came_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderCame* instance = malloc(sizeof(SubGhzProtocolDecoderCame));
instance->base.protocol = &subghz_protocol_came;
instance->generic.protocol_name = instance->base.protocol->name;
+1 -1
View File
@@ -136,7 +136,7 @@ void subghz_protocol_decoder_came_atomo_feed(void* context, bool level, uint32_t
subghz_protocol_came_atomo_const.te_delta) {
event = ManchesterEventLongLow;
} else if(
duration >= (subghz_protocol_came_atomo_const.te_long * 2 +
duration >= ((uint32_t)subghz_protocol_came_atomo_const.te_long * 2 +
subghz_protocol_came_atomo_const.te_delta)) {
if(instance->decoder.decode_count_bit ==
subghz_protocol_came_atomo_const.min_count_bit_for_found) {
+3 -1
View File
@@ -103,6 +103,7 @@ const SubGhzProtocol subghz_protocol_came_twee = {
};
void* subghz_protocol_encoder_came_twee_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderCameTwee* instance = malloc(sizeof(SubGhzProtocolEncoderCameTwee));
instance->base.protocol = &subghz_protocol_came_twee;
@@ -289,6 +290,7 @@ LevelDuration subghz_protocol_encoder_came_twee_yield(void* context) {
}
void* subghz_protocol_decoder_came_twee_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderCameTwee* instance = malloc(sizeof(SubGhzProtocolDecoderCameTwee));
instance->base.protocol = &subghz_protocol_came_twee;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -351,7 +353,7 @@ void subghz_protocol_decoder_came_twee_feed(void* context, bool level, uint32_t
subghz_protocol_came_twee_const.te_delta) {
event = ManchesterEventLongLow;
} else if(
duration >= (subghz_protocol_came_twee_const.te_long * 2 +
duration >= ((uint32_t)subghz_protocol_came_twee_const.te_long * 2 +
subghz_protocol_came_twee_const.te_delta)) {
if(instance->decoder.decode_count_bit >=
subghz_protocol_came_twee_const.min_count_bit_for_found) {
+2 -1
View File
@@ -69,6 +69,7 @@ const SubGhzProtocol subghz_protocol_faac_slh = {
};
void* subghz_protocol_decoder_faac_slh_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderFaacSLH* instance = malloc(sizeof(SubGhzProtocolDecoderFaacSLH));
instance->base.protocol = &subghz_protocol_faac_slh;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -111,7 +112,7 @@ void subghz_protocol_decoder_faac_slh_feed(void* context, bool level, uint32_t d
break;
case FaacSLHDecoderStepSaveDuration:
if(level) {
if(duration >= (subghz_protocol_faac_slh_const.te_short * 3 +
if(duration >= ((uint32_t)subghz_protocol_faac_slh_const.te_short * 3 +
subghz_protocol_faac_slh_const.te_delta)) {
instance->decoder.parser_step = FaacSLHDecoderStepFoundPreambula;
if(instance->decoder.decode_count_bit >=
+2
View File
@@ -75,6 +75,7 @@ const SubGhzProtocol subghz_protocol_firefly = {
};
void* subghz_protocol_encoder_firefly_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderFirefly* instance = malloc(sizeof(SubGhzProtocolEncoderFirefly));
instance->base.protocol = &subghz_protocol_firefly;
@@ -193,6 +194,7 @@ LevelDuration subghz_protocol_encoder_firefly_yield(void* context) {
}
void* subghz_protocol_decoder_firefly_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderFirefly* instance = malloc(sizeof(SubGhzProtocolDecoderFirefly));
instance->base.protocol = &subghz_protocol_firefly;
instance->generic.protocol_name = instance->base.protocol->name;
+3 -1
View File
@@ -69,6 +69,7 @@ const SubGhzProtocol subghz_protocol_gate_tx = {
};
void* subghz_protocol_encoder_gate_tx_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderGateTx* instance = malloc(sizeof(SubGhzProtocolEncoderGateTx));
instance->base.protocol = &subghz_protocol_gate_tx;
@@ -175,6 +176,7 @@ LevelDuration subghz_protocol_encoder_gate_tx_yield(void* context) {
}
void* subghz_protocol_decoder_gate_tx_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderGateTx* instance = malloc(sizeof(SubGhzProtocolDecoderGateTx));
instance->base.protocol = &subghz_protocol_gate_tx;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -218,7 +220,7 @@ void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t du
break;
case GateTXDecoderStepSaveDuration:
if(!level) {
if(duration >= (subghz_protocol_gate_tx_const.te_short * 10 +
if(duration >= ((uint32_t)subghz_protocol_gate_tx_const.te_short * 10 +
subghz_protocol_gate_tx_const.te_delta)) {
instance->decoder.parser_step = GateTXDecoderStepFoundStartBit;
if(instance->decoder.decode_count_bit >=
+2
View File
@@ -72,6 +72,7 @@ const SubGhzProtocol subghz_protocol_hormann = {
};
void* subghz_protocol_encoder_hormann_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderHormann* instance = malloc(sizeof(SubGhzProtocolEncoderHormann));
instance->base.protocol = &subghz_protocol_hormann;
@@ -191,6 +192,7 @@ LevelDuration subghz_protocol_encoder_hormann_yield(void* context) {
}
void* subghz_protocol_decoder_hormann_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderHormann* instance = malloc(sizeof(SubGhzProtocolDecoderHormann));
instance->base.protocol = &subghz_protocol_hormann;
instance->generic.protocol_name = instance->base.protocol->name;
+3 -2
View File
@@ -68,6 +68,7 @@ const SubGhzProtocol subghz_protocol_ido = {
};
void* subghz_protocol_decoder_ido_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderIDo* instance = malloc(sizeof(SubGhzProtocolDecoderIDo));
instance->base.protocol = &subghz_protocol_ido;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -111,8 +112,8 @@ void subghz_protocol_decoder_ido_feed(void* context, bool level, uint32_t durati
break;
case IDoDecoderStepSaveDuration:
if(level) {
if(duration >=
(subghz_protocol_ido_const.te_short * 5 + subghz_protocol_ido_const.te_delta)) {
if(duration >= ((uint32_t)subghz_protocol_ido_const.te_short * 5 +
subghz_protocol_ido_const.te_delta)) {
instance->decoder.parser_step = IDoDecoderStepFoundPreambula;
if(instance->decoder.decode_count_bit >=
subghz_protocol_ido_const.min_count_bit_for_found) {
+1 -1
View File
@@ -72,4 +72,4 @@ bool subghz_protocol_decoder_ido_deserialize(void* context, FlipperFormat* flipp
* @param context Pointer to a SubGhzProtocolDecoderIDo instance
* @param output Resulting text
*/
void subghz_protocol_decoder_ido_get_string(void* context, string_t output);
void subghz_protocol_decoder_ido_get_string(void* context, string_t output);
+1 -1
View File
@@ -384,7 +384,7 @@ void subghz_protocol_decoder_keeloq_feed(void* context, bool level, uint32_t dur
break;
case KeeloqDecoderStepCheckDuration:
if(!level) {
if(duration >= (subghz_protocol_keeloq_const.te_short * 2 +
if(duration >= ((uint32_t)subghz_protocol_keeloq_const.te_short * 2 +
subghz_protocol_keeloq_const.te_delta)) {
// Found end TX
instance->decoder.parser_step = KeeloqDecoderStepReset;
+1 -1
View File
@@ -81,4 +81,4 @@ inline uint64_t
subghz_protocol_keeloq_common_magic_xor_type1_learning(uint32_t data, uint64_t xor) {
data &= 0x0FFFFFFF;
return (((uint64_t)data << 32) | data) ^ xor;
}
}
+2 -1
View File
@@ -70,6 +70,7 @@ const SubGhzProtocol subghz_protocol_kia = {
};
void* subghz_protocol_decoder_kia_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderKIA* instance = malloc(sizeof(SubGhzProtocolDecoderKIA));
instance->base.protocol = &subghz_protocol_kia;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -141,7 +142,7 @@ void subghz_protocol_decoder_kia_feed(void* context, bool level, uint32_t durati
case KIADecoderStepSaveDuration:
if(level) {
if(duration >=
(subghz_protocol_kia_const.te_long + subghz_protocol_kia_const.te_delta * 2)) {
(uint32_t)(subghz_protocol_kia_const.te_long + subghz_protocol_kia_const.te_delta * 2)) {
//Found stop bit
instance->decoder.parser_step = KIADecoderStepReset;
if(instance->decoder.decode_count_bit >=
+3 -1
View File
@@ -71,6 +71,7 @@ const SubGhzProtocol subghz_protocol_nero_radio = {
};
void* subghz_protocol_encoder_nero_radio_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderNeroRadio* instance = malloc(sizeof(SubGhzProtocolEncoderNeroRadio));
instance->base.protocol = &subghz_protocol_nero_radio;
@@ -200,6 +201,7 @@ LevelDuration subghz_protocol_encoder_nero_radio_yield(void* context) {
}
void* subghz_protocol_decoder_nero_radio_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderNeroRadio* instance = malloc(sizeof(SubGhzProtocolDecoderNeroRadio));
instance->base.protocol = &subghz_protocol_nero_radio;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -278,7 +280,7 @@ void subghz_protocol_decoder_nero_radio_feed(void* context, bool level, uint32_t
break;
case NeroRadioDecoderStepCheckDuration:
if(!level) {
if(duration >= (subghz_protocol_nero_radio_const.te_short * 10 +
if(duration >= ((uint32_t)subghz_protocol_nero_radio_const.te_short * 10 +
subghz_protocol_nero_radio_const.te_delta * 2)) {
//Found stop bit
if(DURATION_DIFF(
+2
View File
@@ -70,6 +70,7 @@ const SubGhzProtocol subghz_protocol_nero_sketch = {
};
void* subghz_protocol_encoder_nero_sketch_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderNeroSketch* instance = malloc(sizeof(SubGhzProtocolEncoderNeroSketch));
instance->base.protocol = &subghz_protocol_nero_sketch;
@@ -194,6 +195,7 @@ LevelDuration subghz_protocol_encoder_nero_sketch_yield(void* context) {
}
void* subghz_protocol_decoder_nero_sketch_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderNeroSketch* instance = malloc(sizeof(SubGhzProtocolDecoderNeroSketch));
instance->base.protocol = &subghz_protocol_nero_sketch;
instance->generic.protocol_name = instance->base.protocol->name;
+2
View File
@@ -69,6 +69,7 @@ const SubGhzProtocol subghz_protocol_nice_flo = {
};
void* subghz_protocol_encoder_nice_flo_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderNiceFlo* instance = malloc(sizeof(SubGhzProtocolEncoderNiceFlo));
instance->base.protocol = &subghz_protocol_nice_flo;
@@ -175,6 +176,7 @@ LevelDuration subghz_protocol_encoder_nice_flo_yield(void* context) {
}
void* subghz_protocol_decoder_nice_flo_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderNiceFlo* instance = malloc(sizeof(SubGhzProtocolDecoderNiceFlo));
instance->base.protocol = &subghz_protocol_nice_flo;
instance->generic.protocol_name = instance->base.protocol->name;
+1 -1
View File
@@ -106,4 +106,4 @@ bool subghz_protocol_decoder_nice_flo_deserialize(void* context, FlipperFormat*
* @param context Pointer to a SubGhzProtocolDecoderNiceFlo instance
* @param output Resulting text
*/
void subghz_protocol_decoder_nice_flo_get_string(void* context, string_t output);
void subghz_protocol_decoder_nice_flo_get_string(void* context, string_t output);
+3 -1
View File
@@ -80,6 +80,7 @@ const SubGhzProtocol subghz_protocol_princeton = {
};
void* subghz_protocol_encoder_princeton_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderPrinceton* instance = malloc(sizeof(SubGhzProtocolEncoderPrinceton));
instance->base.protocol = &subghz_protocol_princeton;
@@ -194,6 +195,7 @@ LevelDuration subghz_protocol_encoder_princeton_yield(void* context) {
}
void* subghz_protocol_decoder_princeton_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderPrinceton* instance = malloc(sizeof(SubGhzProtocolDecoderPrinceton));
instance->base.protocol = &subghz_protocol_princeton;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -238,7 +240,7 @@ void subghz_protocol_decoder_princeton_feed(void* context, bool level, uint32_t
break;
case PrincetonDecoderStepCheckDuration:
if(!level) {
if(duration >= (subghz_protocol_princeton_const.te_short * 10 +
if(duration >= ((uint32_t)subghz_protocol_princeton_const.te_short * 10 +
subghz_protocol_princeton_const.te_delta)) {
instance->decoder.parser_step = PrincetonDecoderStepSaveDuration;
if(instance->decoder.decode_count_bit ==
+1 -1
View File
@@ -249,7 +249,7 @@ void subghz_decoder_princeton_for_testing_parse(
break;
case PrincetonDecoderStepCheckDuration:
if(!level) {
if(duration >= (instance->te_short * 10 + instance->te_delta)) {
if(duration >= ((uint32_t)instance->te_short * 10 + instance->te_delta)) {
instance->parser_step = PrincetonDecoderStepSaveDuration;
if(instance->code_count_bit == instance->code_min_count_bit_for_found) {
instance->te /= (instance->code_count_bit * 4 + 1);
+2
View File
@@ -192,6 +192,7 @@ size_t subghz_protocol_raw_get_sample_write(SubGhzProtocolDecoderRAW* instance)
}
void* subghz_protocol_decoder_raw_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderRAW* instance = malloc(sizeof(SubGhzProtocolDecoderRAW));
instance->base.protocol = &subghz_protocol_raw;
instance->upload_raw = NULL;
@@ -243,6 +244,7 @@ void subghz_protocol_decoder_raw_get_string(void* context, string_t output) {
}
void* subghz_protocol_encoder_raw_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolEncoderRAW* instance = malloc(sizeof(SubGhzProtocolEncoderRAW));
instance->base.protocol = &subghz_protocol_raw;
+2 -1
View File
@@ -76,6 +76,7 @@ const SubGhzProtocol subghz_protocol_scher_khan = {
};
void* subghz_protocol_decoder_scher_khan_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderScherKhan* instance = malloc(sizeof(SubGhzProtocolDecoderScherKhan));
instance->base.protocol = &subghz_protocol_scher_khan;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -150,7 +151,7 @@ void subghz_protocol_decoder_scher_khan_feed(void* context, bool level, uint32_t
break;
case ScherKhanDecoderStepSaveDuration:
if(level) {
if(duration >= (subghz_protocol_scher_khan_const.te_long +
if(duration >= (uint32_t)(subghz_protocol_scher_khan_const.te_long +
subghz_protocol_scher_khan_const.te_delta * 2)) {
//Found stop bit
instance->decoder.parser_step = ScherKhanDecoderStepReset;
+2 -1
View File
@@ -89,6 +89,7 @@ const SubGhzProtocol subghz_protocol_secplus_v1 = {
};
void* subghz_protocol_decoder_secplus_v1_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderSecPlus_v1* instance = malloc(sizeof(SubGhzProtocolDecoderSecPlus_v1));
instance->base.protocol = &subghz_protocol_secplus_v1;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -321,7 +322,7 @@ void subghz_protocol_decoder_secplus_v1_get_string(void* context, string_t outpu
// pin = (fixed // 3**10) % (3**9) 3^10=59049 3^9=19683
pin = (fixed / 59049) % 19683;
if(0 <= pin && pin <= 9999) {
if(pin <= 9999) {
string_cat_printf(output, " pin:%d", pin);
} else if(10000 <= pin && pin <= 11029) {
string_cat_printf(output, " pin:enter");
+2 -1
View File
@@ -81,6 +81,7 @@ const SubGhzProtocol subghz_protocol_secplus_v2 = {
};
void* subghz_protocol_decoder_secplus_v2_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderSecPlus_v2* instance = malloc(sizeof(SubGhzProtocolDecoderSecPlus_v2));
instance->base.protocol = &subghz_protocol_secplus_v2;
instance->generic.protocol_name = instance->base.protocol->name;
@@ -154,7 +155,7 @@ void subghz_protocol_decoder_secplus_v2_feed(void* context, bool level, uint32_t
subghz_protocol_secplus_v2_const.te_delta) {
event = ManchesterEventLongLow;
} else if(
duration >= (subghz_protocol_secplus_v2_const.te_long * 2 +
duration >= (uint32_t)(subghz_protocol_secplus_v2_const.te_long * 2 +
subghz_protocol_secplus_v2_const.te_delta)) {
if(instance->decoder.decode_count_bit >=
subghz_protocol_secplus_v2_const.min_count_bit_for_found) {
+1
View File
@@ -75,6 +75,7 @@ const SubGhzProtocol subghz_protocol_somfy_keytis = {
};
void* subghz_protocol_decoder_somfy_keytis_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderSomfyKeytis* instance = malloc(sizeof(SubGhzProtocolDecoderSomfyKeytis));
instance->base.protocol = &subghz_protocol_somfy_keytis;
instance->generic.protocol_name = instance->base.protocol->name;
+1
View File
@@ -74,6 +74,7 @@ const SubGhzProtocol subghz_protocol_somfy_telis = {
};
void* subghz_protocol_decoder_somfy_telis_alloc(SubGhzEnvironment* environment) {
UNUSED(environment);
SubGhzProtocolDecoderSomfyTelis* instance = malloc(sizeof(SubGhzProtocolDecoderSomfyTelis));
instance->base.protocol = &subghz_protocol_somfy_telis;
instance->generic.protocol_name = instance->base.protocol->name;
+2 -2
View File
@@ -303,7 +303,7 @@ bool subghz_keystore_save(SubGhzKeystore* instance, const char* file_name, uint8
}
// HEX Encode encrypted line
const char xx[] = "0123456789ABCDEF";
for(size_t i = 0; i < len; i++) {
for(int i = 0; i < len; i++) {
size_t cursor = len - i - 1;
size_t hex_cursor = len * 2 - i * 2 - 1;
encrypted_line[hex_cursor] = xx[encrypted_line[cursor] & 0xF];
@@ -601,4 +601,4 @@ bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t*
string_clear(str_temp);
return result;
}
}
+1 -1
View File
@@ -92,4 +92,4 @@ bool args_read_hex_bytes(string_t args, uint8_t* bytes, size_t bytes_count) {
}
return result;
}
}
+1 -1
View File
@@ -78,4 +78,4 @@ bool args_char_to_hex(char hi_nibble, char low_nibble, uint8_t* byte);
#ifdef __cplusplus
}
#endif
#endif

Some files were not shown because too many files have changed in this diff Show More