[FL-2375] Migrate to LL part 3 (#1058)

* FuriHal: replace HAL with LL for ARR and CC
* Rfid, FuriHal: migrate emulation to LL
* RFID hal: disable arr preload during emulation
* Rfid, Furi, FuriHal: last piece of LL puzzle
* Rfid, Furi, FuriHal: filing the last piece of LL puzzle
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
This commit is contained in:
あく
2022-03-26 01:56:18 +03:00
committed by GitHub
parent 7c4b0f534f
commit 413a03defb
16 changed files with 121 additions and 577 deletions

View File

@@ -2,7 +2,6 @@
#include <furi.h>
#include <furi_hal.h>
#include <stm32wbxx_ll_cortex.h>
#include <tim.h>
/**
* @brief private violation assistant for RfidReader

View File

@@ -1,7 +1,5 @@
#include "rfid_timer_emulator.h"
extern TIM_HandleTypeDef htim1;
RfidTimerEmulator::RfidTimerEmulator() {
}
@@ -25,9 +23,7 @@ void RfidTimerEmulator::start(LfrfidKeyType type, const uint8_t* data, uint8_t d
furi_hal_rfid_tim_emulate(125000);
furi_hal_rfid_pins_emulate();
api_interrupt_add(timer_update_callback, InterruptTypeTimerUpdate, this);
furi_hal_rfid_tim_emulate_start();
furi_hal_rfid_tim_emulate_start(RfidTimerEmulator::timer_update_callback, this);
}
} else {
// not found
@@ -36,30 +32,25 @@ void RfidTimerEmulator::start(LfrfidKeyType type, const uint8_t* data, uint8_t d
void RfidTimerEmulator::stop() {
furi_hal_rfid_tim_emulate_stop();
api_interrupt_remove(timer_update_callback, InterruptTypeTimerUpdate);
furi_hal_rfid_tim_reset();
furi_hal_rfid_pins_reset();
}
void RfidTimerEmulator::timer_update_callback(void* _hw, void* ctx) {
void RfidTimerEmulator::timer_update_callback(void* ctx) {
RfidTimerEmulator* _this = static_cast<RfidTimerEmulator*>(ctx);
TIM_HandleTypeDef* hw = static_cast<TIM_HandleTypeDef*>(_hw);
if(furi_hal_rfid_is_tim_emulate(hw)) {
bool result;
bool polarity;
uint16_t period;
uint16_t pulse;
bool result;
bool polarity;
uint16_t period;
uint16_t pulse;
do {
_this->current_encoder->get_next(&polarity, &period, &pulse);
result = _this->pulse_joiner.push_pulse(polarity, period, pulse);
} while(result == false);
do {
_this->current_encoder->get_next(&polarity, &period, &pulse);
result = _this->pulse_joiner.push_pulse(polarity, period, pulse);
} while(result == false);
_this->pulse_joiner.pop_pulse(&period, &pulse);
_this->pulse_joiner.pop_pulse(&period, &pulse);
furi_hal_rfid_set_emulate_period(period - 1);
furi_hal_rfid_set_emulate_pulse(pulse);
}
furi_hal_rfid_set_emulate_period(period - 1);
furi_hal_rfid_set_emulate_pulse(pulse);
}

View File

@@ -25,5 +25,5 @@ private:
};
PulseJoiner pulse_joiner;
static void timer_update_callback(void* _hw, void* ctx);
};
static void timer_update_callback(void* ctx);
};