Send "end process" command to detach from target, upon deactivaition of WCH-Link debug tools
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "src/DebugToolDrivers/WCH/Protocols/WchLink/Commands/Command.hpp"
|
||||||
|
|
||||||
|
namespace DebugToolDrivers::Wch::Protocols::WchLink::Commands::Control
|
||||||
|
{
|
||||||
|
class DetachTarget: public Command<std::array<unsigned char, 1>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DetachTarget()
|
||||||
|
: Command(0x0d)
|
||||||
|
{
|
||||||
|
this->payload = {
|
||||||
|
0xff
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "Commands/Control/GetDeviceInfo.hpp"
|
#include "Commands/Control/GetDeviceInfo.hpp"
|
||||||
#include "Commands/Control/AttachTarget.hpp"
|
#include "Commands/Control/AttachTarget.hpp"
|
||||||
|
#include "Commands/Control/DetachTarget.hpp"
|
||||||
#include "Commands/SetClockSpeed.hpp"
|
#include "Commands/SetClockSpeed.hpp"
|
||||||
#include "Commands/DebugModuleInterfaceOperation.hpp"
|
#include "Commands/DebugModuleInterfaceOperation.hpp"
|
||||||
|
|
||||||
@@ -63,7 +64,11 @@ namespace DebugToolDrivers::Wch::Protocols::WchLink
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WchLinkInterface::deactivate() {
|
void WchLinkInterface::deactivate() {
|
||||||
// TODO: implement this
|
const auto response = this->sendCommandAndWaitForResponse(Commands::Control::DetachTarget());
|
||||||
|
|
||||||
|
if (response.payload.size() != 1) {
|
||||||
|
throw Exceptions::DeviceCommunicationFailure("Unexpected response payload size for DetachTarget command");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WchLinkInterface::getDeviceId() {
|
std::string WchLinkInterface::getDeviceId() {
|
||||||
|
|||||||
Reference in New Issue
Block a user