mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Drivers: Decouple from devices
This allows us to better implement alternative drivers for devices, such as for device sharing servers or talking to CoreMini processors within the same device.
This commit is contained in:
@@ -6,15 +6,14 @@
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radmoon2/radmoon2settings.h"
|
||||
#include "icsneo/platform/ftdi3.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADMoon2 : public Device {
|
||||
public:
|
||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADMoon2;
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x1202;
|
||||
static constexpr const char* SERIAL_START = "RM";
|
||||
// Serial numbers start with RM
|
||||
// USB PID is 0x1202, standard driver is FTDI3
|
||||
ICSNEO_FINDABLE_DEVICE(RADMoon2, DeviceType::RADMoon2, "RM");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
@@ -22,15 +21,6 @@ public:
|
||||
APM1000E_CLK, // Clock Option and Keysight Branding
|
||||
};
|
||||
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : FTDI3::FindByProduct(PRODUCT_ID))
|
||||
found.emplace_back(new RADMoon2(neodevice));
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
@@ -70,10 +60,8 @@ public:
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADMoon2(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<FTDI3, RADMoon2Settings>();
|
||||
productId = PRODUCT_ID;
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
RADMoon2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoon2Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
|
||||
Reference in New Issue
Block a user