Skip to content

Commit

Permalink
馃帹 Clean up LPC1768 SPI init
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 12, 2021
1 parent 87344ae commit fd3f7b3
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions Marlin/src/HAL/LPC1768/HAL_SPI.cpp
Expand Up @@ -66,11 +66,7 @@

#include <SoftwareSPI.h>

#ifndef HAL_SPI_SPEED
#define HAL_SPI_SPEED SPI_FULL_SPEED
#endif

static uint8_t SPI_speed = HAL_SPI_SPEED;
static uint8_t SPI_speed = SPI_FULL_SPEED;

static uint8_t spiTransfer(uint8_t b) {
return swSpiTransfer(b, SPI_speed, SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN);
Expand Down Expand Up @@ -106,15 +102,13 @@

#else

#ifndef HAL_SPI_SPEED
#ifdef SD_SPI_SPEED
#define HAL_SPI_SPEED SD_SPI_SPEED
#else
#define HAL_SPI_SPEED SPI_FULL_SPEED
#endif
#ifdef SD_SPI_SPEED
#define INIT_SPI_SPEED SD_SPI_SPEED
#else
#define INIT_SPI_SPEED SPI_FULL_SPEED
#endif

void spiBegin() { spiInit(HAL_SPI_SPEED); } // Set up SCK, MOSI & MISO pins for SSP0
void spiBegin() { spiInit(INIT_SPI_SPEED); } // Set up SCK, MOSI & MISO pins for SSP0

void spiInit(uint8_t spiRate) {
#if SD_MISO_PIN == BOARD_SPI1_MISO_PIN
Expand Down

0 comments on commit fd3f7b3

Please sign in to comment.