removed unused cond. trans. for NEW_SPI
This commit is contained in:
parent
fcfb4cdcae
commit
4567d2feca
@ -82,9 +82,7 @@
|
|||||||
#include "swspi.h"
|
#include "swspi.h"
|
||||||
#endif //SWSPI
|
#endif //SWSPI
|
||||||
|
|
||||||
#ifdef NEW_SPI
|
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#endif //NEW_SPI
|
|
||||||
|
|
||||||
#ifdef SWI2C
|
#ifdef SWI2C
|
||||||
#include "swi2c.h"
|
#include "swi2c.h"
|
||||||
@ -1087,9 +1085,7 @@ void setup()
|
|||||||
lcd_init();
|
lcd_init();
|
||||||
fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream
|
fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream
|
||||||
|
|
||||||
#ifdef NEW_SPI
|
|
||||||
spi_init();
|
spi_init();
|
||||||
#endif //NEW_SPI
|
|
||||||
|
|
||||||
lcd_splash();
|
lcd_splash();
|
||||||
|
|
||||||
|
@ -6,11 +6,7 @@
|
|||||||
#include "LiquidCrystal_Prusa.h"
|
#include "LiquidCrystal_Prusa.h"
|
||||||
#include "ultralcd.h"
|
#include "ultralcd.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#ifndef NEW_SPI
|
|
||||||
#include <SPI.h>
|
|
||||||
#else //NEW_SPI
|
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#endif //NEW_SPI
|
|
||||||
|
|
||||||
|
|
||||||
extern LiquidCrystal_Prusa lcd;
|
extern LiquidCrystal_Prusa lcd;
|
||||||
@ -162,9 +158,6 @@ void tmc2130_init()
|
|||||||
SET_INPUT(Y_TMC2130_DIAG);
|
SET_INPUT(Y_TMC2130_DIAG);
|
||||||
SET_INPUT(Z_TMC2130_DIAG);
|
SET_INPUT(Z_TMC2130_DIAG);
|
||||||
SET_INPUT(E0_TMC2130_DIAG);
|
SET_INPUT(E0_TMC2130_DIAG);
|
||||||
#ifndef NEW_SPI
|
|
||||||
SPI.begin();
|
|
||||||
#endif //NEW_SPI
|
|
||||||
for (int axis = 0; axis < 2; axis++) // X Y axes
|
for (int axis = 0; axis < 2; axis++) // X Y axes
|
||||||
{
|
{
|
||||||
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]);
|
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]);
|
||||||
@ -628,59 +621,6 @@ inline void tmc2130_cs_high(uint8_t axis)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NEW_SPI
|
|
||||||
|
|
||||||
uint8_t tmc2130_tx(uint8_t axis, uint8_t addr, uint32_t wval)
|
|
||||||
{
|
|
||||||
//datagram1 - request
|
|
||||||
printf_P(PSTR("tmc2130_tx %d 0x%02hhx, 0x%08lx\n"), axis, addr, wval);
|
|
||||||
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
|
|
||||||
printf_P(PSTR(" SPCR = 0x%02hhx\n"), SPCR);
|
|
||||||
printf_P(PSTR(" SPSR = 0x%02hhx\n"), SPSR);
|
|
||||||
tmc2130_cs_low(axis);
|
|
||||||
SPI.transfer(addr); // address
|
|
||||||
SPI.transfer((wval >> 24) & 0xff); // MSB
|
|
||||||
SPI.transfer((wval >> 16) & 0xff);
|
|
||||||
SPI.transfer((wval >> 8) & 0xff);
|
|
||||||
SPI.transfer(wval & 0xff); // LSB
|
|
||||||
tmc2130_cs_high(axis);
|
|
||||||
SPI.endTransaction();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval)
|
|
||||||
{
|
|
||||||
//datagram1 - request
|
|
||||||
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
|
|
||||||
tmc2130_cs_low(axis);
|
|
||||||
SPI.transfer(addr); // address
|
|
||||||
SPI.transfer(0); // MSB
|
|
||||||
SPI.transfer(0);
|
|
||||||
SPI.transfer(0);
|
|
||||||
SPI.transfer(0); // LSB
|
|
||||||
tmc2130_cs_high(axis);
|
|
||||||
SPI.endTransaction();
|
|
||||||
//datagram2 - response
|
|
||||||
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
|
|
||||||
tmc2130_cs_low(axis);
|
|
||||||
uint8_t stat = SPI.transfer(0); // status
|
|
||||||
uint32_t val32 = 0;
|
|
||||||
val32 = SPI.transfer(0); // MSB
|
|
||||||
val32 = (val32 << 8) | SPI.transfer(0);
|
|
||||||
val32 = (val32 << 8) | SPI.transfer(0);
|
|
||||||
val32 = (val32 << 8) | SPI.transfer(0); // LSB
|
|
||||||
tmc2130_cs_high(axis);
|
|
||||||
SPI.endTransaction();
|
|
||||||
if (rval != 0) *rval = val32;
|
|
||||||
return stat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else //NEW_SPI
|
|
||||||
|
|
||||||
//Arduino SPI
|
|
||||||
//#define TMC2130_SPI_ENTER() SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3))
|
|
||||||
//#define TMC2130_SPI_TXRX SPI.transfer
|
|
||||||
//#define TMC2130_SPI_LEAVE SPI.endTransaction
|
|
||||||
|
|
||||||
//spi
|
//spi
|
||||||
#define TMC2130_SPI_ENTER() spi_setup(TMC2130_SPCR, TMC2130_SPSR)
|
#define TMC2130_SPI_ENTER() spi_setup(TMC2130_SPCR, TMC2130_SPSR)
|
||||||
#define TMC2130_SPI_TXRX spi_txrx
|
#define TMC2130_SPI_TXRX spi_txrx
|
||||||
@ -727,8 +667,6 @@ uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval)
|
|||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //NEW_SPI
|
|
||||||
|
|
||||||
|
|
||||||
void tmc2130_eeprom_load_config()
|
void tmc2130_eeprom_load_config()
|
||||||
{
|
{
|
||||||
|
@ -118,9 +118,6 @@
|
|||||||
// New XYZ calibration
|
// New XYZ calibration
|
||||||
#define NEW_XYZCAL
|
#define NEW_XYZCAL
|
||||||
|
|
||||||
// Do not use Arduino SPI
|
|
||||||
#define NEW_SPI
|
|
||||||
|
|
||||||
// Watchdog support
|
// Watchdog support
|
||||||
#define WATCHDOG
|
#define WATCHDOG
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user