unleashed-firmware/applications/ibutton/helpers/key_worker.cpp
あく 389ff92cc1
Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter
* About: remove ID from IC
* Firmware: remove double define for DIVC/DIVR
* Scripts: check folder names too. Docker: replace syntax check with make lint.
* Reformat Sources and Migrate to new file naming convention
* Docker: symlink clang-format-12 to clang-format
* Add coding style guide
2022-01-05 19:10:18 +03:00

54 lines
1.0 KiB
C++

#include "key_worker.h"
#include <callback-connector.h>
#include <maxim_crc.h>
extern COMP_HandleTypeDef hcomp1;
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() {
}