Tidying low-level debug tool driver code:
- Use automatic objects for libusb/hidapi resources, where possible (to reduce manual resource management) - Removed unused/redundant code - Tidied HidInterface class - Tidied debug tool initialisation code - Other bits of tidying
This commit is contained in:
@@ -39,16 +39,12 @@ namespace Bloom::DebugToolDrivers
|
||||
static const std::uint16_t USB_VENDOR_ID = 1003;
|
||||
static const std::uint16_t USB_PRODUCT_ID = 8576;
|
||||
|
||||
MplabSnap(): UsbDevice(MplabSnap::USB_VENDOR_ID, MplabSnap::USB_PRODUCT_ID) {}
|
||||
MplabSnap();
|
||||
|
||||
void init() override;
|
||||
|
||||
void close() override;
|
||||
|
||||
Protocols::CmsisDap::Edbg::EdbgInterface& getEdbgInterface() {
|
||||
return this->edbgInterface;
|
||||
}
|
||||
|
||||
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
|
||||
return this->edbgAvr8Interface.get();
|
||||
}
|
||||
@@ -59,7 +55,7 @@ namespace Bloom::DebugToolDrivers
|
||||
|
||||
std::string getName() override {
|
||||
return "MPLAB Snap";
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the device serial number via the Discovery Protocol.
|
||||
@@ -79,7 +75,7 @@ namespace Bloom::DebugToolDrivers
|
||||
void endSession();
|
||||
|
||||
private:
|
||||
Protocols::CmsisDap::Edbg::EdbgInterface edbgInterface = Protocols::CmsisDap::Edbg::EdbgInterface();
|
||||
std::unique_ptr<Protocols::CmsisDap::Edbg::EdbgInterface> edbgInterface = nullptr;
|
||||
|
||||
/**
|
||||
* The MPLAB Snap employs the EDBG AVR8 Generic protocol, for debugging AVR8 targets. This protocol is
|
||||
|
||||
Reference in New Issue
Block a user