mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-30 00:32:06 +03:00
bdba15b366
* iButton: getting started on the worker concept * Hal delay: added global instructions_per_us variable * iButton: one wire slave * iButton: ibutton key setter * iButton: one wire host, use ibutton_hal * iButton\RFID: common pulse decoder concept * iButton: cyfral decoder * iButton: worker thread concept * iButton: metakom decoder * iButton: write key through worker * iButton: worker mode holder * iButton: worker improvements * iButton: Cyfral encoder * iButton: Metakom encoder * lib: pulse protocol helpers * iButton: Metakom decoder * iButton: Cyfral decoder * iButton worker: separate modes * iButton: libs documentation * HAL: iButton gpio modes * iButton worker: rename modes file * iButton worker, hal: move to LL * iButton CLI: worker for reading and emulation commands * iButton HAL: correct init and emulation sequence * iButton cli: moved to plain C * iButton: move to worker, small step to plain C * Libs, one wire: move to plain C * Libs: added forgotten files to compilation * iButton writer: get rid of manual disable/enable irq
79 lines
1.8 KiB
C
79 lines
1.8 KiB
C
/**
|
|
* @file ibutton_worker_i.h
|
|
*
|
|
* iButton worker, internal definitions
|
|
*/
|
|
|
|
#pragma once
|
|
#include "ibutton_worker.h"
|
|
#include "ibutton_writer.h"
|
|
#include "../one_wire_host.h"
|
|
#include "../one_wire_slave.h"
|
|
#include "../one_wire_device.h"
|
|
#include "../pulse_protocols/pulse_decoder.h"
|
|
#include "pulse_protocols/protocol_cyfral.h"
|
|
#include "pulse_protocols/protocol_metakom.h"
|
|
#include "encoder/encoder_cyfral.h"
|
|
#include "encoder/encoder_metakom.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
PulseProtocolCyfral,
|
|
PulseProtocolMetakom,
|
|
} PulseProtocols;
|
|
|
|
typedef struct {
|
|
const uint32_t quant;
|
|
const void (*start)(iButtonWorker* worker);
|
|
const void (*tick)(iButtonWorker* worker);
|
|
const void (*stop)(iButtonWorker* worker);
|
|
} iButtonWorkerModeType;
|
|
|
|
typedef enum {
|
|
iButtonWorkerIdle = 0,
|
|
iButtonWorkerRead = 1,
|
|
iButtonWorkerWrite = 2,
|
|
iButtonWorkerEmulate = 3,
|
|
} iButtonWorkerMode;
|
|
|
|
typedef enum {
|
|
iButtonEmulateModeCyfral,
|
|
iButtonEmulateModeMetakom,
|
|
} iButtonEmulateMode;
|
|
|
|
struct iButtonWorker {
|
|
iButtonKey* key_p;
|
|
uint8_t* key_data;
|
|
OneWireHost* host;
|
|
OneWireSlave* slave;
|
|
OneWireDevice* device;
|
|
iButtonWriter* writer;
|
|
iButtonWorkerMode mode_index;
|
|
osMessageQueueId_t messages;
|
|
FuriThread* thread;
|
|
|
|
PulseDecoder* pulse_decoder;
|
|
ProtocolCyfral* protocol_cyfral;
|
|
ProtocolMetakom* protocol_metakom;
|
|
uint32_t last_dwt_value;
|
|
|
|
iButtonWorkerReadCallback read_cb;
|
|
iButtonWorkerWriteCallback write_cb;
|
|
iButtonWorkerEmulateCallback emulate_cb;
|
|
void* cb_ctx;
|
|
|
|
EncoderCyfral* encoder_cyfral;
|
|
EncoderMetakom* encoder_metakom;
|
|
iButtonEmulateMode emulate_mode;
|
|
};
|
|
|
|
extern const iButtonWorkerModeType ibutton_worker_modes[];
|
|
|
|
void ibutton_worker_switch_mode(iButtonWorker* worker, iButtonWorkerMode mode);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |