Example TMC2130 pinout
parent
041d75012d
commit
57abb7ecc4
|
|
@ -1,11 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/// Hardware Abstraction Layer for the CPU's features and peripherals
|
|
||||||
|
|
||||||
namespace hal {
|
|
||||||
namespace pins {
|
|
||||||
|
|
||||||
/// pin definitions
|
|
||||||
|
|
||||||
} // namespace pins
|
|
||||||
} // namespace hal
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "logic/mm_control.h"
|
#include "logic/mm_control.h"
|
||||||
#include "hal/gpio.h"
|
#include "hal/gpio.h"
|
||||||
#include "hal/spi.h"
|
#include "hal/spi.h"
|
||||||
|
#include "pins.h"
|
||||||
|
|
||||||
/// One-time setup of HW and SW components
|
/// One-time setup of HW and SW components
|
||||||
/// Called before entering the loop() function
|
/// Called before entering the loop() function
|
||||||
|
|
@ -8,10 +9,10 @@ void setup() {
|
||||||
using namespace hal;
|
using namespace hal;
|
||||||
|
|
||||||
spi::SPI_InitTypeDef spi_conf = {
|
spi::SPI_InitTypeDef spi_conf = {
|
||||||
.miso_pin = gpio::GPIO_pin(GPIOB, 3),
|
.miso_pin = gpio::GPIO_pin(TMC2130_SPI_MISO_PIN),
|
||||||
.mosi_pin = gpio::GPIO_pin(GPIOB, 2),
|
.mosi_pin = gpio::GPIO_pin(TMC2130_SPI_MOSI_PIN),
|
||||||
.sck_pin = gpio::GPIO_pin(GPIOB, 1),
|
.sck_pin = gpio::GPIO_pin(TMC2130_SPI_SCK_PIN),
|
||||||
.ss_pin = gpio::GPIO_pin(GPIOB, 0),
|
.ss_pin = gpio::GPIO_pin(TMC2130_SPI_SS_PIN),
|
||||||
.prescaler = 2, //4mhz
|
.prescaler = 2, //4mhz
|
||||||
};
|
};
|
||||||
spi::Init(SPI0, &spi_conf);
|
spi::Init(SPI0, &spi_conf);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
#include "hal/gpio.h"
|
||||||
|
|
||||||
|
/// pin definitions
|
||||||
|
|
||||||
|
#define TMC2130_SPI_MISO_PIN GPIOB, 3
|
||||||
|
#define TMC2130_SPI_MOSI_PIN GPIOB, 2
|
||||||
|
#define TMC2130_SPI_SCK_PIN GPIOB, 1
|
||||||
|
#define TMC2130_SPI_SS_PIN GPIOB, 0
|
||||||
Loading…
Reference in New Issue