资源简介
Arduino-TMC2130Stepper.zip,Trinamic TMC2130步进驱动器RTMC2130步进器的Arduino库,Arduino是一家开源软硬件公司和制造商社区。Arduino始于21世纪初,深受电子制造商的欢迎,Arduino通过开源系统提供了很多灵活性。
代码片段和文件信息
#include “SW_SPI.h“
SW_SPIClass TMC_SW_SPI;
#if defined(ARDUINO_ARCH_AVR)
#define getPort(P) digitalPinToPort(P)
#define writeMOSI_H *mosi_register |= mosi_bm
#define writeMOSI_L *mosi_register &= ~mosi_bm
#define writeSCK_H *sck_register |= sck_bm
#define writeSCK_L *sck_register &= ~sck_bm
#define readMISO *miso_register & miso_bm
#elif defined(ARDUINO_ARCH_SAM) // DUE:1.2MHz
// by stimmer https://forum.arduino.cc/index.php?topic=129868.msg980466#msg980466
#define writeMOSI_H g_APinDescription[mosi_pin].pPort -> PIO_SODR = g_APinDescription[mosi_pin].ulPin
#define writeMOSI_L g_APinDescription[mosi_pin].pPort -> PIO_CODR = g_APinDescription[mosi_pin].ulPin
#define writeSCK_H g_APinDescription[sck_pin].pPort -> PIO_SODR = g_APinDescription[sck_pin].ulPin
#define writeSCK_L g_APinDescription[sck_pin].pPort -> PIO_CODR = g_APinDescription[sck_pin].ulPin
#define readMISO !!(g_APinDescription[miso_pin].pPort -> PIO_PDSR & g_APinDescription[miso_pin].ulPin)
#else // DUE:116kHz
#define writeMOSI_H digitalWrite(mosi_pin HIGH)
#define writeMOSI_L digitalWrite(mosi_pin LOW)
#define writeSCK_H digitalWrite(sck_pin HIGH)
#define writeSCK_L digitalWrite(sck_pin LOW)
#define readMISO digitalRead(miso_pin)
#endif
void SW_SPIClass::setPins(uint16_t sw_mosi_pin uint16_t sw_miso_pin uint16_t sw_sck_pin) {
mosi_pin = sw_mosi_pin;
miso_pin = sw_miso_pin;
sck_pin = sw_sck_pin;
}
void SW_SPIClass::init() {
pinMode(mosi_pin OUTPUT);
pinMode(sck_pin OUTPUT);
pinMode(miso_pin INPUT_PULLUP);
#ifndef TARGET_LPC1768
mosi_bm = digitalPinToBitMask(mosi_pin);
miso_bm = digitalPinToBitMask(miso_pin);
sck_bm = digitalPinToBitMask(sck_pin);
#ifdef ARDUINO_ARCH_AVR
mosi_register = portOutputRegister(getPort(mosi_pin));
miso_register = portInputRegister(getPort(miso_pin));
sck_register = portOutputRegister(getPort(sck_pin));
#endif
#endif
}
//Combined shiftOut and shiftIn from Arduino wiring_shift.c
byte SW_SPIClass::transfer(uint8_t ulVal uint8_t ulBitOrder) {
uint8_t value = 0;
for (uint8_t i=0 ; i<8 ; ++i) {
// Write bit
if ( ulBitOrder == LSBFIRST ) {
!!(ulVal & (1 << i)) ? writeMOSI_H : writeMOSI_L;
} else {
!!(ulVal & (1 << (7 - i))) ? writeMOSI_H : writeMOSI_L;
}
// Start clock pulse
writeSCK_H;
// Read bit
if ( ulBitOrder == LSBFIRST ) {
value |= ( readMISO ? 1 : 0) << i ;
} else {
value |= ( readMISO ? 1 : 0) << (7 - i) ;
}
// Stop clock pulse
writeSCK_L;
}
return value;
}
uint16_t SW_SPIClass::transfer16(uint16_t data) {
uint16_t returnVal = 0x0000;
returnVal |= transfer((data>>8)&0xFF) << 8;
returnVal |= transfer(data&0xFF) & 0xFF;
return returnVal;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-05-01 21:16 TMC2130Stepper-master\
文件 34520 2019-05-01 21:16 TMC2130Stepper-master\LICENSE
文件 16077 2019-05-01 21:16 TMC2130Stepper-master\README.md
目录 0 2019-05-01 21:16 TMC2130Stepper-master\examples\
目录 0 2019-05-01 21:16 TMC2130Stepper-master\examples\Calibrate_spreadCycle\
文件 6520 2019-05-01 21:16 TMC2130Stepper-master\examples\Calibrate_spreadCycle\Calibrate_spreadCycle.ino
目录 0 2019-05-01 21:16 TMC2130Stepper-master\examples\Live_tune\
文件 11648 2019-05-01 21:16 TMC2130Stepper-master\examples\Live_tune\Live_tune.ino
目录 0 2019-05-01 21:16 TMC2130Stepper-master\examples\Simple\
文件 1224 2019-05-01 21:16 TMC2130Stepper-master\examples\Simple\Simple.ino
目录 0 2019-05-01 21:16 TMC2130Stepper-master\examples\Software_SPI\
文件 1341 2019-05-01 21:16 TMC2130Stepper-master\examples\Software_SPI\Software_SPI.ino
目录 0 2019-05-01 21:16 TMC2130Stepper-master\examples\StallGuard\
文件 3702 2019-05-01 21:16 TMC2130Stepper-master\examples\StallGuard\StallGuard.ino
目录 0 2019-05-01 21:16 TMC2130Stepper-master\examples\TMC2130_AccelStepper\
文件 1574 2019-05-01 21:16 TMC2130Stepper-master\examples\TMC2130_AccelStepper\TMC2130_AccelStepper.ino
目录 0 2019-05-01 21:16 TMC2130Stepper-master\extras\
目录 0 2019-05-01 21:16 TMC2130Stepper-master\extras\Fritzing\
文件 51869 2019-05-01 21:16 TMC2130Stepper-master\extras\Fritzing\SilentStepStick-TMC2130-part.fzpz
文件 59651 2019-05-01 21:16 TMC2130Stepper-master\extras\Fritzing\TMC2130-breadboard.svg
文件 61953 2019-05-01 21:16 TMC2130Stepper-master\extras\Fritzing\TMC2130-sample-circuit .fzz
文件 242253 2019-05-01 21:16 TMC2130Stepper-master\extras\Fritzing\TMC2130-sample-circuit .png
文件 40842 2019-05-01 21:16 TMC2130Stepper-master\extras\Fritzing\TMC2130-schematic.svg
文件 92762 2019-05-01 21:16 TMC2130Stepper-master\extras\TMC5130_TMC2130_TMC2100_Calculations.xlsx
文件 3065 2019-05-01 21:16 TMC2130Stepper-master\keywords.txt
文件 293 2019-05-01 21:16 TMC2130Stepper-master\library.properties
目录 0 2019-05-01 21:16 TMC2130Stepper-master\src\
文件 21836 2019-05-01 21:16 TMC2130Stepper-master\src\TMC2130Stepper.h
文件 10463 2019-05-01 21:16 TMC2130Stepper-master\src\TMC2130Stepper_REGDEFS.h
文件 658 2019-05-01 21:16 TMC2130Stepper-master\src\TMC2130Stepper_UTILITY.h
目录 0 2019-05-01 21:16 TMC2130Stepper-master\src\source\
............此处省略10个文件信息
相关资源
- Arduino-smartcar_shield.zip
- 基于arduino的温度检测和显示
- TFmini_Plus I²C版在Arduino上的例程及参考
- pid算法-arduino
- HidEmuKbd.bin
- arduino编程库函数合集
- arduino JSON数据格式库
- proteus arduino仿真库
- arduino 多个程序一起工作程序
- arduino蜂鸣器和光控灯实验报告
- Arduino自动浇花系统_一路继电器控制水
- Arduino小车控制程序含遥控+寻迹+避障
- TM1637显示器arduino库文件
- arduino rfid库函数
- 基于arduino的循迹小车不含有PID算法
- 基于arduino的循迹小车含有PID算法
- 基于arduino的无线温湿度传输系统
- Arduino多任务同时进行.rar
- arduino 机械臂 画圆程序 通过Arduino控制
- PS2+ arduino+接线图+源码
- CH340G-CH340通用驱动 支持win10/win7 64位驱
- 智能小车黑线循迹&超声波避障综合实
- arduino光电编码器程序
- Arduino智能鱼缸
- arduino pid循迹代码.zip
- Arduino红外传感器库文件
- DHT11库文件和
- arduino pid 调节 平衡小车代码
- Arduino全地形小车代码
- Arduino红外循迹小车
评论
共有 条评论