[FL-1042][FL-1485][FL-1747] Metakom emulation fix (#721)

* iButton: Metakom emulation fix
* iButton: do not threat NVIC
* iButton: use proper GPIO from resources

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
SG 2021-09-24 22:16:59 +10:00 committed by GitHub
parent effda5ab44
commit c64052b491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 13 deletions

View File

@ -144,7 +144,7 @@ void KeyEmulator::start_metakom_emulate(iButtonKey* key) {
uint8_t* key_data = key->get_data();
// start pulse
pulse_data[0] = metakom_period_full * 4;
pulse_data[0] = metakom_period_full;
// start triplet
set_pulse_data_metakom(pd_index, metakom_period_zero);

View File

@ -116,15 +116,11 @@ bool KeyReader::verify_key(iButtonKeyType key_type, const uint8_t* const data, u
void KeyReader::start_comaparator(void) {
// pulldown lf-rfid pins to prevent interference
// TODO open record
GpioPin rfid_pull_pin = {.port = RFID_PULL_GPIO_Port, .pin = RFID_PULL_Pin};
hal_gpio_init(&rfid_pull_pin, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
hal_gpio_write(&rfid_pull_pin, false);
hal_gpio_init(&gpio_rfid_pull, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
hal_gpio_write(&gpio_rfid_pull, false);
// TODO open record
GpioPin rfid_out_pin = {.port = RFID_OUT_GPIO_Port, .pin = RFID_OUT_Pin};
hal_gpio_init(&rfid_out_pin, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
hal_gpio_write(&rfid_out_pin, false);
hal_gpio_init(&gpio_rfid_carrier_out, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
hal_gpio_write(&gpio_rfid_carrier_out, false);
comparator_callback_pointer =
cbc::obtain_connector(this, &KeyReader::comparator_trigger_callback);
@ -149,7 +145,7 @@ void KeyReader::comparator_trigger_callback(void* hcomp, void* comp_ctx) {
_this->metakom_decoder.process_front(
hal_gpio_get_rfid_in_level(), current_dwt_value - last_dwt_value);
last_dwt_value = DWT->CYCCNT;
last_dwt_value = current_dwt_value;
}
}

View File

@ -54,9 +54,6 @@ void PulseSequencer::init_timer(uint32_t period) {
Error_Handler();
}
HAL_NVIC_SetPriority(TIM1_UP_TIM16_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(TIM1_UP_TIM16_IRQn);
hal_gpio_init(&ibutton_gpio, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
}