Skip to content

Commit

Permalink
[FL-2375] Migrate to LL part 3 (flipperdevices#1058)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
skotopes authored Mar 25, 2022
1 parent 7c4b0f5 commit 413a03d
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 578 deletions.
1 change: 0 additions & 1 deletion applications/lfrfid/helpers/rfid_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 13 additions & 22 deletions applications/lfrfid/helpers/rfid_timer_emulator.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "rfid_timer_emulator.h"

extern TIM_HandleTypeDef htim1;

RfidTimerEmulator::RfidTimerEmulator() {
}

Expand All @@ -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
Expand All @@ -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);
}
4 changes: 2 additions & 2 deletions applications/lfrfid/helpers/rfid_timer_emulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ class RfidTimerEmulator {
};

PulseJoiner pulse_joiner;
static void timer_update_callback(void* _hw, void* ctx);
};
static void timer_update_callback(void* ctx);
};
1 change: 0 additions & 1 deletion core/furi.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "furi.h"

void furi_init() {
api_interrupt_init();
furi_log_init();
furi_record_init();
furi_stdglue_init();
Expand Down
1 change: 0 additions & 1 deletion core/furi.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <furi/log.h>

#include <furi_hal_gpio.h>
#include <furi_hal/api_interrupt_mgr.h>

#include <stdlib.h>

Expand Down
65 changes: 0 additions & 65 deletions core/furi_hal/api_interrupt_mgr.c

This file was deleted.

74 changes: 0 additions & 74 deletions core/furi_hal/api_interrupt_mgr.h

This file was deleted.

2 changes: 1 addition & 1 deletion firmware/targets/f7/Inc/stm32wbxx_hal_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extern "C" {
/*#define HAL_SMBUS_MODULE_ENABLED */
/*#define HAL_SMARTCARD_MODULE_ENABLED */
/*#define HAL_SPI_MODULE_ENABLED */
#define HAL_TIM_MODULE_ENABLED
/*#define HAL_TIM_MODULE_ENABLED */
/*#define HAL_TSC_MODULE_ENABLED */
/*#define HAL_UART_MODULE_ENABLED */
/*#define HAL_USART_MODULE_ENABLED */
Expand Down
56 changes: 0 additions & 56 deletions firmware/targets/f7/Inc/tim.h

This file was deleted.

9 changes: 0 additions & 9 deletions firmware/targets/f7/Src/stm32wbxx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "usbd_core.h"

extern usbd_device udev;
extern TIM_HandleTypeDef htim1;

extern void HW_TS_RTC_Wakeup_Handler();
extern void HW_IPCC_Tx_Handler();
Expand All @@ -19,14 +18,6 @@ void USB_LP_IRQHandler(void) {
usbd_poll(&udev);
}

void TIM1_TRG_COM_TIM17_IRQHandler(void) {
HAL_TIM_IRQHandler(&htim1);
}

void TIM1_CC_IRQHandler(void) {
HAL_TIM_IRQHandler(&htim1);
}

void HSEM_IRQHandler(void) {
HAL_HSEM_IRQHandler();
}
Expand Down
Loading

0 comments on commit 413a03d

Please sign in to comment.