diff --git a/src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp b/src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp index 809f382e..9aae9eae 100644 --- a/src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp +++ b/src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp @@ -71,6 +71,7 @@ namespace Bloom::DebugToolDrivers void AtmelIce::startSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( StartSession() @@ -86,6 +87,7 @@ namespace Bloom::DebugToolDrivers void AtmelIce::endSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( EndSession() diff --git a/src/DebugToolDrivers/Microchip/CuriosityNano/CuriosityNano.cpp b/src/DebugToolDrivers/Microchip/CuriosityNano/CuriosityNano.cpp index 04394029..23c9a765 100644 --- a/src/DebugToolDrivers/Microchip/CuriosityNano/CuriosityNano.cpp +++ b/src/DebugToolDrivers/Microchip/CuriosityNano/CuriosityNano.cpp @@ -63,6 +63,7 @@ namespace Bloom::DebugToolDrivers void CuriosityNano::startSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( StartSession() @@ -78,6 +79,7 @@ namespace Bloom::DebugToolDrivers void CuriosityNano::endSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( EndSession() diff --git a/src/DebugToolDrivers/Microchip/MplabPickit4/MplabPickit4.cpp b/src/DebugToolDrivers/Microchip/MplabPickit4/MplabPickit4.cpp index cb0de062..7c1b339d 100644 --- a/src/DebugToolDrivers/Microchip/MplabPickit4/MplabPickit4.cpp +++ b/src/DebugToolDrivers/Microchip/MplabPickit4/MplabPickit4.cpp @@ -64,6 +64,7 @@ namespace Bloom::DebugToolDrivers void MplabPickit4::startSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( StartSession() @@ -79,6 +80,7 @@ namespace Bloom::DebugToolDrivers void MplabPickit4::endSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( EndSession() diff --git a/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp b/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp index 508cc4bf..d9ef9833 100644 --- a/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp +++ b/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp @@ -63,6 +63,7 @@ namespace Bloom::DebugToolDrivers void MplabSnap::startSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( StartSession() @@ -78,6 +79,7 @@ namespace Bloom::DebugToolDrivers void MplabSnap::endSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( EndSession() diff --git a/src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp b/src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp index 99f275ef..9fc5a335 100644 --- a/src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp +++ b/src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp @@ -69,6 +69,7 @@ namespace Bloom::DebugToolDrivers void PowerDebugger::startSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( StartSession() @@ -86,6 +87,7 @@ namespace Bloom::DebugToolDrivers void PowerDebugger::endSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( EndSession() diff --git a/src/DebugToolDrivers/Microchip/XplainedMini/XplainedMini.cpp b/src/DebugToolDrivers/Microchip/XplainedMini/XplainedMini.cpp index 4223024f..10fdcba0 100644 --- a/src/DebugToolDrivers/Microchip/XplainedMini/XplainedMini.cpp +++ b/src/DebugToolDrivers/Microchip/XplainedMini/XplainedMini.cpp @@ -63,6 +63,7 @@ namespace Bloom::DebugToolDrivers void XplainedMini::startSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( StartSession() @@ -78,6 +79,7 @@ namespace Bloom::DebugToolDrivers void XplainedMini::endSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( EndSession() diff --git a/src/DebugToolDrivers/Microchip/XplainedNano/XplainedNano.cpp b/src/DebugToolDrivers/Microchip/XplainedNano/XplainedNano.cpp index 797f07c3..ec7c2cbf 100644 --- a/src/DebugToolDrivers/Microchip/XplainedNano/XplainedNano.cpp +++ b/src/DebugToolDrivers/Microchip/XplainedNano/XplainedNano.cpp @@ -63,6 +63,7 @@ namespace Bloom::DebugToolDrivers void XplainedNano::startSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( StartSession() @@ -78,6 +79,7 @@ namespace Bloom::DebugToolDrivers void XplainedNano::endSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( EndSession() diff --git a/src/DebugToolDrivers/Microchip/XplainedPro/XplainedPro.cpp b/src/DebugToolDrivers/Microchip/XplainedPro/XplainedPro.cpp index 90056e0a..5a9cfa48 100644 --- a/src/DebugToolDrivers/Microchip/XplainedPro/XplainedPro.cpp +++ b/src/DebugToolDrivers/Microchip/XplainedPro/XplainedPro.cpp @@ -72,6 +72,7 @@ namespace Bloom::DebugToolDrivers void XplainedPro::startSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( StartSession() @@ -87,6 +88,7 @@ namespace Bloom::DebugToolDrivers void XplainedPro::endSession() { using namespace CommandFrames::HouseKeeping; + using ResponseFrames::HouseKeeping::ResponseId; auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( EndSession() diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/HouseKeepingCommandFrame.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/HouseKeepingCommandFrame.hpp index 1d4d61b2..f3c97ae7 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/HouseKeepingCommandFrame.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/HouseKeepingCommandFrame.hpp @@ -5,28 +5,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::HouseKeeping { - enum class ResponseId : unsigned char - { - OK = 0x80, - LIST = 0x81, - DATA = 0x84, - FAILED = 0xA0, - FAILED_WITH_DATA = 0xA1 - }; - - inline bool operator == (unsigned char rawId, ResponseId id) { - return static_cast(id) == rawId; - } - - inline bool operator == (ResponseId id, unsigned char rawId) { - return rawId == id; - } - template class HouseKeepingCommandFrame: public AvrCommandFrame { public: - using ExpectedResponseFrameType = ResponseFrames::HouseKeepingResponseFrame; + using ExpectedResponseFrameType = ResponseFrames::HouseKeeping::HouseKeepingResponseFrame; HouseKeepingCommandFrame(): AvrCommandFrame(ProtocolHandlerId::HOUSE_KEEPING) {} }; diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/HouseKeeping/HouseKeepingResponseFrame.cpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/HouseKeeping/HouseKeepingResponseFrame.cpp index 98f8bd9b..762402d4 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/HouseKeeping/HouseKeepingResponseFrame.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/HouseKeeping/HouseKeepingResponseFrame.cpp @@ -2,17 +2,17 @@ #include "src/Exceptions/Exception.hpp" -namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames +namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::HouseKeeping { using namespace Bloom::Exceptions; - unsigned char HouseKeepingResponseFrame::getResponseId() { + ResponseId HouseKeepingResponseFrame::getResponseId() { const auto& payload = this->getPayload(); if (payload.empty()) { throw Exception("Response ID missing from HOUSEKEEPING response frame payload."); } - return payload[0]; + return static_cast(payload[0]); } } diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/HouseKeeping/HouseKeepingResponseFrame.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/HouseKeeping/HouseKeepingResponseFrame.hpp index 468638cc..4d2d1b04 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/HouseKeeping/HouseKeepingResponseFrame.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/HouseKeeping/HouseKeepingResponseFrame.hpp @@ -2,14 +2,23 @@ #include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AvrResponseFrame.hpp" -namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames +namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::HouseKeeping { + enum class ResponseId : unsigned char + { + OK = 0x80, + LIST = 0x81, + DATA = 0x84, + FAILED = 0xA0, + FAILED_WITH_DATA = 0xA1 + }; + class HouseKeepingResponseFrame: public AvrResponseFrame { public: HouseKeepingResponseFrame() = default; explicit HouseKeepingResponseFrame(const std::vector& avrResponses): AvrResponseFrame(avrResponses) {} - unsigned char getResponseId(); + ResponseId getResponseId(); }; }