mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 23:10:22 +00:00
3de856f8d5
* FuriHal: add bus abstraction and port some subsystem to it * Make PVS happy, cleanup code * Update API symbols for f18 * F18: backport bus changes from f7 * Revert to STOP2 sleep mode * Fix downgrading the firmware via updater * Port iButton TIM1 to furi_hal_bus * Port Infrared TIM1 and TIM2 to furi_hal_bus * Just enable the timer bus * Port furi_hal_pwm to bus API * Fix include statement * Port furi_hal_rfid to bus API * Port furi_hal_subghz and others to bus API * Remove unneeded include * Improve furi_hal_infrared defines * Reset LPTIM1 via furi_hal_bus API * Crash when trying to enable an already enabled peripheral * Better defines * Improved checks * Lots of macro wrappers * Copy spi changes for f18 * Fix crashes in LFRFID system * Fix crashes in NFC system * Improve comments * Create FuriHalBus.md * Update FuriHalBus.md * Fix crash when launching updater * Documentation: couple small fixes in FuriHalBus * FuriHal: fix copypaste in furi_hal_rfid_tim_reset * FuriHal: reset radio core related peripherals on restart * FuriHalBus: is enabled routine and bug fix for uart * RFID HAL: accomodate furi hal bus Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com> Co-authored-by: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com>
92 lines
1.9 KiB
C
92 lines
1.9 KiB
C
/**
|
|
* @file furi_hal_rfid.h
|
|
* RFID HAL API
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** Initialize RFID subsystem
|
|
*/
|
|
void furi_hal_rfid_init();
|
|
|
|
/** Config rfid pins to reset state
|
|
*/
|
|
void furi_hal_rfid_pins_reset();
|
|
|
|
/** Release rfid pull pin
|
|
*/
|
|
void furi_hal_rfid_pin_pull_release();
|
|
|
|
/** Pulldown rfid pull pin
|
|
*/
|
|
void furi_hal_rfid_pin_pull_pulldown();
|
|
|
|
/** Start read timer
|
|
* @param freq timer frequency
|
|
* @param duty_cycle timer duty cycle, 0.0-1.0
|
|
*/
|
|
void furi_hal_rfid_tim_read_start(float freq, float duty_cycle);
|
|
|
|
/** Pause read timer, to be able to continue later
|
|
*/
|
|
void furi_hal_rfid_tim_read_pause();
|
|
|
|
/** Continue read timer
|
|
*/
|
|
void furi_hal_rfid_tim_read_continue();
|
|
|
|
/** Stop read timer
|
|
*/
|
|
void furi_hal_rfid_tim_read_stop();
|
|
|
|
typedef void (*FuriHalRfidReadCaptureCallback)(bool level, uint32_t duration, void* context);
|
|
|
|
void furi_hal_rfid_tim_read_capture_start(FuriHalRfidReadCaptureCallback callback, void* context);
|
|
|
|
void furi_hal_rfid_tim_read_capture_stop();
|
|
|
|
typedef void (*FuriHalRfidDMACallback)(bool half, void* context);
|
|
|
|
void furi_hal_rfid_tim_emulate_dma_start(
|
|
uint32_t* duration,
|
|
uint32_t* pulse,
|
|
size_t length,
|
|
FuriHalRfidDMACallback callback,
|
|
void* context);
|
|
|
|
void furi_hal_rfid_tim_emulate_dma_stop();
|
|
|
|
/** Set read timer period
|
|
*
|
|
* @param period overall duration
|
|
*/
|
|
void furi_hal_rfid_set_read_period(uint32_t period);
|
|
|
|
/** Set read timer pulse
|
|
*
|
|
* @param pulse duration of high level
|
|
*/
|
|
void furi_hal_rfid_set_read_pulse(uint32_t pulse);
|
|
|
|
/** Start/Enable comparator */
|
|
void furi_hal_rfid_comp_start();
|
|
|
|
/** Stop/Disable comparator */
|
|
void furi_hal_rfid_comp_stop();
|
|
|
|
typedef void (*FuriHalRfidCompCallback)(bool level, void* context);
|
|
|
|
/** Set comparator callback */
|
|
void furi_hal_rfid_comp_set_callback(FuriHalRfidCompCallback callback, void* context);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|