Getting v9k compiling again

This commit is contained in:
Rob Giseburt
2019-10-16 23:32:41 -05:00
parent 83e3c7aecb
commit f0b21a69a7
7 changed files with 49 additions and 42 deletions
+30 -30
View File
@@ -56,40 +56,40 @@
/**** Setup Actual Objects ****/
gpioDigitalInputPin<IRQPin<Motate::kInput1_PinNumber>> din1 {DI1_MODE, 1};
gpioDigitalInputPin<IRQPin<Motate::kInput2_PinNumber>> din2 {DI2_MODE, 2};
gpioDigitalInputPin<IRQPin<Motate::kInput3_PinNumber>> din3 {DI3_MODE, 3};
gpioDigitalInputPin<IRQPin<Motate::kInput4_PinNumber>> din4 {DI4_MODE, 4};
gpioDigitalInputPin<IRQPin<Motate::kInput5_PinNumber>> din5 {DI5_MODE, 5};
gpioDigitalInputPin<IRQPin<Motate::kInput6_PinNumber>> din6 {DI6_MODE, 6};
gpioDigitalInputPin<IRQPin<Motate::kInput7_PinNumber>> din7 {DI7_MODE, 7};
gpioDigitalInputPin<IRQPin<Motate::kInput8_PinNumber>> din8 {DI8_MODE, 8};
gpioDigitalInputPin<IRQPin<Motate::kInput9_PinNumber>> din9 {DI9_MODE, 9};
// gpioDigitalInputPin<IRQPin<Motate::kInput10_PinNumber>> din10 {DI10_MODE, 10};
// gpioDigitalInputPin<IRQPin<Motate::kInput11_PinNumber>> din11 {DI11_MODE, 11};
// gpioDigitalInputPin<IRQPin<Motate::kInput12_PinNumber>> din12 {DI12_MODE, 12};
gpioDigitalOutputPin<OutputType<OUTPUT1_PWM, Motate::kOutput1_PinNumber>> dout1 { DO1_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT2_PWM, Motate::kOutput2_PinNumber>> dout2 { DO2_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT3_PWM, Motate::kOutput3_PinNumber>> dout3 { DO3_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT4_PWM, Motate::kOutput4_PinNumber>> dout4 { DO4_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT5_PWM, Motate::kOutput5_PinNumber>> dout5 { DO5_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT6_PWM, Motate::kOutput6_PinNumber>> dout6 { DO6_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT7_PWM, Motate::kOutput7_PinNumber>> dout7 { DO7_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT8_PWM, Motate::kOutput8_PinNumber>> dout8 { DO8_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT9_PWM, Motate::kOutput9_PinNumber>> dout9 { DO9_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT10_PWM, Motate::kOutput10_PinNumber>> dout10 { DO10_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT11_PWM, Motate::kOutput11_PinNumber>> dout11 { DO11_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT12_PWM, Motate::kOutput12_PinNumber>> dout12 { DO12_MODE, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT13_PWM, Motate::kOutput13_PinNumber>> dout13 { DO13_MODE, (uint32_t)200000 };
/**** Setup Arrays - these are extern and MUST match the board_gpio.h ****/
gpioDigitalInputPin<IRQPin<Motate::kInput1_PinNumber>> din1 {DI1_ENABLED, DI1_POLARITY, 1, DI1_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInputPin<IRQPin<Motate::kInput2_PinNumber>> din2 {DI2_ENABLED, DI2_POLARITY, 2, DI2_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInputPin<IRQPin<Motate::kInput3_PinNumber>> din3 {DI3_ENABLED, DI3_POLARITY, 3, DI3_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInputPin<IRQPin<Motate::kInput4_PinNumber>> din4 {DI4_ENABLED, DI4_POLARITY, 4, DI4_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInputPin<IRQPin<Motate::kInput5_PinNumber>> din5 {DI5_ENABLED, DI5_POLARITY, 5, DI5_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInputPin<IRQPin<Motate::kInput6_PinNumber>> din6 {DI6_ENABLED, DI6_POLARITY, 6, DI6_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInputPin<IRQPin<Motate::kInput7_PinNumber>> din7 {DI7_ENABLED, DI7_POLARITY, 7, DI7_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInputPin<IRQPin<Motate::kInput8_PinNumber>> din8 {DI8_ENABLED, DI8_POLARITY, 8, DI8_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInputPin<IRQPin<Motate::kInput9_PinNumber>> din9 {DI9_ENABLED, DI9_POLARITY, 9, DI9_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
// gpioDigitalInputPin<IRQPin<Motate::kInput10_PinNumber>> din10 {DI10_ENABLED, DI10_POLARITY, 10, DI10_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
// gpioDigitalInputPin<IRQPin<Motate::kInput11_PinNumber>> din11 {DI11_ENABLED, DI11_POLARITY, 11, DI11_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
// gpioDigitalInputPin<IRQPin<Motate::kInput12_PinNumber>> din12 {DI12_ENABLED, DI12_POLARITY, 12, DI12_EXTERNAL_NUMBER, Motate::kPinInterruptOnChange|Motate::kPinInterruptPriorityHigh};
gpioDigitalInput* const d_in[] = {&din1, &din2, &din3, &din4, &din5, &din6, &din7, &din8, &din9};
gpioDigitalOutputPin<OutputType<OUTPUT1_PWM, Motate::kOutput1_PinNumber>> dout1 { DO1_ENABLED, DO1_POLARITY, DO1_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT2_PWM, Motate::kOutput2_PinNumber>> dout2 { DO2_ENABLED, DO2_POLARITY, DO2_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT3_PWM, Motate::kOutput3_PinNumber>> dout3 { DO3_ENABLED, DO3_POLARITY, DO3_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT4_PWM, Motate::kOutput4_PinNumber>> dout4 { DO4_ENABLED, DO4_POLARITY, DO4_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT5_PWM, Motate::kOutput5_PinNumber>> dout5 { DO5_ENABLED, DO5_POLARITY, DO5_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT6_PWM, Motate::kOutput6_PinNumber>> dout6 { DO6_ENABLED, DO6_POLARITY, DO6_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT7_PWM, Motate::kOutput7_PinNumber>> dout7 { DO7_ENABLED, DO7_POLARITY, DO7_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT8_PWM, Motate::kOutput8_PinNumber>> dout8 { DO8_ENABLED, DO8_POLARITY, DO8_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT9_PWM, Motate::kOutput9_PinNumber>> dout9 { DO9_ENABLED, DO9_POLARITY, DO9_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT10_PWM, Motate::kOutput10_PinNumber>> dout10 { DO10_ENABLED, DO10_POLARITY, DO10_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT11_PWM, Motate::kOutput11_PinNumber>> dout11 { DO11_ENABLED, DO11_POLARITY, DO11_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT12_PWM, Motate::kOutput12_PinNumber>> dout12 { DO12_ENABLED, DO12_POLARITY, DO12_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutputPin<OutputType<OUTPUT13_PWM, Motate::kOutput13_PinNumber>> dout13 { DO13_ENABLED, DO13_POLARITY, DO13_EXTERNAL_NUMBER, (uint32_t)200000 };
gpioDigitalOutput* const d_out[] = {&dout1, &dout2, &dout3, &dout4, &dout5, &dout6, &dout7, &dout8, &dout9, &dout10, &dout11, &dout12, &dout13};
// not yet used
// gpioAnalogInput* a_in[A_IN_CHANNELS];
// gpioAnalogOutput* a_out[A_OUT_CHANNELS];
gpioAnalogInput* const a_in[] = {};
/************************************************************************************
**** CODE **************************************************************************
+1 -1
View File
@@ -56,7 +56,7 @@ extern gpioDigitalOutput* const d_out[D_OUT_CHANNELS];
using Motate::IRQPin;
using Motate::PWMOutputPin;
using Motate::PWMLikeOutputPin;
template<bool can_pwm, pin_number... V>
template<bool can_pwm, Motate::pin_number... V>
using OutputType = typename std::conditional<can_pwm, PWMOutputPin<V...>, PWMLikeOutputPin<V...>>::type;
extern gpioDigitalInputPin<IRQPin<Motate::kInput1_PinNumber>> din1;
+3 -1
View File
@@ -88,6 +88,8 @@ extern StepDirStepper<Motate::kSocket4_StepPinNumber,
extern Stepper* Motors[MOTORS];
extern ExternalEncoder* const ExternalEncoders[0];
void board_stepper_init();
#endif // BOARD_STEPPER_H_ONCE
#endif // BOARD_STEPPER_H_ONCE
+2 -1
View File
@@ -73,7 +73,8 @@ 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
#endif // XIO_HAS_USB
usb.checkAndHandleVbusChange();
#endif // XIO_HAS_USB
}
+2 -2
View File
@@ -38,10 +38,10 @@
#include "MotateUSBCDC.h"
#if USB_SERIAL_PORTS_EXPOSED == 1
typedef Motate::USBDevice< USBDeviceHardware, Motate::USBCDC > XIOUSBDevice_t;
typedef Motate::USBDevice< Motate::USBDeviceHardware, Motate::USBCDC > XIOUSBDevice_t;
#endif
#if USB_SERIAL_PORTS_EXPOSED == 2
typedef Motate::USBDevice< USBDeviceHardware, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t;
typedef Motate::USBDevice< Motate::USBDeviceHardware, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t;
#endif
extern XIOUSBDevice_t usb;
+3
View File
@@ -106,6 +106,9 @@ using Motate::OutputPin;
#define FREQUENCY_DDA 150000UL // Hz step frequency. Interrupts actually fire at 2x (300 KHz)
#define FREQUENCY_DWELL 1000UL
#define PLANNER_QUEUE_SIZE (48)
#define SECONDARY_QUEUE_SIZE (10)
/**** Motate Definitions ****/
// Timer definitions. See stepper.h and other headers for setup
@@ -32,6 +32,7 @@
#include "MotateTimers.h"
#include "stepper.h"
#include "gpio.h" // for ioPolarity
using Motate::pin_number;
using Motate::OutputPin;
@@ -67,11 +68,11 @@ struct StepDirStepper final : Stepper {
OutputPin<ms2_num> _ms2;
PWMOutputPin<vref_num> _vref;
ioMode _step_polarity; // IO_ACTIVE_LOW or IO_ACTIVE_HIGH
ioMode _enable_polarity; // IO_ACTIVE_LOW or IO_ACTIVE_HIGH
ioPolarity _step_polarity; // IO_ACTIVE_LOW or IO_ACTIVE_HIGH
ioPolarity _enable_polarity; // IO_ACTIVE_LOW or IO_ACTIVE_HIGH
// sets default pwm freq for all motor vrefs (commented line below also sets HiZ)
StepDirStepper(ioMode step_polarity, ioMode enable_polarity, const uint32_t frequency = 250000) :
StepDirStepper(ioPolarity step_polarity, ioPolarity enable_polarity, const uint32_t frequency = 250000) :
Stepper{},
_step{step_polarity==IO_ACTIVE_LOW?kStartHigh:kStartLow},
_enable{enable_polarity==IO_ACTIVE_LOW?kStartHigh:kStartLow},
@@ -179,23 +180,23 @@ struct StepDirStepper final : Stepper {
}
};
ioMode getStepPolarity() const override
ioPolarity getStepPolarity() const override
{
return _step_polarity;
};
void setStepPolarity(ioMode new_sp) override
void setStepPolarity(ioPolarity new_sp) override
{
_step_polarity = new_sp;
stepEnd();
};
ioMode getEnablePolarity() const override
ioPolarity getEnablePolarity() const override
{
return _enable_polarity;
};
void setEnablePolarity(ioMode new_mp) override
void setEnablePolarity(ioPolarity new_mp) override
{
_enable_polarity = new_mp;
// this is a misnomer, but handles the logic we need for asserting the newly adjusted enable line correctly