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:
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "icsneo/device/tree/plasion/plasion.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/platform/ftdi.h"
|
||||
#include "icsneo/disk/plasiondiskreaddriver.h"
|
||||
#include "icsneo/disk/neomemorydiskdriver.h"
|
||||
|
||||
@@ -13,22 +12,12 @@ namespace icsneo {
|
||||
|
||||
class NeoVIION : public Plasion {
|
||||
public:
|
||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::ION;
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x0901;
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : FTDI::FindByProduct(PRODUCT_ID))
|
||||
found.emplace_back(new NeoVIION(neodevice));
|
||||
|
||||
return found;
|
||||
}
|
||||
// USB PID is 0x0901, standard driver is FTDI
|
||||
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIION, DeviceType::ION, 0x0901);
|
||||
|
||||
private:
|
||||
NeoVIION(neodevice_t neodevice) : Plasion(neodevice) {
|
||||
initialize<FTDI, NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
NeoVIION(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
|
||||
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<Communication> makeCommunication(
|
||||
|
||||
@@ -5,28 +5,17 @@
|
||||
|
||||
#include "icsneo/device/tree/plasion/plasion.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/platform/ftdi.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class NeoVIPLASMA : public Plasion {
|
||||
public:
|
||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::PLASMA;
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x0801;
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : FTDI::FindByProduct(PRODUCT_ID))
|
||||
found.emplace_back(new NeoVIPLASMA(neodevice));
|
||||
|
||||
return found;
|
||||
}
|
||||
// USB PID is 0x0801, standard driver is FTDI
|
||||
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIPLASMA, DeviceType::PLASMA, 0x0801);
|
||||
|
||||
private:
|
||||
NeoVIPLASMA(neodevice_t neodevice) : Plasion(neodevice) {
|
||||
initialize<FTDI>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
NeoVIPLASMA(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
|
||||
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<Communication> makeCommunication(
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/communication/multichannelcommunication.h"
|
||||
#include "icsneo/platform/ftdi.h"
|
||||
#include "icsneo/device/extensions/flexray/extension.h"
|
||||
|
||||
namespace icsneo {
|
||||
@@ -45,6 +44,8 @@ public:
|
||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
|
||||
protected:
|
||||
using Device::Device;
|
||||
|
||||
// TODO This is done so that Plasion can still transmit it's basic networks, awaiting slave VNET support
|
||||
virtual bool isSupportedRXNetwork(const Network&) const override { return true; }
|
||||
virtual bool isSupportedTXNetwork(const Network&) const override { return true; }
|
||||
@@ -55,7 +56,7 @@ protected:
|
||||
addExtension(std::make_shared<FlexRay::Extension>(*this, flexRayControllers));
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
// TODO Check configuration for FlexRay ColdStart mode, disable FlexRay 2 if so
|
||||
@@ -87,9 +88,6 @@ protected:
|
||||
const fire2vnet_status_t* status = reinterpret_cast<const fire2vnet_status_t*>(message->data.data());
|
||||
ethActivationStatus = status->ethernetActivationLineEnabled;
|
||||
}
|
||||
|
||||
public:
|
||||
Plasion(neodevice_t neodevice) : Device(neodevice) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user