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 23:21:16 +10:00
|
|
|
|
#pragma once
|
2021-10-03 13:36:05 +03:00
|
|
|
|
|
2021-05-04 23:21:16 +10:00
|
|
|
|
#include <stdint.h>
|
2021-05-18 19:54:48 +10:00
|
|
|
|
#include <stdbool.h>
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Initialize RFID subsystem
|
|
|
|
|
*/
|
2021-09-10 12:19:02 +10:00
|
|
|
|
void furi_hal_rfid_init();
|
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid pins to reset state
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_pins_reset();
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid pins to emulate state
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_pins_emulate();
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid pins to read state
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_pins_read();
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-12-12 21:03:39 +10: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 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_read(float freq, float duty_cycle);
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Start read timer
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_read_start();
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Stop read timer
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_read_stop();
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid timer to emulate state
|
|
|
|
|
*
|
|
|
|
|
* @param freq timer frequency
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_emulate(float freq);
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2022-03-26 01:56:18 +03:00
|
|
|
|
typedef void (*FuriHalRfidEmulateCallback)(void* context);
|
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Start emulation timer
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2022-03-26 01:56:18 +03:00
|
|
|
|
void furi_hal_rfid_tim_emulate_start(FuriHalRfidEmulateCallback callback, void* context);
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Stop emulation timer
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_emulate_stop();
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Config rfid timers to reset state
|
2021-05-04 23:21:16 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_tim_reset();
|
2021-05-04 23:21:16 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Set emulation timer period
|
|
|
|
|
*
|
|
|
|
|
* @param period overall duration
|
2021-05-18 19:54:48 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_set_emulate_period(uint32_t period);
|
2021-05-18 19:54:48 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Set emulation timer pulse
|
|
|
|
|
*
|
|
|
|
|
* @param pulse duration of high level
|
2021-05-18 19:54:48 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_set_emulate_pulse(uint32_t pulse);
|
2021-05-18 19:54:48 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Set read timer period
|
|
|
|
|
*
|
|
|
|
|
* @param period overall duration
|
2021-06-29 00:42:30 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_set_read_period(uint32_t period);
|
2021-06-29 00:42:30 +10:00
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
|
/** Set read timer pulse
|
|
|
|
|
*
|
|
|
|
|
* @param pulse duration of high level
|
2021-06-29 00:42:30 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_set_read_pulse(uint32_t pulse);
|
2021-06-29 00:42:30 +10: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 08:11:18 +10:00
|
|
|
|
*/
|
2021-08-08 21:03:25 +03:00
|
|
|
|
void furi_hal_rfid_change_read_config(float freq, float duty_cycle);
|
2021-08-02 08:11:18 +10:00
|
|
|
|
|
2022-03-23 20:59:20 +03:00
|
|
|
|
/** 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);
|
|
|
|
|
|
2021-05-04 23:21:16 +10:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
2022-03-23 20:59:20 +03:00
|
|
|
|
#endif
|