Browse Source

SPI defines cleanup (#14506)

pull/1/head
Giuliano Zaro 5 years ago
committed by Scott Lahteine
parent
commit
66e16af29d
  1. 2
      Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp
  2. 8
      Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp
  3. 10
      Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp
  4. 10
      Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp
  5. 8
      Marlin/src/HAL/shared/HAL_SPI.h

2
Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp

@ -173,7 +173,7 @@ void spiBegin(void) {
// Invert the SPI2X bit
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);
SPSR = clockDiv | 0x01;
}

8
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp

@ -66,14 +66,6 @@
#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 spiInit(uint8_t spiRate);
void spiSend(uint8_t b);

10
Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp

@ -59,16 +59,8 @@
#if HAS_GRAPHICAL_LCD
//#include <inttypes.h>
#include <U8glib.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
#include "../../shared/HAL_SPI.h"
void spiBegin();
void spiInit(uint8_t spiRate);

10
Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp

@ -59,18 +59,10 @@
#if HAS_GRAPHICAL_LCD
//#include <inttypes.h>
#include <U8glib.h>
#include "../../shared/HAL_SPI.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 spiInit(uint8_t spiRate);
void spiSend(uint8_t b);

8
Marlin/src/HAL/shared/HAL_SPI.h

@ -53,14 +53,6 @@
#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_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
/** Initialize SPI bus */
void spiBegin(void);

Loading…
Cancel
Save