SPI defines cleanup (#14506)

This commit is contained in:
Giuliano Zaro 2019-07-05 08:59:37 +02:00 committed by Scott Lahteine
parent eb6dec03bd
commit 66e16af29d
5 changed files with 3 additions and 35 deletions

View file

@ -173,7 +173,7 @@ void spiBegin(void) {
// Invert the SPI2X bit // Invert the SPI2X bit
clockDiv ^= 0x1; clockDiv ^= 0x1;
SPCR = _BV(SPE) | _BV(MSTR) | ((bitOrder == SPI_LSBFIRST) ? _BV(DORD) : 0) | SPCR = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |
(dataMode << CPHA) | ((clockDiv >> 1) << SPR0); (dataMode << CPHA) | ((clockDiv >> 1) << SPR0);
SPSR = clockDiv | 0x01; SPSR = clockDiv | 0x01;
} }

View file

@ -66,14 +66,6 @@
#include "../../Marlin.h" #include "../../Marlin.h"
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_SIXTEENTH_SPEED 4
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
void spiBegin(); void spiBegin();
void spiInit(uint8_t spiRate); void spiInit(uint8_t spiRate);
void spiSend(uint8_t b); void spiSend(uint8_t b);

View file

@ -59,16 +59,8 @@
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
//#include <inttypes.h>
#include <U8glib.h> #include <U8glib.h>
#include "../../shared/HAL_SPI.h"
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_SIXTEENTH_SPEED 4
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
void spiBegin(); void spiBegin();
void spiInit(uint8_t spiRate); void spiInit(uint8_t spiRate);

View file

@ -59,18 +59,10 @@
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
//#include <inttypes.h>
#include <U8glib.h> #include <U8glib.h>
#include "../../shared/HAL_SPI.h"
#include "../../shared/Delay.h" #include "../../shared/Delay.h"
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_SIXTEENTH_SPEED 4
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
void spiBegin(); void spiBegin();
void spiInit(uint8_t spiRate); void spiInit(uint8_t spiRate);
void spiSend(uint8_t b); void spiSend(uint8_t b);

View file

@ -53,14 +53,6 @@
#define SPI_SPEED_5 5 // Set SCK rate to 1/32 of max rate #define SPI_SPEED_5 5 // Set SCK rate to 1/32 of max rate
#define SPI_SPEED_6 6 // Set SCK rate to 1/64 of max rate #define SPI_SPEED_6 6 // Set SCK rate to 1/64 of max rate
#define SPI_LSBFIRST 0
#define SPI_MSBFIRST 1
#define SPI_DATAMODE_0 0x00
#define SPI_DATAMODE_1 0x04
#define SPI_DATAMODE_2 0x08
#define SPI_DATAMODE_3 0x0C
// Standard SPI functions // Standard SPI functions
/** Initialize SPI bus */ /** Initialize SPI bus */
void spiBegin(void); void spiBegin(void);