[FL-3168] Add one_wire lib to f18, separate ibutton (#2509)
* Separate ibutton to its own module, add one_wire to f18 * Move onewire cli to a separate app Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
54
lib/ibutton/ibutton_worker_i.h
Normal file
54
lib/ibutton/ibutton_worker_i.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @file ibutton_worker_i.h
|
||||
*
|
||||
* iButton worker, internal definitions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/thread.h>
|
||||
#include <core/message_queue.h>
|
||||
|
||||
#include "ibutton_worker.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
const uint32_t quant;
|
||||
void (*const start)(iButtonWorker* worker);
|
||||
void (*const tick)(iButtonWorker* worker);
|
||||
void (*const stop)(iButtonWorker* worker);
|
||||
} iButtonWorkerModeType;
|
||||
|
||||
typedef enum {
|
||||
iButtonWorkerModeIdle,
|
||||
iButtonWorkerModeRead,
|
||||
iButtonWorkerModeWriteBlank,
|
||||
iButtonWorkerModeWriteCopy,
|
||||
iButtonWorkerModeEmulate,
|
||||
} iButtonWorkerMode;
|
||||
|
||||
struct iButtonWorker {
|
||||
iButtonKey* key;
|
||||
iButtonProtocols* protocols;
|
||||
iButtonWorkerMode mode_index;
|
||||
FuriMessageQueue* messages;
|
||||
FuriThread* thread;
|
||||
|
||||
iButtonWorkerReadCallback read_cb;
|
||||
iButtonWorkerWriteCallback write_cb;
|
||||
iButtonWorkerEmulateCallback emulate_cb;
|
||||
|
||||
void* cb_ctx;
|
||||
};
|
||||
|
||||
extern const iButtonWorkerModeType ibutton_worker_modes[];
|
||||
|
||||
void ibutton_worker_switch_mode(iButtonWorker* worker, iButtonWorkerMode mode);
|
||||
void ibutton_worker_notify_emulate(iButtonWorker* worker);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user