unleashed-firmware/applications/ibutton/helpers/key_worker.cpp
あく c4a0847c99
FuriHal: replace HAL with LL in RFID Part 1. Drop F6. (#1049)
* FuriHal: new speaker HAL
* FuriHal: drop PWM
* FuriHal: move COMP1 to LL
* FuriHal: move COMP1 to LL backport to F6
* FuriHal: remove missing gpio_rfid_carrier from F6
* FurHal: use LL for system controls in flash HAL
* Drop F6 source tree
* Drop F6 from GitHub workflow
* Tie USE_FULL_ASSERT with APP_UNIT_TESTS
* Speaker: return to old volume calculation
* FreeRTOS: move TCB header to glue

Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2022-03-23 20:59:20 +03:00

52 lines
995 B
C++

#include "key_worker.h"
#include <callback-connector.h>
#include <maxim_crc.h>
KeyReader::Error KeyWorker::read(iButtonKey* key) {
KeyReader::Error result = key_reader.read(key);
return result;
}
void KeyWorker::start_read() {
key_reader.start();
}
void KeyWorker::stop_read() {
key_reader.stop();
}
bool KeyWorker::emulated() {
return key_emulator.emulated();
}
void KeyWorker::start_emulate(iButtonKey* key) {
key_emulator.start(key);
}
void KeyWorker::stop_emulate() {
key_emulator.stop();
}
KeyWriter::Error KeyWorker::write(iButtonKey* key) {
return key_writer.write(key);
}
void KeyWorker::start_write() {
key_writer.start();
}
void KeyWorker::stop_write() {
key_writer.stop();
}
KeyWorker::KeyWorker(const GpioPin* one_wire_gpio)
: onewire_master{one_wire_gpio}
, onewire_slave{one_wire_gpio}
, key_reader{&onewire_master}
, key_emulator{&onewire_slave}
, key_writer{&onewire_master} {
}
KeyWorker::~KeyWorker() {
}