@@ -484,6 +484,58 @@ card_error_type_e card_pair_operation(uint8_t card_number,
484
484
break ;
485
485
}
486
486
487
+ nfc_deselect_card ();
488
+ return card_data .error_type ;
489
+ }
490
+
491
+ card_error_type_e single_card_pair_operation (char * heading ,
492
+ const char * message ) {
493
+ // Need to handle how assign new card its number
494
+ card_operation_data_t card_data = {0 };
495
+ card_pairing_data_t pair_data = {0 };
496
+
497
+ if (SUCCESS != pair_card_preprocess (& pair_data )) {
498
+ return CARD_OPERATION_ABORT_OPERATION ;
499
+ }
500
+
501
+ instruction_scr_init (message , heading );
502
+ card_data .nfc_data .retries = 5 ;
503
+
504
+ while (1 ) {
505
+ // Initialize card tap config
506
+ card_data .nfc_data .acceptable_cards = ACCEPTABLE_CARDS_ALL ;
507
+
508
+ init_and_pair_card (& card_data , & pair_data );
509
+
510
+ if (CARD_OPERATION_SUCCESS == card_data .error_type ) {
511
+ if (SW_NO_ERROR != handle_pairing_success (& card_data , & pair_data )) {
512
+ card_data .error_type = CARD_OPERATION_ABORT_OPERATION ;
513
+ break ;
514
+ }
515
+
516
+ buzzer_start (BUZZER_DURATION );
517
+ // if (4 != card_number) {
518
+ // wait_for_card_removal();
519
+ // }
520
+ // since we are pairing only one card
521
+ wait_for_card_removal ();
522
+
523
+ break ;
524
+ }
525
+
526
+ if (CARD_OPERATION_CARD_REMOVED == card_data .error_type ||
527
+ CARD_OPERATION_RETAP_BY_USER_REQUIRED == card_data .error_type ) {
528
+ const char * error_msg = card_data .error_message ;
529
+ if (CARD_OPERATION_SUCCESS == indicate_card_error (error_msg )) {
530
+ // Re-render the instruction screen
531
+ instruction_scr_init (message , heading );
532
+ continue ;
533
+ }
534
+ }
535
+
536
+ break ;
537
+ }
538
+
487
539
nfc_deselect_card ();
488
540
return card_data .error_type ;
489
541
}
0 commit comments