2021-10-03 13:36:05 +03:00
|
|
|
|
/**
|
2022-01-05 19:10:18 +03:00
|
|
|
|
* @file furi_hal_rfid.h
|
2021-10-03 13:36:05 +03:00
|
|
|
|
* RFID HAL API
|
|
|
|
|
*/
|
|
|
|
|
|
2021-05-04 16:21:16 +03:00
|
|
|
|
#pragma once
|
2021-10-03 13:36:05 +03:00
|
|
|
|
|
2021-05-04 16:21:16 +03:00
|
|
|
|
#include <stdint.h>
|
2021-05-18 12:54:48 +03:00
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <main.h>
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Initialize RFID subsystem
|
|
|
|
|
*/
|
2021-09-10 05:19:02 +03:00
|
|
|
|
void furi_hal_rfid_init();
|
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid pins to reset state
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_pins_reset();
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid pins to emulate state
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_pins_emulate();
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid pins to read state
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_pins_read();
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-12-12 14:03:39 +03:00
|
|
|
|
/** Release rfid pull pin
|
|
|
|
|
*/
|
|
|
|
|
void furi_hal_rfid_pin_pull_release();
|
|
|
|
|
|
|
|
|
|
/** Pulldown rfid pull pin
|
|
|
|
|
*/
|
|
|
|
|
void furi_hal_rfid_pin_pull_pulldown();
|
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid timer to read state
|
|
|
|
|
*
|
|
|
|
|
* @param freq timer frequency
|
|
|
|
|
* @param duty_cycle timer duty cycle, 0.0-1.0
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_read(float freq, float duty_cycle);
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Start read timer
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_read_start();
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Stop read timer
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_read_stop();
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid timer to emulate state
|
|
|
|
|
*
|
|
|
|
|
* @param freq timer frequency
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_emulate(float freq);
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Start emulation timer
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_emulate_start();
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Stop emulation timer
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_emulate_stop();
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid timers to reset state
|
2021-05-04 16:21:16 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_reset();
|
2021-05-04 16:21:16 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Check that timer instance is emulation timer
|
|
|
|
|
*
|
|
|
|
|
* @param hw timer instance
|
|
|
|
|
*
|
|
|
|
|
* @return true if instance is emulation timer
|
2021-05-18 12:54:48 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
bool furi_hal_rfid_is_tim_emulate(TIM_HandleTypeDef* hw);
|
2021-05-18 12:54:48 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Set emulation timer period
|
|
|
|
|
*
|
|
|
|
|
* @param period overall duration
|
2021-05-18 12:54:48 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_set_emulate_period(uint32_t period);
|
2021-05-18 12:54:48 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Set emulation timer pulse
|
|
|
|
|
*
|
|
|
|
|
* @param pulse duration of high level
|
2021-05-18 12:54:48 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_set_emulate_pulse(uint32_t pulse);
|
2021-05-18 12:54:48 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Set read timer period
|
|
|
|
|
*
|
|
|
|
|
* @param period overall duration
|
2021-06-28 17:42:30 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_set_read_period(uint32_t period);
|
2021-06-28 17:42:30 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Set read timer pulse
|
|
|
|
|
*
|
|
|
|
|
* @param pulse duration of high level
|
2021-06-28 17:42:30 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_set_read_pulse(uint32_t pulse);
|
2021-06-28 17:42:30 +03:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Сhanges the configuration of the RFID timer "on a fly"
|
|
|
|
|
*
|
|
|
|
|
* @param freq new frequency
|
|
|
|
|
* @param duty_cycle new duty cycle
|
2021-08-02 01:11:18 +03:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_change_read_config(float freq, float duty_cycle);
|
2021-08-02 01:11:18 +03:00
|
|
|
|
|
2021-05-04 16:21:16 +03:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|