mirror of
https://github.com/synthetos/g2.git
synced 2026-09-24 05:53:49 +08:00
Added USB_SERIAL_PORTS_EXPOSED to settings (Options: 1, or 2)
This commit is contained in:
@@ -42,20 +42,23 @@ const Motate::USBSettings_t Motate::USBSettings = {
|
||||
};
|
||||
/*gProductVersion = */ //0.1,
|
||||
|
||||
//Motate::USBDevice< Motate::USBCDC > usb;
|
||||
Motate::USBDevice< Motate::USBCDC, Motate::USBCDC > usb;
|
||||
XIOUSBDevice_t usb;
|
||||
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
|
||||
|
||||
decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial;
|
||||
decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
//decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
// 115200 is the default, as well.
|
||||
//UART<kSerial_RXPinNumber, kSerial_TXPinNumber, kSerial_RTSPinNumber, kSerial_CTSPinNumber> Serial {115200, UARTMode::RTSCTSFlowControl};
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos (http://synthetos.com)" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"g2core gQuadratic" )
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" )
|
||||
MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID()
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
//******** SPI ********
|
||||
#if XIO_HAS_SPI
|
||||
Motate::SPI<kSocket4_SPISlaveSelectPinNumber> spi;
|
||||
|
||||
@@ -29,15 +29,25 @@
|
||||
#ifndef board_xio_h
|
||||
#define board_xio_h
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
#include "MotateUSB.h"
|
||||
#include "MotateUSBCDC.h"
|
||||
|
||||
// extern Motate::USBDevice< Motate::USBCDC > usb;
|
||||
extern Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 1
|
||||
typedef Motate::USBDevice< Motate::USBCDC > XIOUSBDevice_t;
|
||||
#endif
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
typedef Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> XIOUSBDevice_t;
|
||||
#endif
|
||||
|
||||
extern XIOUSBDevice_t usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
|
||||
@@ -32,27 +32,31 @@
|
||||
#include "board_xio.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
const Motate::USBSettings_t Motate::USBSettings = {
|
||||
/*gVendorID = */ 0x1d50,
|
||||
/*gProductID = */ 0x606d,
|
||||
/*gProductVersion = */ G2CORE_FIRMWARE_VERSION,
|
||||
/*gAttributes = */ kUSBConfigAttributeSelfPowered,
|
||||
/*gPowerConsumption = */ 500};
|
||||
/*gProductVersion = */ // 0.1,
|
||||
/*gPowerConsumption = */ 500
|
||||
};
|
||||
/*gProductVersion = */ //0.1,
|
||||
|
||||
// Motate::USBDevice< Motate::USBCDC > usb;
|
||||
Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
XIOUSBDevice_t usb;
|
||||
|
||||
decltype(usb.mixin<0>::Serial)& SerialUSB = usb.mixin<0>::Serial;
|
||||
decltype(usb.mixin<1>::Serial)& SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
// 115200 is the default, as well.
|
||||
// UART<kSerial_RXPinNumber, kSerial_TXPinNumber, kSerial_RTSPinNumber, kSerial_CTSPinNumber> Serial {115200, UARTMode::RTSCTSFlowControl};
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING({'S', 'y', 'n', 't', 'h', 'e', 't', 'o', 's'})
|
||||
MOTATE_SET_USB_PRODUCT_STRING({'T', 'i', 'n', 'y', 'G', ' ', 'v', '2'})
|
||||
decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial;
|
||||
//decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" )
|
||||
MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID()
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,15 +29,26 @@
|
||||
#ifndef board_xio_h
|
||||
#define board_xio_h
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
#include "MotateUSB.h"
|
||||
#include "MotateUSBCDC.h"
|
||||
|
||||
// extern Motate::USBDevice< Motate::USBCDC > usb;
|
||||
extern Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 1
|
||||
typedef Motate::USBDevice< Motate::USBCDC > XIOUSBDevice_t;
|
||||
#endif
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
typedef Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> XIOUSBDevice_t;
|
||||
#endif
|
||||
|
||||
extern XIOUSBDevice_t usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
//******** SPI ********
|
||||
|
||||
@@ -32,28 +32,31 @@
|
||||
#include "board_xio.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
const Motate::USBSettings_t Motate::USBSettings = {
|
||||
/*gVendorID = */ 0x1d50,
|
||||
/*gProductID = */ 0x606d,
|
||||
/*gProductVersion = */ G2CORE_FIRMWARE_VERSION,
|
||||
/*gAttributes = */ kUSBConfigAttributeSelfPowered,
|
||||
/*gPowerConsumption = */ 500};
|
||||
/*gProductVersion = */ // 0.1,
|
||||
/*gPowerConsumption = */ 500
|
||||
};
|
||||
/*gProductVersion = */ //0.1,
|
||||
|
||||
// Motate::USBDevice< Motate::USBCDC > usb;
|
||||
Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
XIOUSBDevice_t usb;
|
||||
|
||||
decltype(usb.mixin<0>::Serial)& SerialUSB = usb.mixin<0>::Serial;
|
||||
decltype(usb.mixin<1>::Serial)& SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
// 115200 is the default, as well.
|
||||
// UART<kSerial_RXPinNumber, kSerial_TXPinNumber, kSerial_RTSPinNumber, kSerial_CTSPinNumber> Serial {115200, UARTMode::RTSCTSFlowControl};
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING({'S', 'y', 'n', 't', 'h', 'e', 't', 'o', 's'})
|
||||
MOTATE_SET_USB_PRODUCT_STRING({'T', 'i', 'n', 'y', 'G', ' ', 'v', '2'})
|
||||
decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial;
|
||||
//decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" )
|
||||
MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID()
|
||||
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
//******** SPI ********
|
||||
|
||||
@@ -29,15 +29,26 @@
|
||||
#ifndef board_xio_h
|
||||
#define board_xio_h
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
#include "MotateUSB.h"
|
||||
#include "MotateUSBCDC.h"
|
||||
|
||||
// extern Motate::USBDevice< Motate::USBCDC > usb;
|
||||
extern Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 1
|
||||
typedef Motate::USBDevice< Motate::USBCDC > XIOUSBDevice_t;
|
||||
#endif
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
typedef Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> XIOUSBDevice_t;
|
||||
#endif
|
||||
|
||||
extern XIOUSBDevice_t usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
//******** SPI ********
|
||||
|
||||
@@ -42,20 +42,23 @@ const Motate::USBSettings_t Motate::USBSettings = {
|
||||
};
|
||||
/*gProductVersion = */ //0.1,
|
||||
|
||||
//Motate::USBDevice< Motate::USBCDC > usb;
|
||||
Motate::USBDevice< Motate::USBCDC, Motate::USBCDC > usb;
|
||||
XIOUSBDevice_t usb;
|
||||
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
|
||||
|
||||
decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial;
|
||||
decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
//decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
// 115200 is the default, as well.
|
||||
//UART<kSerial_RXPinNumber, kSerial_TXPinNumber, kSerial_RTSPinNumber, kSerial_CTSPinNumber> Serial {115200, UARTMode::RTSCTSFlowControl};
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos (http://synthetos.com)" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"g2core gQuadratic" )
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" )
|
||||
MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID()
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
//******** SPI ********
|
||||
#if XIO_HAS_SPI
|
||||
Motate::SPI<kSocket4_SPISlaveSelectPinNumber> spi;
|
||||
@@ -71,7 +74,7 @@ void board_hardware_init(void) // called 1st
|
||||
{
|
||||
#if XIO_HAS_USB
|
||||
// Init USB
|
||||
usb.attach(); // USB setup. Runs in "background" as the rest of this executes
|
||||
usb.attach();
|
||||
#endif // XIO_HAS_USB
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,25 @@
|
||||
#ifndef board_xio_h
|
||||
#define board_xio_h
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
#include "MotateUSB.h"
|
||||
#include "MotateUSBCDC.h"
|
||||
|
||||
// extern Motate::USBDevice< Motate::USBCDC > usb;
|
||||
extern Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 1
|
||||
typedef Motate::USBDevice< Motate::USBCDC > XIOUSBDevice_t;
|
||||
#endif
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
typedef Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> XIOUSBDevice_t;
|
||||
#endif
|
||||
|
||||
extern XIOUSBDevice_t usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
|
||||
@@ -42,20 +42,23 @@ const Motate::USBSettings_t Motate::USBSettings = {
|
||||
};
|
||||
/*gProductVersion = */ //0.1,
|
||||
|
||||
//Motate::USBDevice< Motate::USBCDC > usb;
|
||||
Motate::USBDevice< Motate::USBCDC, Motate::USBCDC > usb;
|
||||
XIOUSBDevice_t usb;
|
||||
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
|
||||
|
||||
decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial;
|
||||
decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
//decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
// 115200 is the default, as well.
|
||||
//UART<kSerial_RXPinNumber, kSerial_TXPinNumber, kSerial_RTSPinNumber, kSerial_CTSPinNumber> Serial {115200, UARTMode::RTSCTSFlowControl};
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING( {'S' ,'y', 'n', 't', 'h', 'e', 't', 'o', 's'} )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( {'T', 'i', 'n', 'y', 'G', ' ', 'v', '2'} )
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" )
|
||||
MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID()
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
//******** SPI ********
|
||||
#if XIO_HAS_SPI
|
||||
Motate::SPI<kSocket4_SPISlaveSelectPinNumber> spi;
|
||||
@@ -71,7 +74,7 @@ void board_hardware_init(void) // called 1st
|
||||
{
|
||||
#if XIO_HAS_USB
|
||||
// Init USB
|
||||
usb.attach(); // USB setup. Runs in "background" as the rest of this executes
|
||||
usb.attach();
|
||||
#endif // XIO_HAS_USB
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,25 @@
|
||||
#ifndef board_xio_h
|
||||
#define board_xio_h
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
#include "MotateUSB.h"
|
||||
#include "MotateUSBCDC.h"
|
||||
|
||||
// extern Motate::USBDevice< Motate::USBCDC > usb;
|
||||
extern Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 1
|
||||
typedef Motate::USBDevice< Motate::USBCDC > XIOUSBDevice_t;
|
||||
#endif
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
typedef Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> XIOUSBDevice_t;
|
||||
#endif
|
||||
|
||||
extern XIOUSBDevice_t usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "board_xio.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
const Motate::USBSettings_t Motate::USBSettings = {
|
||||
/*gVendorID = */ 0x1d50,
|
||||
/*gProductID = */ 0x606d,
|
||||
@@ -41,18 +42,21 @@ const Motate::USBSettings_t Motate::USBSettings = {
|
||||
};
|
||||
/*gProductVersion = */ //0.1,
|
||||
|
||||
//Motate::USBDevice< Motate::USBCDC > usb;
|
||||
Motate::USBDevice< Motate::USBCDC, Motate::USBCDC > usb;
|
||||
XIOUSBDevice_t usb;
|
||||
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
|
||||
|
||||
decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial;
|
||||
decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
// 115200 is the default, as well.
|
||||
//UART<kSerial_RXPinNumber, kSerial_TXPinNumber, kSerial_RTSPinNumber, kSerial_CTSPinNumber> Serial {115200, UARTMode::RTSCTSFlowControl};
|
||||
//decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" )
|
||||
MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID()
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
//******** SPI ********
|
||||
@@ -68,8 +72,10 @@ Motate::UART<Motate::kSerial_RXPinNumber, Motate::kSerial_TXPinNumber, Motate::k
|
||||
|
||||
void board_hardware_init(void) // called 1st
|
||||
{
|
||||
#if XIO_HAS_USB
|
||||
// Init USB
|
||||
usb.attach(); // USB setup. Runs in "background" as the rest of this executes
|
||||
usb.attach();
|
||||
#endif // XIO_HAS_USB
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,15 +29,26 @@
|
||||
#ifndef board_xio_h
|
||||
#define board_xio_h
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
#include "MotateUSB.h"
|
||||
#include "MotateUSBCDC.h"
|
||||
|
||||
// extern Motate::USBDevice< Motate::USBCDC > usb;
|
||||
extern Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 1
|
||||
typedef Motate::USBDevice< Motate::USBCDC > XIOUSBDevice_t;
|
||||
#endif
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
typedef Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> XIOUSBDevice_t;
|
||||
#endif
|
||||
|
||||
extern XIOUSBDevice_t usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
//******** SPI ********
|
||||
#if XIO_HAS_SPI
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "board_xio.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
const Motate::USBSettings_t Motate::USBSettings = {
|
||||
/*gVendorID = */ 0x1d50,
|
||||
/*gProductID = */ 0x606d,
|
||||
@@ -41,20 +42,21 @@ const Motate::USBSettings_t Motate::USBSettings = {
|
||||
};
|
||||
/*gProductVersion = */ //0.1,
|
||||
|
||||
//Motate::USBDevice< Motate::USBCDC > usb;
|
||||
Motate::USBDevice< Motate::USBCDC, Motate::USBCDC > usb;
|
||||
XIOUSBDevice_t usb;
|
||||
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
#endif
|
||||
|
||||
|
||||
decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial;
|
||||
decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
//decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial;
|
||||
|
||||
// 115200 is the default, as well.
|
||||
//UART<kSerial_RXPinNumber, kSerial_TXPinNumber, kSerial_RTSPinNumber, kSerial_CTSPinNumber> Serial {115200, UARTMode::RTSCTSFlowControl};
|
||||
|
||||
|
||||
MOTATE_SET_USB_VENDOR_STRING( {'S' ,'y', 'n', 't', 'h', 'e', 't', 'o', 's'} )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( {'T', 'i', 'n', 'y', 'G', ' ', 'v', '2'} )
|
||||
MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" )
|
||||
MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" )
|
||||
MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID()
|
||||
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
|
||||
//******** SPI ********
|
||||
@@ -65,25 +67,26 @@ Motate::SPI<kSocket4_SPISlaveSelectPinNumber> spi;
|
||||
|
||||
//******** UART ********
|
||||
#if XIO_HAS_UART
|
||||
Motate::UART<Motate::kSerial_RXPinNumber, Motate::kSerial_TXPinNumber, Motate::kSerial_RTSPinNumber, Motate::kSerial_CTSPinNumber> Serial{
|
||||
115200, Motate::UARTMode::RTSCTSFlowControl};
|
||||
Motate::UART<Motate::kSerial_RXPinNumber, Motate::kSerial_TXPinNumber, Motate::kSerial_RTSPinNumber, Motate::kSerial_CTSPinNumber> Serial {115200, Motate::UARTMode::RTSCTSFlowControl};
|
||||
#endif
|
||||
|
||||
void board_hardware_init(void) // called 1st
|
||||
void board_hardware_init(void) // called 1st
|
||||
{
|
||||
#if XIO_HAS_USB
|
||||
// Init USB
|
||||
usb.attach(); // USB setup. Runs in "background" as the rest of this executes
|
||||
usb.attach();
|
||||
#endif // XIO_HAS_USB
|
||||
}
|
||||
|
||||
|
||||
void board_xio_init(void) // called later than board_hardware_init (there are thing in between)
|
||||
void board_xio_init(void) // called later than board_hardware_init (there are thing in between)
|
||||
{
|
||||
// Init SPI
|
||||
// Init SPI
|
||||
#if XIO_HAS_SPI
|
||||
// handled internally for now
|
||||
// handled internally for now
|
||||
#endif
|
||||
|
||||
// Init UART
|
||||
// Init UART
|
||||
#if XIO_HAS_UART
|
||||
Serial.init();
|
||||
#endif
|
||||
|
||||
@@ -29,28 +29,38 @@
|
||||
#ifndef board_xio_h
|
||||
#define board_xio_h
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
//******** USB ********
|
||||
#if XIO_HAS_USB
|
||||
#include "MotateUSB.h"
|
||||
#include "MotateUSBCDC.h"
|
||||
|
||||
// extern Motate::USBDevice< Motate::USBCDC > usb;
|
||||
extern Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> usb;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 1
|
||||
typedef Motate::USBDevice< Motate::USBCDC > XIOUSBDevice_t;
|
||||
#endif
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
typedef Motate::USBDevice<Motate::USBCDC, Motate::USBCDC> XIOUSBDevice_t;
|
||||
#endif
|
||||
|
||||
extern XIOUSBDevice_t usb;
|
||||
extern decltype(usb.mixin<0>::Serial)& SerialUSB;
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
extern decltype(usb.mixin<1>::Serial)& SerialUSB1;
|
||||
|
||||
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
|
||||
//******** SPI ********
|
||||
//#include "MotateSPI.h"
|
||||
// extern Motate::SPI<Motate::kSocket4_SPISlaveSelectPinNumber> spi;
|
||||
|
||||
|
||||
#if XIO_HAS_SPI
|
||||
#include "MotateSPI.h"
|
||||
extern Motate::SPI<Motate::kSocket4_SPISlaveSelectPinNumber> spi;
|
||||
#endif
|
||||
|
||||
//******** UART ********
|
||||
//#include "MotateUART.h"
|
||||
// extern Motate::UART<Motate::kSerial_RXPinNumber, Motate::kSerial_TXPinNumber, Motate::kSerial_RTSPinNumber, Motate::kSerial_CTSPinNumber> Serial;
|
||||
|
||||
|
||||
#if XIO_HAS_UART
|
||||
#include "MotateUART.h"
|
||||
extern Motate::UART<Motate::kSerial_RXPinNumber, Motate::kSerial_TXPinNumber, Motate::kSerial_RTSPinNumber, Motate::kSerial_CTSPinNumber> Serial;
|
||||
#endif
|
||||
|
||||
//******* Generic Functions *******
|
||||
void board_hardware_init(void); // called 1st
|
||||
|
||||
@@ -58,6 +58,11 @@
|
||||
|
||||
// *** Machine configuration settings *** //
|
||||
|
||||
#ifndef USB_SERIAL_PORTS_EXPOSED
|
||||
#define USB_SERIAL_PORTS_EXPOSED 1 // Valid options are 1 or 2, only!
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef JUNCTION_INTEGRATION_TIME
|
||||
#define JUNCTION_INTEGRATION_TIME 0.75 // {jt: cornering - between 0.05 and 2.00 (max)
|
||||
#endif
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "report.h"
|
||||
#include "controller.h"
|
||||
#include "util.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "board_xio.h"
|
||||
|
||||
@@ -949,10 +950,12 @@ xioDeviceWrapper<decltype(&SerialUSB)> serialUSB0Wrapper {
|
||||
&SerialUSB,
|
||||
(DEV_CAN_READ | DEV_CAN_WRITE | DEV_CAN_BE_CTRL | DEV_CAN_BE_DATA)
|
||||
};
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
xioDeviceWrapper<decltype(&SerialUSB1)> serialUSB1Wrapper {
|
||||
&SerialUSB1,
|
||||
(DEV_CAN_READ | DEV_CAN_WRITE | DEV_CAN_BE_CTRL | DEV_CAN_BE_DATA)
|
||||
};
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
#if XIO_HAS_UART==1
|
||||
xioDeviceWrapper<decltype(&Serial)> serial0Wrapper {
|
||||
@@ -966,7 +969,9 @@ xioDeviceWrapper<decltype(&Serial)> serial0Wrapper {
|
||||
xio_t xio = {
|
||||
#if XIO_HAS_USB == 1
|
||||
&serialUSB0Wrapper,
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
&serialUSB1Wrapper,
|
||||
#endif
|
||||
#endif // XIO_HAS_USB
|
||||
#if XIO_HAS_UART == 1
|
||||
&serial0Wrapper
|
||||
@@ -994,8 +999,10 @@ void xio_init()
|
||||
|
||||
#if XIO_HAS_USB == 1
|
||||
serialUSB0Wrapper.init();
|
||||
#if USB_SERIAL_PORTS_EXPOSED == 2
|
||||
serialUSB1Wrapper.init();
|
||||
#endif
|
||||
#endif
|
||||
#if XIO_HAS_UART == 1
|
||||
serial0Wrapper.init();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user