ValueCAN3 Settings
parent
ef3c93258c
commit
526b3a0dc4
|
|
@ -4,6 +4,7 @@
|
||||||
#include "icsneo/device/device.h"
|
#include "icsneo/device/device.h"
|
||||||
#include "icsneo/device/devicetype.h"
|
#include "icsneo/device/devicetype.h"
|
||||||
#include "icsneo/platform/ftdi.h"
|
#include "icsneo/platform/ftdi.h"
|
||||||
|
#include "icsneo/device/valuecan3/valuecan3settings.h"
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
|
|
||||||
|
|
@ -22,7 +23,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ValueCAN3(neodevice_t neodevice) : Device(neodevice) {
|
ValueCAN3(neodevice_t neodevice) : Device(neodevice) {
|
||||||
initialize<FTDI>();
|
initialize<FTDI, ValueCAN3Settings>();
|
||||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||||
productId = PRODUCT_ID;
|
productId = PRODUCT_ID;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
#ifndef __VALUECAN3SETTINGS_H_
|
||||||
|
#define __VALUECAN3SETTINGS_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "icsneo/device/idevicesettings.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
namespace icsneo {
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma pack(push, 2)
|
||||||
|
typedef struct {
|
||||||
|
CAN_SETTINGS can1;
|
||||||
|
CAN_SETTINGS can2;
|
||||||
|
|
||||||
|
uint16_t network_enables;
|
||||||
|
uint16_t network_enabled_on_boot;
|
||||||
|
|
||||||
|
uint16_t iso15765_separation_time_offset;
|
||||||
|
|
||||||
|
uint16_t perf_en;
|
||||||
|
|
||||||
|
uint16_t misc_io_initial_ddr;
|
||||||
|
uint16_t misc_io_initial_latch;
|
||||||
|
uint16_t misc_io_report_period;
|
||||||
|
uint16_t misc_io_on_report_events;
|
||||||
|
} valuecan3_settings_t;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
class ValueCAN3Settings : public IDeviceSettings {
|
||||||
|
public:
|
||||||
|
ValueCAN3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(valuecan3_settings_t)) {}
|
||||||
|
CAN_SETTINGS* getCANSettingsFor(Network net) override {
|
||||||
|
auto cfg = getStructurePointer<valuecan3_settings_t>();
|
||||||
|
switch(net.getNetID()) {
|
||||||
|
case Network::NetID::HSCAN:
|
||||||
|
return &(cfg->can1);
|
||||||
|
case Network::NetID::MSCAN:
|
||||||
|
return &(cfg->can2);
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue