mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
neoVI FIRE 2: MiscIO and EMiscIO Support
This commit is contained in:
@@ -1,15 +1,30 @@
|
||||
#ifndef __ICSNEO_IO_H_
|
||||
#define __ICSNEO_IO_H_
|
||||
|
||||
typedef struct _neomiscio_t {
|
||||
size_t number;
|
||||
bool supportsDigitalIn;
|
||||
bool supportsDigitalOut;
|
||||
bool supportsAnalogIn;
|
||||
#ifdef __cplusplus
|
||||
_neomiscio_t(size_t n, bool dIn = false, bool dOut = false, bool aIn = false)
|
||||
: number(n), supportsDigitalIn(dIn), supportsDigitalOut(dOut), supportsAnalogIn(aIn) {}
|
||||
#endif
|
||||
} neomiscio_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
using MiscIO = neomiscio_t;
|
||||
|
||||
enum class IO {
|
||||
EthernetActivation = 0, // The DoIP activation line, 0 is HiZ and 1 is pulled up to VBAT
|
||||
USBHostPower = 1,
|
||||
BackupPowerEnabled = 2, // The FIRE 2's backup super capacitor
|
||||
BackupPowerGood = 3, // Whether or not the FIRE 2's backup super capacitor is charged (read only)
|
||||
Misc = 4, // General purpose IO on the device
|
||||
EMisc = 5, // Extended general purpose IO on the device
|
||||
};
|
||||
|
||||
// Note that the C API does a static cast between this and neoio_t so keep them in sync!
|
||||
@@ -24,6 +39,8 @@ typedef enum _neoio_t {
|
||||
ICSNEO_IO_USB_HOST_POWER = (1),
|
||||
ICSNEO_IO_BACKUP_POWER_EN = (2),
|
||||
ICSNEO_IO_BACKUP_POWER_GOOD = (3),
|
||||
ICSNEO_IO_MISC = (4),
|
||||
ICSNEO_IO_EMISC = (5),
|
||||
} neoio_t;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -263,6 +263,7 @@ public:
|
||||
case NetID::MOST150:
|
||||
return Type::MOST;
|
||||
case NetID::RED:
|
||||
case NetID::Device:
|
||||
case NetID::Reset_Status:
|
||||
case NetID::DeviceStatus:
|
||||
case NetID::FlexRayControl:
|
||||
@@ -309,7 +310,7 @@ public:
|
||||
static const char* GetNetIDString(NetID netid) {
|
||||
switch(netid) {
|
||||
case NetID::Device:
|
||||
return "Device";
|
||||
return "neoVI";
|
||||
case NetID::HSCAN:
|
||||
return "HSCAN";
|
||||
case NetID::MSCAN:
|
||||
|
||||
@@ -107,6 +107,18 @@ public:
|
||||
*/
|
||||
virtual bool getBackupPowerSupported() const { return false; }
|
||||
|
||||
/**
|
||||
* Retrieve the information about the misc IOs present on this
|
||||
* device.
|
||||
*/
|
||||
virtual std::vector<MiscIO> getMiscIO() const { return {}; }
|
||||
|
||||
/**
|
||||
* Retrieve the information about the emisc IOs present on this
|
||||
* device.
|
||||
*/
|
||||
virtual std::vector<MiscIO> getEMiscIO() const { return {}; }
|
||||
|
||||
/**
|
||||
* Get the value of a digital IO, returning an empty optional if the
|
||||
* value is not present, the specified IO is not valid for this device,
|
||||
@@ -131,6 +143,16 @@ public:
|
||||
*/
|
||||
bool setDigitalIO(IO type, bool value) { return setDigitalIO(type, 1, value); }
|
||||
|
||||
/**
|
||||
* Get the value of an analog IO, returning an empty optional if the
|
||||
* value is not present, the specified IO is not valid for this device,
|
||||
* or if an error occurs.
|
||||
*
|
||||
* The index number starts counting at 1 to keep the numbers in sync
|
||||
* with the numbering on the device, and is set to 1 by default.
|
||||
*/
|
||||
optional<double> getAnalogIO(IO type, size_t number = 1);
|
||||
|
||||
virtual std::vector<std::shared_ptr<FlexRay::Controller>> getFlexRayControllers() const { return {}; }
|
||||
|
||||
const device_eventhandler_t& getEventHandler() const { return report; }
|
||||
@@ -150,6 +172,8 @@ protected:
|
||||
optional<bool> usbHostPowerStatus;
|
||||
optional<bool> backupPowerEnabled;
|
||||
optional<bool> backupPowerGood;
|
||||
std::array<optional<bool>, 6> miscDigital;
|
||||
std::array<optional<double>, 2> miscAnalog;
|
||||
|
||||
// START Initialization Functions
|
||||
Device(neodevice_t neodevice = { 0 }) {
|
||||
@@ -251,6 +275,8 @@ private:
|
||||
std::vector<Network> supportedTXNetworks;
|
||||
std::vector<Network> supportedRXNetworks;
|
||||
|
||||
void handleNeoVIMessage(std::shared_ptr<CANMessage> message);
|
||||
|
||||
enum class LEDState : uint8_t {
|
||||
Offline = 0x04,
|
||||
CoreMiniRunning = 0x08, // This should override "offline" if the CoreMini is running
|
||||
|
||||
@@ -73,6 +73,18 @@ public:
|
||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
size_t getUSBHostPowerCount() const override { return 1; }
|
||||
bool getBackupPowerSupported() const override { return true; }
|
||||
std::vector<MiscIO> getMiscIO() const override {
|
||||
return {
|
||||
{5, true, true, false},
|
||||
{6, true, true, false}
|
||||
};
|
||||
}
|
||||
std::vector<MiscIO> getEMiscIO() const override {
|
||||
return {
|
||||
{1, true, true, true},
|
||||
{2, true, true, true}
|
||||
};
|
||||
}
|
||||
|
||||
protected:
|
||||
NeoVIFIRE2(neodevice_t neodevice) : Device(neodevice) {
|
||||
|
||||
Reference in New Issue
Block a user