Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
src
hal
spi.h
Go to the documentation of this file.
1
#pragma once
3
#include <inttypes.h>
4
#include "
gpio.h
"
5
6
#ifdef __AVR__
7
#define SPI0 ((hal::spi::SPI_TypeDef *const) & SPCR)
8
#endif
9
10
namespace
hal {
11
13
namespace
spi {
14
15
struct
SPI_TypeDef
{
16
volatile
uint8_t SPCRx;
17
volatile
uint8_t SPSRx;
18
volatile
uint8_t SPDRx;
19
};
20
21
struct
SPI_InitTypeDef
{
22
hal::gpio::GPIO_pin
miso_pin;
23
hal::gpio::GPIO_pin
mosi_pin;
24
hal::gpio::GPIO_pin
sck_pin;
25
hal::gpio::GPIO_pin
ss_pin;
26
uint8_t prescaler;
27
uint8_t cpha;
28
uint8_t cpol;
29
};
30
31
void
Init(
SPI_TypeDef
*
const
hspi,
SPI_InitTypeDef
*
const
conf);
32
33
uint8_t TxRx(
SPI_TypeDef
*hspi, uint8_t val);
34
35
#ifdef __AVR__
36
static
SPI_TypeDef
*
const
TmcSpiBus = SPI0;
37
#else
38
static
SPI_TypeDef
*
const
TmcSpiBus =
nullptr
;
39
#endif
40
41
}
42
}
gpio.h
hal::gpio::GPIO_pin
Definition:
gpio.h:51
hal::spi::SPI_InitTypeDef
Definition:
spi.h:21
hal::spi::SPI_TypeDef
Definition:
spi.h:15
Generated by
1.9.1