Initial commit

This commit is contained in:
Paul Hollinsky
2018-09-10 20:28:29 -04:00
commit e2e5017331
133 changed files with 24597 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#ifndef __DYNAMICLIB_H_LINUX_
#define __DYNAMICLIB_H_LINUX_
#include <dlfcn.h>
// Nothing special is needed to export
#define DLLExport
// #ifndef ICSNEO_NO_AUTO_DESTRUCT
// #define ICSNEO_DESTRUCTOR __attribute__((destructor));
// #else
#define ICSNEO_DESTRUCTOR
// #endif
#define icsneoDynamicLibraryLoad() dlopen("/media/paulywog/Windows 10/Users/phollinsky/Code/icsneonext/build/libicsneoc.so", RTLD_LAZY)
#define icsneoDynamicLibraryGetFunction(handle, func) dlsym(handle, func)
#define icsneoDynamicLibraryClose(handle) (dlclose(handle) == 0)
#endif
+51
View File
@@ -0,0 +1,51 @@
#ifndef __FTDI_H_LINUX_
#define __FTDI_H_LINUX_
#include <vector>
#include <memory>
#include <string>
#include <atomic>
#include <ftdi.hpp>
#include "device/include/neodevice.h"
#include "communication/include/icommunication.h"
#include "third-party/concurrentqueue/blockingconcurrentqueue.h"
namespace icsneo {
class FTDI : public ICommunication {
public:
static constexpr neodevice_handle_t INVALID_HANDLE = 0x7fffffff; // int32_t max value
static std::vector<neodevice_t> FindByProduct(int product);
static bool IsHandleValid(neodevice_handle_t handle);
FTDI(neodevice_t& forDevice);
~FTDI() { close(); }
bool open();
bool close();
bool isOpen() { return ftdiDevice.is_open(); }
private:
static Ftdi::Context context;
static neodevice_handle_t handleCounter;
class FTDIDevice : public Ftdi::Context {
public:
FTDIDevice() {}
FTDIDevice(const Ftdi::Context &x) : Ftdi::Context(x) {
handle = handleCounter++;
}
neodevice_handle_t handle = INVALID_HANDLE;
};
static std::vector<FTDIDevice> searchResultDevices;
static bool GetDeviceForHandle(neodevice_handle_t handle, FTDIDevice& device);
void readTask();
void writeTask();
bool openable; // Set to false in the constructor if the object has not been found in searchResultDevices
neodevice_t& device;
FTDIDevice ftdiDevice;
};
};
#endif
+31
View File
@@ -0,0 +1,31 @@
#ifndef __STM32_LINUX_H_
#define __STM32_LINUX_H_
#include "communication/include/icommunication.h"
#include "device/include/neodevice.h"
#include <chrono>
#include <stdint.h>
namespace icsneo {
class STM32 : public ICommunication {
public:
STM32(neodevice_t& forDevice) : device(forDevice) {}
static std::vector<neodevice_t> FindByProduct(int product);
bool open();
bool isOpen();
bool close();
private:
neodevice_t& device;
int fd = -1;
static constexpr neodevice_handle_t HANDLE_OFFSET = 10;
void readTask();
void writeTask();
};
};
#endif