[FL-1190] Enable OTG pullup for reading and writing keys (#423)

This commit is contained in:
gornekich 2021-04-24 01:23:16 +03:00 committed by GitHub
parent f7aeab7084
commit 577606afb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -178,10 +178,12 @@ void KeyReader::switch_mode_if_needed() {
} }
void KeyReader::start() { void KeyReader::start() {
api_hal_power_enable_otg();
switch_to(ReadMode::CYFRAL_METAKOM); switch_to(ReadMode::CYFRAL_METAKOM);
} }
void KeyReader::stop() { void KeyReader::stop() {
api_hal_power_disable_otg();
onewire_master->stop(); onewire_master->stop();
stop_comaparator(); stop_comaparator();
} }

View File

@ -10,10 +10,12 @@ KeyWriter::Error KeyWriter::write(iButtonKey* key) {
} }
void KeyWriter::start() { void KeyWriter::start() {
api_hal_power_enable_otg();
onewire_master->start(); onewire_master->start();
} }
void KeyWriter::stop() { void KeyWriter::stop() {
api_hal_power_disable_otg();
onewire_master->stop(); onewire_master->stop();
} }

View File

@ -12,12 +12,10 @@ OneWireMaster::~OneWireMaster() {
void OneWireMaster::start(void) { void OneWireMaster::start(void) {
gpio_init(gpio, GpioModeOutputOpenDrain); gpio_init(gpio, GpioModeOutputOpenDrain);
api_hal_power_enable_otg();
} }
void OneWireMaster::stop(void) { void OneWireMaster::stop(void) {
gpio_init(gpio, GpioModeAnalog); gpio_init(gpio, GpioModeAnalog);
api_hal_power_disable_otg();
} }
void OneWireMaster::reset_search() { void OneWireMaster::reset_search() {