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