New targetPowerCycleDelay target config param, for configuring the AVR8 target power cycle delay (after updating the DWEN fuse bit)

This commit is contained in:
Nav
2022-03-21 13:04:12 +00:00
parent a3b9bb8ca2
commit 7b79f19574
3 changed files with 18 additions and 2 deletions

View File

@@ -143,8 +143,12 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
Logger::debug("Disabling target power"); Logger::debug("Disabling target power");
this->targetPowerManagementInterface->disableTargetPower(); this->targetPowerManagementInterface->disableTargetPower();
Logger::debug("Holding power off for ~250 ms"); Logger::debug(
std::this_thread::sleep_for(std::chrono::milliseconds(250)); "Holding power off for ~"
+ std::to_string(this->targetConfig->targetPowerCycleDelay.count())
+ " ms"
);
std::this_thread::sleep_for(this->targetConfig->targetPowerCycleDelay);
Logger::debug("Enabling target power"); Logger::debug("Enabling target power");
this->targetPowerManagementInterface->enableTargetPower(); this->targetPowerManagementInterface->enableTargetPower();

View File

@@ -38,5 +38,11 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
"disableDebugWirePreDisconnect" "disableDebugWirePreDisconnect"
).toBool(); ).toBool();
} }
if (targetConfig.jsonObject.contains("targetPowerCycleDelay")) {
this->targetPowerCycleDelay = std::chrono::milliseconds(targetConfig.jsonObject.value(
"targetPowerCycleDelay"
).toInt(static_cast<int>(this->targetPowerCycleDelay.count())));
}
} }
} }

View File

@@ -1,5 +1,9 @@
#pragma once #pragma once
#include <chrono>
#include <string>
#include <map>
#include "src/ProjectConfig.hpp" #include "src/ProjectConfig.hpp"
#include "PhysicalInterface.hpp" #include "PhysicalInterface.hpp"
@@ -55,6 +59,8 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
*/ */
bool cycleTargetPowerPostDwenUpdate = true; bool cycleTargetPowerPostDwenUpdate = true;
std::chrono::milliseconds targetPowerCycleDelay = std::chrono::milliseconds(250);
explicit Avr8TargetConfig(const TargetConfig& targetConfig); explicit Avr8TargetConfig(const TargetConfig& targetConfig);
private: private: