Added Teensy support
This commit is contained in:
parent
0f51b966f6
commit
4bf25715d5
@ -100,6 +100,8 @@
|
|||||||
#elif defined(ARDUINO_ARCH_ARC32) // Intel Curie/101
|
#elif defined(ARDUINO_ARCH_ARC32) // Intel Curie/101
|
||||||
#define BOARD_101 1
|
#define BOARD_101 1
|
||||||
#include "CurieTimerOne.h"
|
#include "CurieTimerOne.h"
|
||||||
|
#elif defined(__arm__) && defined(TEENSYDUINO)
|
||||||
|
#define BOARD_TEENSY 1
|
||||||
#else
|
#else
|
||||||
#error Cannot identify board
|
#error Cannot identify board
|
||||||
#endif
|
#endif
|
||||||
@ -112,6 +114,9 @@
|
|||||||
#if defined(BOARD_101)
|
#if defined(BOARD_101)
|
||||||
#define PIN_ON(port, pin) { digitalWrite(pin, 1); }
|
#define PIN_ON(port, pin) { digitalWrite(pin, 1); }
|
||||||
#define PIN_OFF(port, pin) { digitalWrite(pin, 0); }
|
#define PIN_OFF(port, pin) { digitalWrite(pin, 0); }
|
||||||
|
#elif defined(BOARD_TEENSY)
|
||||||
|
#define PIN_ON(port, pin) { digitalWriteFast(pin, HIGH); }
|
||||||
|
#define PIN_OFF(port, pin) { digitalWriteFast(pin, LOW); }
|
||||||
#else
|
#else
|
||||||
#define PIN_ON(port, pin) { port |= pin; }
|
#define PIN_ON(port, pin) { port |= pin; }
|
||||||
#define PIN_OFF(port, pin) { port &= ~pin; }
|
#define PIN_OFF(port, pin) { port &= ~pin; }
|
||||||
@ -208,6 +213,41 @@
|
|||||||
#define MOTOR3_STEP_PORT PORTB
|
#define MOTOR3_STEP_PORT PORTB
|
||||||
#define MOTOR3_STEP_PIN B00000100
|
#define MOTOR3_STEP_PIN B00000100
|
||||||
|
|
||||||
|
#elif defined(BOARD_TEENSY)
|
||||||
|
|
||||||
|
#define MOTOR0_STEP_PORT 0
|
||||||
|
#define MOTOR0_STEP_PIN 2
|
||||||
|
|
||||||
|
#define MOTOR1_STEP_PORT 0
|
||||||
|
#define MOTOR1_STEP_PIN 4
|
||||||
|
|
||||||
|
#define MOTOR2_STEP_PORT 0
|
||||||
|
#define MOTOR2_STEP_PIN 6
|
||||||
|
|
||||||
|
#define MOTOR3_STEP_PORT 0
|
||||||
|
#define MOTOR3_STEP_PIN 8
|
||||||
|
|
||||||
|
#define MOTOR4_STEP_PORT 0
|
||||||
|
#define MOTOR4_STEP_PIN 14
|
||||||
|
|
||||||
|
#define MOTOR5_STEP_PORT 0
|
||||||
|
#define MOTOR5_STEP_PIN 16
|
||||||
|
|
||||||
|
#define MOTOR6_STEP_PORT 0
|
||||||
|
#define MOTOR6_STEP_PIN 18
|
||||||
|
|
||||||
|
#define MOTOR7_STEP_PORT 0
|
||||||
|
#define MOTOR7_STEP_PIN 20
|
||||||
|
|
||||||
|
byte stepPins[] = {MOTOR0_STEP_PIN,
|
||||||
|
MOTOR1_STEP_PIN,
|
||||||
|
MOTOR2_STEP_PIN,
|
||||||
|
MOTOR3_STEP_PIN,
|
||||||
|
MOTOR4_STEP_PIN,
|
||||||
|
MOTOR5_STEP_PIN,
|
||||||
|
MOTOR6_STEP_PIN,
|
||||||
|
MOTOR7_STEP_PIN};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -448,7 +488,10 @@ void setup()
|
|||||||
// setup motor pins - you can customize/modify these after loop
|
// setup motor pins - you can customize/modify these after loop
|
||||||
// default sets step/dir pairs together, with first four motors at 4/5, 6/7, 8/9, 10/11
|
// default sets step/dir pairs together, with first four motors at 4/5, 6/7, 8/9, 10/11
|
||||||
// then, for the Mega boards, it jumps to 28/29, 30/31, 32/33, 34/35
|
// then, for the Mega boards, it jumps to 28/29, 30/31, 32/33, 34/35
|
||||||
#if ( PINOUT_VERSION == 2 )
|
|
||||||
|
#if defined(BOARD_TEENSY)
|
||||||
|
motors[i].stepPin = stepPins[i];
|
||||||
|
#elif ( PINOUT_VERSION == 2 )
|
||||||
motors[i].stepPin = (i * 2) + ( (i < 4) ? 4 : 20 );
|
motors[i].stepPin = (i * 2) + ( (i < 4) ? 4 : 20 );
|
||||||
#elif ( PINOUT_VERSION == 1 )
|
#elif ( PINOUT_VERSION == 1 )
|
||||||
motors[i].stepPin = (i * 2) + ( (i < 4) ? 4 : 14 );
|
motors[i].stepPin = (i * 2) + ( (i < 4) ? 4 : 14 );
|
||||||
@ -543,10 +586,16 @@ void setup()
|
|||||||
|
|
||||||
CurieTimerOne.start(25, &updateStepDirection);
|
CurieTimerOne.start(25, &updateStepDirection);
|
||||||
|
|
||||||
|
#elif defined(BOARD_TEENSY)
|
||||||
|
|
||||||
|
static IntervalTimer timer;
|
||||||
|
timer.priority(128);
|
||||||
|
timer.begin(updateStepDirection, 25);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(BOARD_101)
|
#if defined(BOARD_101) || defined(BOARD_TEENSY)
|
||||||
void updateStepDirection(void)
|
void updateStepDirection(void)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user