tommag / TMC5160_Arduino

Arduino library for Trinamic TMC5160 stepper motor driver
MIT License
69 stars 25 forks source link

SPI for ESP #6

Closed jblatcher closed 3 years ago

jblatcher commented 3 years ago

Can the SPI be set up for the esp? Trying to run it over the hspi is this possible?

tommag commented 3 years ago

I guess it should work... Check out here for an example of setting up HSPI : https://github.com/espressif/arduino-esp32/blob/master/libraries/SPI/examples/SPI_Multiple_Buses/SPI_Multiple_Buses.ino

Then the TMC5160_SPI constructor last argument lets you specify which SPI instance you want to use.

I imagine that you would set it up like this ( /!\ I haven't tested this, this is just an example).

SPIClass SPI_HSPI(HSPI);
TMC5160_SPI motor(CS_PIN, TMC5160::DEFAULT_F_CLK, SPISettings(1000000, MSBFIRST, SPI_MODE0), SPI_HSPI);