mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-26 01:04:39 +00:00
chore: rename functions to keep naming style consistency
This commit is contained in:
@@ -735,7 +735,7 @@ static data_frame_tx_t *cmd_processor_set_slot_enable(uint16_t cmd, uint16_t sta
|
||||
uint8_t slot_now = payload->slot_index;
|
||||
tag_emulation_slot_set_enable(slot_now, payload->sense_type, payload->enabled);
|
||||
if ((!payload->enabled) &&
|
||||
(!tag_emulation_slot_is_enabled(slot_now, payload->sense_type == TAG_SENSE_HF ? TAG_SENSE_LF : TAG_SENSE_HF))) {
|
||||
(!is_slot_enabled(slot_now, payload->sense_type == TAG_SENSE_HF ? TAG_SENSE_LF : TAG_SENSE_HF))) {
|
||||
// HF and LF disabled, need to change slot
|
||||
uint8_t slot_prev = tag_emulation_slot_find_next(slot_now);
|
||||
NRF_LOG_INFO("slot_now = %d, slot_prev = %d", slot_now, slot_prev);
|
||||
@@ -1311,8 +1311,8 @@ static data_frame_tx_t *cmd_processor_get_enabled_slots(uint16_t cmd, uint16_t s
|
||||
uint8_t enabled_lf;
|
||||
} PACKED payload[8];
|
||||
for (uint8_t slot = 0; slot < 8; slot++) {
|
||||
payload[slot].enabled_hf = tag_emulation_slot_is_enabled(slot, TAG_SENSE_HF);
|
||||
payload[slot].enabled_lf = tag_emulation_slot_is_enabled(slot, TAG_SENSE_LF);
|
||||
payload[slot].enabled_hf = is_slot_enabled(slot, TAG_SENSE_HF);
|
||||
payload[slot].enabled_lf = is_slot_enabled(slot, TAG_SENSE_LF);
|
||||
}
|
||||
return data_frame_make(cmd, STATUS_SUCCESS, sizeof(payload), (uint8_t *)&payload);
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ static void system_off_enter(void) {
|
||||
app_timer_stop_all();
|
||||
|
||||
// Check whether there are low -frequency fields, solving very strong field signals during dormancy have always caused the comparator to be at a high level input state, so that the problem of uprising the rising edge cannot be awakened.
|
||||
if (lf_is_field_exists()) {
|
||||
if (is_lf_field_exists()) {
|
||||
// Close the comparator
|
||||
nrf_drv_lpcomp_disable();
|
||||
// Set the reason for Reset. After restarting, you need to get this reason to avoid misjudgment from the source of wake up.
|
||||
|
||||
@@ -48,7 +48,7 @@ static void lf_field_lost(void) {
|
||||
/**
|
||||
* @brief Judge field status
|
||||
*/
|
||||
bool lf_is_field_exists(void) {
|
||||
bool is_lf_field_exists(void) {
|
||||
nrfx_lpcomp_enable();
|
||||
bsp_delay_us(30); // Display for a period of time and sampling to avoid misjudgment
|
||||
nrf_lpcomp_task_trigger(NRF_LPCOMP_TASK_SAMPLE);
|
||||
@@ -109,7 +109,7 @@ static void pwm_handler(nrfx_pwm_evt_type_t event_type) {
|
||||
bsp_delay_ms(1);
|
||||
// We don't need any events, but only need to detect the state of the field
|
||||
NRF_LPCOMP->INTENCLR = LPCOMP_INTENCLR_CROSS_Msk | LPCOMP_INTENCLR_UP_Msk | LPCOMP_INTENCLR_DOWN_Msk | LPCOMP_INTENCLR_READY_Msk;
|
||||
if (lf_is_field_exists()) {
|
||||
if (is_lf_field_exists()) {
|
||||
nrfx_lpcomp_disable();
|
||||
nrfx_pwm_simple_playback(&m_broadcast, m_pwm_seq, LF_125KHZ_BROADCAST_MAX, NRFX_PWM_FLAG_STOP);
|
||||
} else {
|
||||
@@ -136,7 +136,7 @@ static void pwm_init(void) {
|
||||
static void lf_sense_enable(void) {
|
||||
lpcomp_init();
|
||||
pwm_init(); // use precise hardware timer to broadcast card id
|
||||
if (lf_is_field_exists()) {
|
||||
if (is_lf_field_exists()) {
|
||||
lpcomp_event_handler(NRF_LPCOMP_EVENT_UP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ int lf_tag_em410x_data_savecb(tag_specific_type_t type, tag_data_buffer_t *buffe
|
||||
bool lf_tag_em410x_data_factory(uint8_t slot, tag_specific_type_t tag_type);
|
||||
int lf_tag_hidprox_data_savecb(tag_specific_type_t type, tag_data_buffer_t *buffer);
|
||||
bool lf_tag_hidprox_data_factory(uint8_t slot, tag_specific_type_t tag_type);
|
||||
bool lf_is_field_exists(void);
|
||||
bool is_lf_field_exists(void);
|
||||
|
||||
@@ -590,7 +590,7 @@ void tag_emulation_change_slot(uint8_t index, bool sense_disable) {
|
||||
/**
|
||||
* Determine whether the specified card slot is enabled
|
||||
*/
|
||||
bool tag_emulation_slot_is_enabled(uint8_t slot, tag_sense_type_t sense_type) {
|
||||
bool is_slot_enabled(uint8_t slot, tag_sense_type_t sense_type) {
|
||||
if (sense_type == TAG_SENSE_LF) {
|
||||
return slotConfig.slots[slot].enabled_lf;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ uint8_t tag_emulation_get_slot(void);
|
||||
// Switch the card slot to control whether the passing parameter control is closed during the switching period to listen to
|
||||
void tag_emulation_change_slot(uint8_t index, bool sense_disable);
|
||||
// Get the card slot to enable the state
|
||||
bool tag_emulation_slot_is_enabled(uint8_t slot, tag_sense_type_t sense_type);
|
||||
bool is_slot_enabled(uint8_t slot, tag_sense_type_t sense_type);
|
||||
// Set the card slot to enable
|
||||
void tag_emulation_slot_set_enable(uint8_t slot, tag_sense_type_t sense_type, bool enable);
|
||||
// Get the emulation card type of the corresponding card slot
|
||||
|
||||
@@ -110,4 +110,4 @@ uint8_t write_hidprox_to_t55xx(uint8_t format, uint32_t fc, uint64_t cn, uint32_
|
||||
/**
|
||||
* Set the LF card scanning timeout value (in milliseconds).
|
||||
*/
|
||||
void SetScanTagTimeout(uint32_t ms) { g_timeout_readem_ms = ms; }
|
||||
void set_scan_tag_timeout(uint32_t ms) { g_timeout_readem_ms = ms; }
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "lf_125khz_radio.h"
|
||||
#include "lf_em410x_data.h"
|
||||
|
||||
void SetScanTagTimeout(uint32_t ms);
|
||||
void set_scan_tag_timeout(uint32_t ms);
|
||||
|
||||
uint8_t scan_em410x(uint8_t *uid);
|
||||
uint8_t write_em410x_to_t55xx(uint8_t *uid, uint8_t *newkey, uint8_t *old_keys, uint8_t old_key_count);
|
||||
|
||||
@@ -107,8 +107,8 @@ device_mode_t get_device_mode(void) {
|
||||
uint8_t get_color_by_slot(uint8_t slot) {
|
||||
tag_slot_specific_type_t tag_types;
|
||||
tag_emulation_get_specific_types_by_slot(slot, &tag_types);
|
||||
bool enabled_lf = tag_emulation_slot_is_enabled(slot, TAG_SENSE_LF);
|
||||
bool enabled_hf = tag_emulation_slot_is_enabled(slot, TAG_SENSE_HF);
|
||||
bool enabled_lf = is_slot_enabled(slot, TAG_SENSE_LF);
|
||||
bool enabled_hf = is_slot_enabled(slot, TAG_SENSE_HF);
|
||||
if (tag_types.tag_hf != TAG_TYPE_UNDEFINED && tag_types.tag_lf != TAG_TYPE_UNDEFINED && enabled_hf && enabled_lf) {
|
||||
return 0; // Dual -frequency card emulation, return R, indicate a dual -frequency card
|
||||
} else if (tag_types.tag_hf != TAG_TYPE_UNDEFINED && enabled_hf) { //High -frequency emulation, return G
|
||||
|
||||
Reference in New Issue
Block a user