From fb80d344669c94132e695d1bb137b92581271c04 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Thu, 7 Nov 2024 05:39:45 +0000 Subject: [PATCH] Revert "NFC: Add API to enforce ISO15693 mode (#225)" This reverts commit 5afc01a4c31dc2df0e17b261f19334ff15ada15a. --- lib/nfc/nfc.c | 27 ------------------ lib/nfc/nfc.h | 24 ---------------- .../parsers/iso15693/iso15693_parser.c | 28 ++----------------- .../parsers/iso15693/iso15693_parser.h | 4 --- targets/f7/api_symbols.csv | 8 +----- targets/f7/furi_hal/furi_hal_nfc_iso15693.c | 18 ------------ targets/furi_hal_include/furi_hal_nfc.h | 18 ------------ 7 files changed, 4 insertions(+), 123 deletions(-) diff --git a/lib/nfc/nfc.c b/lib/nfc/nfc.c index 4f43587111..90e65b282f 100644 --- a/lib/nfc/nfc.c +++ b/lib/nfc/nfc.c @@ -646,33 +646,6 @@ NfcError nfc_iso15693_listener_tx_sof(Nfc* instance) { return ret; } -NfcError nfc_iso15693_detect_mode(Nfc* instance) { - furi_check(instance); - - FuriHalNfcError error = furi_hal_nfc_iso15693_detect_mode(); - NfcError ret = nfc_process_hal_error(error); - - return ret; -} - -NfcError nfc_iso15693_force_1outof4(Nfc* instance) { - furi_check(instance); - - FuriHalNfcError error = furi_hal_nfc_iso15693_force_1outof4(); - NfcError ret = nfc_process_hal_error(error); - - return ret; -} - -NfcError nfc_iso15693_force_1outof256(Nfc* instance) { - furi_check(instance); - - FuriHalNfcError error = furi_hal_nfc_iso15693_force_1outof256(); - NfcError ret = nfc_process_hal_error(error); - - return ret; -} - NfcError nfc_felica_listener_set_sensf_res_data( Nfc* instance, const uint8_t* idm, diff --git a/lib/nfc/nfc.h b/lib/nfc/nfc.h index ebd29dc4b1..8fbf90d1fa 100644 --- a/lib/nfc/nfc.h +++ b/lib/nfc/nfc.h @@ -380,30 +380,6 @@ NfcError nfc_felica_listener_set_sensf_res_data( */ NfcError nfc_iso15693_listener_tx_sof(Nfc* instance); -/** - * @brief Set ISO15693 parser mode to autodetect - * -* @param[in,out] instance pointer to the instance to be configured. - * @returns NfcErrorNone on success, any other error code on failure. -*/ -NfcError nfc_iso15693_detect_mode(Nfc* instance); - -/** - * @brief Set ISO15693 parser mode to 1OutOf4, disables autodetection - * - * @param[in,out] instance pointer to the instance to be configured. - * @return NfcErrorNone on success, any other error code on failure. -*/ -NfcError nfc_iso15693_force_1outof4(Nfc* instance); - -/** - * @brief Set ISO15693 parser mode to 1OutOf256, disables autodetection - * - * @param[in,out] instance pointer to the instance to be configured. - * @return NfcErrorNone on success, any other error code on failure. -*/ -NfcError nfc_iso15693_force_1outof256(Nfc* instance); - #ifdef __cplusplus } #endif diff --git a/lib/signal_reader/parsers/iso15693/iso15693_parser.c b/lib/signal_reader/parsers/iso15693/iso15693_parser.c index f4065e4971..a2c6912e63 100644 --- a/lib/signal_reader/parsers/iso15693/iso15693_parser.c +++ b/lib/signal_reader/parsers/iso15693/iso15693_parser.c @@ -26,7 +26,6 @@ typedef enum { struct Iso15693Parser { Iso15693ParserState state; Iso15693ParserMode mode; - bool detect_mode; SignalReader* signal_reader; @@ -63,7 +62,6 @@ typedef Iso15693ParserCommand (*Iso15693ParserStateHandler)(Iso15693Parser* inst Iso15693Parser* iso15693_parser_alloc(const GpioPin* pin, size_t max_frame_size) { Iso15693Parser* instance = malloc(sizeof(Iso15693Parser)); - instance->detect_mode = true; instance->parsed_frame = bit_buffer_alloc(max_frame_size); instance->signal_reader = signal_reader_alloc(pin, ISO15693_PARSER_SIGNAL_READER_BUFF_SIZE); @@ -88,7 +86,7 @@ void iso15693_parser_reset(Iso15693Parser* instance) { furi_assert(instance); instance->state = Iso15693ParserStateParseSoF; - if(instance->detect_mode) instance->mode = Iso15693ParserMode1OutOf4; + instance->mode = Iso15693ParserMode1OutOf4; memset(instance->bitstream_buff, 0x00, sizeof(instance->bitstream_buff)); instance->bitstream_idx = 0; @@ -124,10 +122,10 @@ static void signal_reader_callback(SignalReaderEvent event, void* context) { if(instance->state == Iso15693ParserStateParseSoF) { if(event.data->data[0] == sof_1_out_of_4) { - if(instance->detect_mode) instance->mode = Iso15693ParserMode1OutOf4; + instance->mode = Iso15693ParserMode1OutOf4; instance->state = Iso15693ParserStateParseFrame; } else if(event.data->data[0] == sof_1_out_of_256) { - if(instance->detect_mode) instance->mode = Iso15693ParserMode1OutOf256; + instance->mode = Iso15693ParserMode1OutOf256; instance->state = Iso15693ParserStateParseFrame; } else if(event.data->data[0] == eof_single) { instance->eof_received = true; @@ -300,23 +298,3 @@ void iso15693_parser_get_data( bit_buffer_write_bytes(instance->parsed_frame, buff, buff_size); *data_bits = bit_buffer_get_size(instance->parsed_frame); } - -void iso15693_parser_detect_mode(Iso15693Parser* instance) { - furi_assert(instance); - - instance->detect_mode = true; -} - -void iso15693_parser_force_1outof4(Iso15693Parser* instance) { - furi_assert(instance); - - instance->detect_mode = false; - instance->mode = Iso15693ParserMode1OutOf4; -} - -void iso15693_parser_force_1outof256(Iso15693Parser* instance) { - furi_assert(instance); - - instance->detect_mode = false; - instance->mode = Iso15693ParserMode1OutOf256; -} diff --git a/lib/signal_reader/parsers/iso15693/iso15693_parser.h b/lib/signal_reader/parsers/iso15693/iso15693_parser.h index 66486e0e7a..3017a96d79 100644 --- a/lib/signal_reader/parsers/iso15693/iso15693_parser.h +++ b/lib/signal_reader/parsers/iso15693/iso15693_parser.h @@ -37,10 +37,6 @@ void iso15693_parser_get_data( size_t buff_size, size_t* data_bits); -void iso15693_parser_detect_mode(Iso15693Parser* instance); -void iso15693_parser_force_1outof4(Iso15693Parser* instance); -void iso15693_parser_force_1outof256(Iso15693Parser* instance); - #ifdef __cplusplus } #endif diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index cd892e373a..684bd49b48 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -983,8 +983,8 @@ Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed Function,+,dolphin_flush,void,Dolphin* Function,+,dolphin_get_pubsub,FuriPubSub*,Dolphin* Function,+,dolphin_get_settings,void,"Dolphin*, DolphinSettings*" -Function,+,dolphin_reload_state,void,Dolphin* Function,+,dolphin_set_settings,void,"Dolphin*, DolphinSettings*" +Function,+,dolphin_reload_state,void,Dolphin* Function,+,dolphin_stats,DolphinStats,Dolphin* Function,+,dolphin_upgrade_level,void,Dolphin* Function,-,dprintf,int,"int, const char*, ..." @@ -1519,9 +1519,6 @@ Function,+,furi_hal_nfc_iso14443a_poller_trx_short_frame,FuriHalNfcError,FuriHal Function,+,furi_hal_nfc_iso14443a_poller_tx_custom_parity,FuriHalNfcError,"const uint8_t*, size_t" Function,+,furi_hal_nfc_iso14443a_rx_sdd_frame,FuriHalNfcError,"uint8_t*, size_t, size_t*" Function,+,furi_hal_nfc_iso14443a_tx_sdd_frame,FuriHalNfcError,"const uint8_t*, size_t" -Function,+,furi_hal_nfc_iso15693_detect_mode,FuriHalNfcError, -Function,+,furi_hal_nfc_iso15693_force_1outof256,FuriHalNfcError, -Function,+,furi_hal_nfc_iso15693_force_1outof4,FuriHalNfcError, Function,+,furi_hal_nfc_iso15693_listener_tx_sof,FuriHalNfcError, Function,+,furi_hal_nfc_listener_enable_rx,FuriHalNfcError, Function,+,furi_hal_nfc_listener_idle,FuriHalNfcError, @@ -2884,9 +2881,6 @@ Function,+,nfc_iso14443a_listener_tx_custom_parity,NfcError,"Nfc*, const BitBuff Function,+,nfc_iso14443a_poller_trx_custom_parity,NfcError,"Nfc*, const BitBuffer*, BitBuffer*, uint32_t" Function,+,nfc_iso14443a_poller_trx_sdd_frame,NfcError,"Nfc*, const BitBuffer*, BitBuffer*, uint32_t" Function,+,nfc_iso14443a_poller_trx_short_frame,NfcError,"Nfc*, NfcIso14443aShortFrame, BitBuffer*, uint32_t" -Function,+,nfc_iso15693_detect_mode,NfcError,Nfc* -Function,+,nfc_iso15693_force_1outof256,NfcError,Nfc* -Function,+,nfc_iso15693_force_1outof4,NfcError,Nfc* Function,+,nfc_iso15693_listener_tx_sof,NfcError,Nfc* Function,+,nfc_listener_alloc,NfcListener*,"Nfc*, NfcProtocol, const NfcDeviceData*" Function,+,nfc_listener_free,void,NfcListener* diff --git a/targets/f7/furi_hal/furi_hal_nfc_iso15693.c b/targets/f7/furi_hal/furi_hal_nfc_iso15693.c index 0fd5dbca5d..3245b67cc8 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_iso15693.c +++ b/targets/f7/furi_hal/furi_hal_nfc_iso15693.c @@ -406,24 +406,6 @@ FuriHalNfcError furi_hal_nfc_iso15693_listener_tx_sof(void) { return FuriHalNfcErrorNone; } -FuriHalNfcError furi_hal_nfc_iso15693_detect_mode(void) { - iso15693_parser_detect_mode(furi_hal_nfc_iso15693_listener->parser); - - return FuriHalNfcErrorNone; -} - -FuriHalNfcError furi_hal_nfc_iso15693_force_1outof4(void) { - iso15693_parser_force_1outof4(furi_hal_nfc_iso15693_listener->parser); - - return FuriHalNfcErrorNone; -} - -FuriHalNfcError furi_hal_nfc_iso15693_force_1outof256(void) { - iso15693_parser_force_1outof256(furi_hal_nfc_iso15693_listener->parser); - - return FuriHalNfcErrorNone; -} - static FuriHalNfcError furi_hal_nfc_iso15693_listener_rx( FuriHalSpiBusHandle* handle, uint8_t* rx_data, diff --git a/targets/furi_hal_include/furi_hal_nfc.h b/targets/furi_hal_include/furi_hal_nfc.h index a651c97772..3a81de6f52 100644 --- a/targets/furi_hal_include/furi_hal_nfc.h +++ b/targets/furi_hal_include/furi_hal_nfc.h @@ -452,24 +452,6 @@ FuriHalNfcError furi_hal_nfc_iso14443a_listener_tx_custom_parity( */ FuriHalNfcError furi_hal_nfc_iso15693_listener_tx_sof(void); -/** Set ISO15693 parser mode to autodetect - * - * @return FuriHalNfcError -*/ -FuriHalNfcError furi_hal_nfc_iso15693_detect_mode(void); - -/** Set ISO15693 parser mode to 1OutOf4, disables autodetection - * - * @return FuriHalNfcError -*/ -FuriHalNfcError furi_hal_nfc_iso15693_force_1outof4(void); - -/** Set ISO15693 parser mode to 1OutOf256, disables autodetection - * - * @return FuriHalNfcError -*/ -FuriHalNfcError furi_hal_nfc_iso15693_force_1outof256(void); - /** * @brief Set FeliCa collision resolution parameters in listener mode. *