Skip to content

Commit

Permalink
Merge pull request #221 from Dmytro02/fix-LF-emulation
Browse files Browse the repository at this point in the history
fix-LF-emulation
  • Loading branch information
doegox authored Jan 14, 2025
2 parents 8a797b8 + c7d6224 commit d6c106f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions firmware/application/src/rfid/nfctag/lf/lf_tag_em.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ uint64_t em410x_id_to_memory64(uint8_t id[5]) {
*/
bool lf_is_field_exists(void) {
nrf_drv_lpcomp_enable();
bsp_delay_us(20); // Display for a period of time and sampling to avoid misjudgment
bsp_delay_us(30); // Display for a period of time and sampling to avoid misjudgment
nrf_lpcomp_task_trigger(NRF_LPCOMP_TASK_SAMPLE); //Trigger a sampling
return nrf_lpcomp_result_get() == 1; //Determine the sampling results of the LF field status
}
Expand Down Expand Up @@ -261,7 +261,10 @@ void timer_ce_handler(nrf_timer_event_t event_type, void *p_context) {
if (m_is_send_first_edge == true) { // The first edge of the next sends next time
if (++m_bit_send_position >= LF_125KHZ_EM410X_BIT_SIZE) {
m_bit_send_position = 0; // The broadcast is successful once, and the BIT position is zero
if (++m_send_id_count >= LF_125KHZ_BROADCAST_MAX) {
if(!lf_is_field_exists()){ // To avoid stopping sending when the reader field is present
m_send_id_count++;
}
if (m_send_id_count >= LF_125KHZ_BROADCAST_MAX) {
m_send_id_count = 0; //The number of broadcasts reaches the upper limit, re -identifies the status of the field and re -statistically count the number of broadcast times
}
}
Expand Down
2 changes: 1 addition & 1 deletion firmware/application/src/rfid/nfctag/lf/lf_tag_em.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* The definition of the packaging tool macro only needs to be modulated 0 and 1
*/
#define LF_125KHZ_EM410X_BIT_SIZE 64
#define LF_125KHZ_BROADCAST_MAX 3 // 32.768ms once, about 31 times in one second
#define LF_125KHZ_BROADCAST_MAX 10 // 32.768ms once, about 31 times in one second
#define LF_125KHZ_EM410X_BIT_CLOCK 256
#define LF_EM410X_TAG_ID_SIZE 5

Expand Down

0 comments on commit d6c106f

Please sign in to comment.