Skip to content

Commit

Permalink
Remove nfc tag customizatiopn with NDEF message
Browse files Browse the repository at this point in the history
New ifdef to activate feature if needed HAVE_NDEF_SUPPORT
  • Loading branch information
PhilippeBonnaz committed Sep 1, 2023
1 parent a80708f commit 241c57f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
8 changes: 7 additions & 1 deletion include/os_io_seproxyhal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include "os_types.h"

#ifdef HAVE_NFC
#include "nfc.h"
#ifdef HAVE_NDEF_SUPPORT
#include "nfc_ndef.h"
#endif
#endif

#ifdef HAVE_SERIALIZED_NBGL
Expand Down Expand Up @@ -126,7 +128,11 @@ void io_seproxyhal_send_nbgl_serialized(nbgl_serialized_event_type_e event, nbgl
void io_set_timeout(unsigned int timeout);

#ifdef HAVE_NFC
#ifdef HAVE_NDEF_SUPPORT
void io_seproxyhal_nfc_init(ndef_struct_t *ndef_message, bool async, bool forceInit);
#else // ! HAVE_NDEF_SUPPORT
void io_seproxyhal_nfc_init(bool forceInit);
#endif // HAVE_NDEF_SUPPORT
#endif

#ifdef HAVE_SE_TOUCH
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions lib_nfc/src/nfc.c → lib_nfc/src/nfc_ndef.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifdef HAVE_NFC
#include "nfc.h"
#ifdef HAVE_NDEF_SUPPORT
#include "nfc_ndef.h"
#include "string.h"
#include "os_apdu.h"

Expand Down Expand Up @@ -194,4 +195,5 @@ uint16_t os_ndef_to_string(ndef_struct_t *ndef_message, char * out_string) {
}
return tot_length;
}
#endif
#endif // HAVE_NDEF_SUPPORT
#endif // HAVE_NFC
18 changes: 16 additions & 2 deletions src/os_io_seproxyhal.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,11 @@ void io_seproxyhal_play_tune(tune_index_e tune_index) {
#endif // HAVE_PIEZO_SOUND

#ifdef HAVE_NFC
#include "nfc.h"
#ifdef HAVE_NDEF_SUPPORT
#include "nfc_ndef.h"
#endif

#ifdef HAVE_NDEF_SUPPORT
/**
* @brief Send a SEPH message to MCU to init NFC
*
Expand Down Expand Up @@ -497,7 +500,18 @@ void io_seproxyhal_nfc_init(ndef_struct_t *ndef_message, bool async, bool forceI
io_seproxyhal_spi_send(buffer, 5);
io_seproxyhal_spi_send(G_io_seproxyhal_spi_buffer, total_length-2);
}
#endif
#else // ! HAVE_NDEF_SUPPORT
void io_seproxyhal_nfc_init(bool forceInit) {
uint8_t buffer[4];
uint8_t is_nfc_enabled = forceInit?1:(os_setting_get(OS_SETTING_FEATURES, NULL, 0)&OS_SETTING_FEATURES_NFC_ENABLED);
buffer[0] = SEPROXYHAL_TAG_NFC_INIT;
buffer[1] = 0;
buffer[2] = 1;
buffer[3] = is_nfc_enabled;
io_seproxyhal_spi_send(buffer, 4);
}
#endif // HAVE_NDEF_SUPPORT
#endif // HAVE_NFC

#ifdef HAVE_SE_TOUCH
#ifdef HAVE_TOUCH_READ_DEBUG_DATA_SYSCALL
Expand Down

0 comments on commit 241c57f

Please sign in to comment.