forked from NojbyMichal/TRAMS-Firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTMC_SPI.h
48 lines (36 loc) · 1.14 KB
/
TMC_SPI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef TMC_SPI_H
#define TMC_SPI_H
//#include "Marlin.h"
#include <stdio.h>
#define nop() asm volatile("nop")
/**
* @brief Initialize the SPI
* SPI Master
* 4Mhz(CPU_CLOCK / 4)
* CPOL = 0
* CPHA = 0
* no interrupt
*****************************************************************************/
void spi_init(void);
/**
* @brief Reads four byte via SPI
* @param address register address
* @param csPin chip select
* @return status
*****************************************************************************/
uint32_t spi_readRegister(uint8_t address, uint8_t slave);
/**
* @brief Send five byte via SPI and received the status
* @param address register address
* @param data to transmitted data
* @param csPin chip select
* @return status
*****************************************************************************/
uint8_t spi_writeRegister(uint8_t address, uint32_t data, uint8_t slave);
/**
* @brief Reads the status from the MAMC
* @param csPin chip select
* @return status
*****************************************************************************/
uint8_t spi_readStatus(uint8_t slave);
#endif //TMC_SPI_H