🎨 Clean up LPC1768 SPI init
This commit is contained in:
parent
87344ae7f3
commit
fd3f7b3473
|
@ -66,11 +66,7 @@
|
||||||
|
|
||||||
#include <SoftwareSPI.h>
|
#include <SoftwareSPI.h>
|
||||||
|
|
||||||
#ifndef HAL_SPI_SPEED
|
static uint8_t SPI_speed = SPI_FULL_SPEED;
|
||||||
#define HAL_SPI_SPEED SPI_FULL_SPEED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static uint8_t SPI_speed = HAL_SPI_SPEED;
|
|
||||||
|
|
||||||
static uint8_t spiTransfer(uint8_t b) {
|
static uint8_t spiTransfer(uint8_t b) {
|
||||||
return swSpiTransfer(b, SPI_speed, SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN);
|
return swSpiTransfer(b, SPI_speed, SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN);
|
||||||
|
@ -106,15 +102,13 @@
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef HAL_SPI_SPEED
|
#ifdef SD_SPI_SPEED
|
||||||
#ifdef SD_SPI_SPEED
|
#define INIT_SPI_SPEED SD_SPI_SPEED
|
||||||
#define HAL_SPI_SPEED SD_SPI_SPEED
|
#else
|
||||||
#else
|
#define INIT_SPI_SPEED SPI_FULL_SPEED
|
||||||
#define HAL_SPI_SPEED SPI_FULL_SPEED
|
|
||||||
#endif
|
|
||||||
#endif
|
#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) {
|
void spiInit(uint8_t spiRate) {
|
||||||
#if SD_MISO_PIN == BOARD_SPI1_MISO_PIN
|
#if SD_MISO_PIN == BOARD_SPI1_MISO_PIN
|
||||||
|
|
Loading…
Reference in a new issue