diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrames.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrames.hpp index 7043d3ca..5c46c886 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrames.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrames.hpp @@ -8,5 +8,6 @@ #include "HouseKeeping/HouseKeepingCommandFrame.hpp" #include "HouseKeeping/StartSession.hpp" #include "HouseKeeping/EndSession.hpp" +#include "HouseKeeping/GetParameter.hpp" #include "AVR8Generic/Avr8GenericCommandFrame.hpp" diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/GetParameter.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/GetParameter.hpp new file mode 100644 index 00000000..3d02a4ce --- /dev/null +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/GetParameter.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include + +#include "HouseKeepingCommandFrame.hpp" +#include "Parameters.hpp" + +namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::HouseKeeping +{ + class GetParameter: public HouseKeepingCommandFrame + { + public: + explicit GetParameter(const Parameter& parameter): parameter(parameter) {} + + GetParameter(const Parameter& parameter, std::uint8_t size): GetParameter(parameter) { + this->setSize(size); + } + + void setParameter(const Parameter& parameter) { + this->parameter = parameter; + } + + void setSize(std::uint8_t size) { + this->size = size; + } + + [[nodiscard]] std::vector getPayload() const override { + /* + * The get param command consists of 5 bytes: + * 1. Command ID (0x02) + * 2. Version (0x00) + * 3. Param context (Parameter::context) + * 4. Param ID (Parameter::id) + * 5. Param value length (this->size) + */ + auto output = std::vector(5, 0x00); + output[0] = 0x02; + output[1] = 0x00; + output[2] = static_cast(this->parameter.context); + output[3] = static_cast(this->parameter.id); + output[4] = static_cast(this->size); + + return output; + } + + private: + Parameter parameter; + std::uint8_t size = 0; + }; +}