initial commit

This commit is contained in:
Matt McWilliams 2024-06-22 09:00:20 -04:00
commit 984f12b9fc
3 changed files with 93 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.DS_Store

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Matthew McWilliams
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

71
TB6600MotorDriver.h Normal file
View File

@ -0,0 +1,71 @@
#ifndef TB6600MotorDriver_h
#define TB6600MotorDriver_h
#include <Arduino.h>
/**
* D2 X Step
* D3 X Direction
* D4 X MS1 setting
* D5 X MS2 setting
* D6 Y Step
* D7 Y Direction
* D8 Y MS1 setting
* D9 Y MS2 setting
*
* MS1(X/Y) MS2(X/Y) Description
* L L Full step
* H L Half step
* L H Quarter step
* H H Eighth STEP
**/
class TB6600MotorDriver {
private:
const uint8_t _directionA = 3;
const uint8_t _directionB = 7;
const uint8_t _stepA = 2;
const uint8_t _stepB = 6;
const uint8_t _settingsA1 = 4;
const uint8_t _settingsA2 = 5;
const uint8_t _settingsB1 = 8;
const uint8_t _settingsB2 = 9;
volatile uint32_t _usStepA = 300;
volatile uint32_t _usStepB = 300;
//const uint8_t _microsteps = 8; //8 or 16
volatile uint8_t _modeA = 1; //1, 2, 4, or 8
volatile uint8_t _modeB = 1;
void _single(uint8_t motor);
void _micro(uint8_t motor);
void _both();
public:
IteadDualStepperShield();
uint16_t revsteps = 200; // # steps per revolution
volatile uint8_t directionA = 1;
volatile uint8_t directionB = 1;
void setup();
void setDir(uint8_t motor, uint8_t dir);
void setSpeed(uint8_t motor, uint16_t speed);
//full
void step(uint8_t motor, uint64_t steps, uint8_t dir);
void stepBoth(uint64_t steps);
void onestep(uint8_t motor, uint8_t dir);
void setStepperMode (uint8_t motor, uint8_t mode);
void release();
};
#endif