Drivers: Rename STM32 to CDC ACM

This is much more descriptive of what the driver actually is
This commit is contained in:
Paul Hollinsky
2021-05-04 22:37:16 -04:00
parent 6d22b1e001
commit 78e3eb18df
20 changed files with 83 additions and 83 deletions
@@ -7,7 +7,7 @@
#include "icsneo/device/devicetype.h"
#include "icsneo/communication/packetizer.h"
#include "icsneo/communication/decoder.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
#include "icsneo/device/tree/etherbadge/etherbadgesettings.h"
namespace icsneo {
@@ -22,7 +22,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
for(auto neodevice : CDCACM::FindByProduct(PRODUCT_ID))
found.emplace_back(new EtherBADGE(neodevice));
return found;
@@ -42,7 +42,7 @@ public:
EtherBADGE(neodevice_t neodevice) : Device(neodevice) {
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
initialize<STM32, EtherBADGESettings>();
initialize<CDCACM, EtherBADGESettings>();
}
protected:
@@ -5,7 +5,7 @@
#include "icsneo/device/device.h"
#include "icsneo/device/devicetype.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
namespace icsneo {
@@ -17,7 +17,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
for(auto neodevice : CDCACM::FindByProduct(PRODUCT_ID))
found.emplace_back(new NeoOBD2PRO(neodevice));
return found;
@@ -33,7 +33,7 @@ public:
private:
NeoOBD2PRO(neodevice_t neodevice) : Device(neodevice) {
initialize<STM32>();
initialize<CDCACM>();
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}
@@ -5,7 +5,7 @@
#include "icsneo/device/device.h"
#include "icsneo/device/devicetype.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
namespace icsneo {
@@ -17,7 +17,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
for(auto neodevice : CDCACM::FindByProduct(PRODUCT_ID))
found.emplace_back(new NeoOBD2SIM(neodevice));
return found;
@@ -33,7 +33,7 @@ public:
private:
NeoOBD2SIM(neodevice_t neodevice) : Device(neodevice) {
initialize<STM32>();
initialize<CDCACM>();
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}
@@ -6,7 +6,7 @@
#include "icsneo/device/device.h"
#include "icsneo/device/devicetype.h"
#include "icsneo/device/tree/radmoonduo/radmoonduosettings.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
namespace icsneo {
@@ -19,7 +19,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
for(auto neodevice : CDCACM::FindByProduct(PRODUCT_ID))
found.emplace_back(new RADMoonDuo(neodevice));
return found;
@@ -35,7 +35,7 @@ public:
protected:
RADMoonDuo(neodevice_t neodevice) : Device(neodevice) {
initialize<STM32, RADMoonDuoSettings>();
initialize<CDCACM, RADMoonDuoSettings>();
productId = PRODUCT_ID;
getWritableNeoDevice().type = DEVICE_TYPE;
}
@@ -4,7 +4,7 @@
#ifdef __cplusplus
#include "icsneo/device/tree/radpluto/radpluto.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
namespace icsneo {
@@ -14,7 +14,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
for(auto neodevice : CDCACM::FindByProduct(PRODUCT_ID))
found.emplace_back(new RADPlutoUSB(neodevice));
return found;
@@ -22,7 +22,7 @@ public:
private:
RADPlutoUSB(neodevice_t neodevice) : RADPluto(neodevice) {
initialize<STM32, RADPlutoSettings>();
initialize<CDCACM, RADPlutoSettings>();
}
};
@@ -5,7 +5,7 @@
#include "icsneo/device/tree/valuecan4/valuecan4.h"
#include "icsneo/device/tree/valuecan4/settings/valuecan4-1settings.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
#include <string>
namespace icsneo {
@@ -19,7 +19,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(USB_PRODUCT_ID)) {
for(auto neodevice : CDCACM::FindByProduct(USB_PRODUCT_ID)) {
if(std::string(neodevice.serial).substr(0, 2) == SERIAL_START)
found.emplace_back(new ValueCAN4_1(neodevice));
}
@@ -50,7 +50,7 @@ protected:
private:
ValueCAN4_1(neodevice_t neodevice) : ValueCAN4(neodevice) {
initialize<STM32, ValueCAN4_1Settings>();
initialize<CDCACM, ValueCAN4_1Settings>();
getWritableNeoDevice().type = DEVICE_TYPE;
productId = USB_PRODUCT_ID;
}
@@ -5,7 +5,7 @@
#include "icsneo/device/tree/valuecan4/valuecan4.h"
#include "icsneo/device/tree/valuecan4/settings/valuecan4-2settings.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
#include <string>
namespace icsneo {
@@ -24,7 +24,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(USB_PRODUCT_ID)) {
for(auto neodevice : CDCACM::FindByProduct(USB_PRODUCT_ID)) {
if(std::string(neodevice.serial).substr(0, 2) == SERIAL_START)
found.emplace_back(new ValueCAN4_2(neodevice));
}
@@ -70,7 +70,7 @@ protected:
private:
ValueCAN4_2(neodevice_t neodevice) : ValueCAN4(neodevice) {
initialize<STM32, ValueCAN4_2Settings>();
initialize<CDCACM, ValueCAN4_2Settings>();
getWritableNeoDevice().type = DEVICE_TYPE;
productId = USB_PRODUCT_ID;
}
@@ -67,7 +67,7 @@ protected:
private:
ValueCAN4_2EL_ETH(neodevice_t neodevice) : ValueCAN4_2EL(neodevice) {
initialize<STM32, ValueCAN4_2ELSettings>();
initialize<CDCACM, ValueCAN4_2ELSettings>();
productId = ETH_PRODUCT_ID;
}
};
@@ -4,7 +4,7 @@
#ifdef __cplusplus
#include "icsneo/device/tree/valuecan4/valuecan4-2el.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
#include <string>
namespace icsneo {
@@ -14,7 +14,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(USB_PRODUCT_ID)) {
for(auto neodevice : CDCACM::FindByProduct(USB_PRODUCT_ID)) {
if(std::string(neodevice.serial).substr(0, 2) == SERIAL_START)
found.emplace_back(new ValueCAN4_2EL_USB(neodevice));
}
@@ -43,7 +43,7 @@ protected:
private:
ValueCAN4_2EL_USB(neodevice_t neodevice) : ValueCAN4_2EL(neodevice) {
initialize<STM32, ValueCAN4_2ELSettings>();
initialize<CDCACM, ValueCAN4_2ELSettings>();
productId = USB_PRODUCT_ID;
}
};
@@ -5,7 +5,7 @@
#include "icsneo/device/tree/valuecan4/valuecan4.h"
#include "icsneo/device/tree/valuecan4/settings/valuecan4-4settings.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
#include <string>
namespace icsneo {
@@ -26,7 +26,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(USB_PRODUCT_ID)) {
for(auto neodevice : CDCACM::FindByProduct(USB_PRODUCT_ID)) {
if(std::string(neodevice.serial).substr(0, 2) == SERIAL_START)
found.emplace_back(new ValueCAN4_4(neodevice));
}
@@ -81,7 +81,7 @@ protected:
private:
ValueCAN4_4(neodevice_t neodevice) : ValueCAN4(neodevice) {
initialize<STM32, ValueCAN4_4Settings>();
initialize<CDCACM, ValueCAN4_4Settings>();
getWritableNeoDevice().type = DEVICE_TYPE;
productId = USB_PRODUCT_ID;
}
@@ -4,7 +4,7 @@
#ifdef __cplusplus
#include "icsneo/device/tree/valuecan4/valuecan4industrial.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
#include <string>
namespace icsneo {
@@ -14,7 +14,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(USB_PRODUCT_ID)) {
for(auto neodevice : CDCACM::FindByProduct(USB_PRODUCT_ID)) {
if(std::string(neodevice.serial).substr(0, 2) == SERIAL_START)
found.emplace_back(new ValueCAN4IndustrialUSB(neodevice));
}
@@ -43,7 +43,7 @@ protected:
private:
ValueCAN4IndustrialUSB(neodevice_t neodevice) : ValueCAN4Industrial(neodevice) {
initialize<STM32, ValueCAN4IndustrialSettings>();
initialize<CDCACM, ValueCAN4IndustrialSettings>();
}
};
@@ -5,7 +5,7 @@
#include "icsneo/device/device.h"
#include "icsneo/device/devicetype.h"
#include "icsneo/platform/stm32.h"
#include "icsneo/platform/cdcacm.h"
#include "icsneo/device/tree/vividcan/vividcansettings.h"
namespace icsneo {
@@ -18,7 +18,7 @@ public:
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
for(auto neodevice : CDCACM::FindByProduct(PRODUCT_ID))
found.emplace_back(new VividCAN(neodevice));
return found;
@@ -40,7 +40,7 @@ protected:
private:
VividCAN(neodevice_t neodevice) : Device(neodevice) {
initialize<STM32, VividCANSettings>();
initialize<CDCACM, VividCANSettings>();
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}
+14
View File
@@ -0,0 +1,14 @@
#ifndef __CDCACM_H_
#define __CDCACM_H_
#define INTREPID_USB_VENDOR_ID (0x093c)
#if defined _WIN32
#include "icsneo/platform/windows/cdcacm.h"
#elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#include "icsneo/platform/posix/cdcacm.h"
#else
#warning "This platform is not supported by the CDC ACM driver"
#endif
#endif
@@ -1,5 +1,5 @@
#ifndef __STM32_POSIX_H_
#define __STM32_POSIX_H_
#ifndef __CDCACM_POSIX_H_
#define __CDCACM_POSIX_H_
#ifdef __cplusplus
@@ -13,20 +13,20 @@
namespace icsneo {
class STM32 : public Driver {
class CDCACM : public Driver {
public:
/*
/**
* Note: This is a driver for all devices which use CDC_ACM
* Once we find the TTY we want it's a pretty generic POSIX TTY driver, but
* the method for finding the TTY we want varies by OS.
* On Linux, we read sysfs to find users of the CDC_ACM driver
* On macOS, we use IOKit to find the USB device we're looking for
* As such platform specific FindByProduct & HandleToTTY code can be found
* in stm32linux.cpp and stm32darwin.cpp respectively
* in cdcacmlinux.cpp and cdcacmdarwin.cpp respectively
* Other POSIX systems (BSDs, QNX, etc) will need bespoke code written in the future
*/
STM32(const device_eventhandler_t& err, neodevice_t& forDevice) : Driver(err), device(forDevice) {}
~STM32();
CDCACM(const device_eventhandler_t& err, neodevice_t& forDevice) : Driver(err), device(forDevice) {}
~CDCACM();
static std::vector<neodevice_t> FindByProduct(int product);
bool open() override;
-14
View File
@@ -1,14 +0,0 @@
#ifndef __STM32_H_
#define __STM32_H_
#define INTREPID_USB_VENDOR_ID (0x093c)
#if defined _WIN32
#include "icsneo/platform/windows/stm32.h"
#elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#include "icsneo/platform/posix/stm32.h"
#else
#warning "This platform is not supported by the STM32 driver"
#endif
#endif
@@ -1,5 +1,5 @@
#ifndef __STM32_WINDOWS_H_
#define __STM32_WINDOWS_H_
#ifndef __CDCACM_WINDOWS_H_
#define __CDCACM_WINDOWS_H_
#ifdef __cplusplus
@@ -7,9 +7,9 @@
namespace icsneo {
class STM32 : public VCP {
class CDCACM : public VCP {
public:
STM32(const device_eventhandler_t& err, neodevice_t& forDevice) : VCP(err, forDevice) {}
CDCACM(const device_eventhandler_t& err, neodevice_t& forDevice) : VCP(err, forDevice) {}
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, { L"usbser" }); }
};