Zachary Weiss 2 лет назад
Родитель
Сommit
474b29a7b7
4 измененных файлов с 24 добавлено и 3 удалено
  1. 2 2
      README.md
  2. 18 0
      helpers/mag_helpers.c
  3. 1 0
      helpers/mag_types.h
  4. 3 1
      scenes/mag_scene_emulate_config.c

+ 2 - 2
README.md

@@ -40,11 +40,11 @@ File management:
 Internal TX improvements:
 - [ ] Attempt downstream modulation techniques in addition to upstream, like the LF RFID worker does when writing.
 - [ ] Implement using the timer system, rather than direct-writing to pins
-- [ ] Use the NFC (HF RFID) coil instead of or in addition to the LF coil (likely unfruitful from initial tests; we can enable/disable the oscillating field, but even with transparent mode to the ST25R3916, it seems we don't get low-enough-level control to pull it high/low correctly) 
+- [X] Use the NFC (HF RFID) coil instead of or in addition to the LF coil (likely unfruitful from initial tests; we can enable/disable the oscillating field, but even with transparent mode to the ST25R3916, it seems we don't get low-enough-level control to pull it high/low correctly) 
 - [ ] Add "subcarriers" to each half-bit transmitted (wiggle the pin high and low rapidly)
   - [ ] Piezo subcarrier tests
   - [ ] LF subcarrier tests
-  - [ ] Retry NFC oscillating field? 
+  - [X] Retry NFC oscillating field? 
 
 External RX options:
 1. [TTL / PS/2 mag reader connected to UART](https://www.alibaba.com/product-detail/Mini-portable-12-3-tracks-usb_60679900708.html) (bulky, harder to source, but likely easiest to read over GPIO, and means one can read all tracks)

+ 18 - 0
helpers/mag_helpers.c

@@ -34,6 +34,17 @@ void play_halfbit(bool value, MagSetting* setting) {
         furi_hal_gpio_write(RFID_PIN_OUT, value);
         furi_hal_gpio_write(&gpio_speaker, value);
         break;
+    case MagTxStateNFC:
+        // turn on for duration of half-bit? or "blip" the field on / off?
+        // getting nothing from the mag reader either way
+        //(value) ? furi_hal_nfc_ll_txrx_on() : furi_hal_nfc_ll_txrx_off();
+
+        if(last_value == 2 || value != (bool)last_value) {
+            furi_hal_nfc_ll_txrx_on();
+            //furi_delay_us(64);
+            furi_hal_nfc_ll_txrx_off();
+        }
+        break;
     case MagTxCC1101_434:
     case MagTxCC1101_868:
         if(last_value == 2 || value != (bool)last_value) {
@@ -167,6 +178,9 @@ bool tx_init(MagSetting* setting) {
         tx_init_piezo();
         tx_init_rfid();
         break;
+    case MagTxStateNFC:
+        furi_hal_nfc_exit_sleep();
+        break;
     case MagTxCC1101_434:
         tx_init_rf(434000000);
         break;
@@ -202,6 +216,10 @@ bool tx_deinit(MagSetting* setting) {
         tx_deinit_piezo();
         tx_deinit_rfid();
         break;
+    case MagTxStateNFC:
+        furi_hal_nfc_ll_txrx_off();
+        furi_hal_nfc_start_sleep();
+        break;
     case MagTxCC1101_434:
     case MagTxCC1101_868:
         furi_hal_gpio_write(&gpio_cc1101_g0, false);

+ 1 - 0
helpers/mag_types.h

@@ -32,6 +32,7 @@ typedef enum {
     MagTxStateGPIO,
     MagTxStatePiezo,
     MagTxStateLF_P, // combo of RFID and Piezo
+    MagTxStateNFC,
     MagTxCC1101_434,
     MagTxCC1101_868,
 } MagTxState;

+ 3 - 1
scenes/mag_scene_emulate_config.c

@@ -10,12 +10,13 @@ enum MagSettingIndex {
     MagSettingIndexInterpacket,
 };
 
-#define TX_COUNT 6
+#define TX_COUNT 7
 const char* const tx_text[TX_COUNT] = {
     "RFID",
     "GPIO",
     "Piezo",
     "LF + P",
+    "NFC",
     "434MHz",
     "868MHz",
 };
@@ -24,6 +25,7 @@ const uint32_t tx_value[TX_COUNT] = {
     MagTxStateGPIO,
     MagTxStatePiezo,
     MagTxStateLF_P,
+    MagTxStateNFC,
     MagTxCC1101_434,
     MagTxCC1101_868,
 };