From 32e759c92832b35bbc3e8bb477618e36da1b4634 Mon Sep 17 00:00:00 2001 From: Christopher Pepper Date: Tue, 1 Aug 2017 03:44:26 +0100 Subject: [PATCH] SPI API platform implementation stubs --- ...nt_store.cpp => persistent_store_impl.cpp} | 3 +- Marlin/src/HAL/HAL_AVR/spi_impl.cpp | 51 +++++++++++++++++++ Marlin/src/HAL/HAL_AVR/spi_pins.h | 4 ++ ...nt_store.cpp => persistent_store_impl.cpp} | 3 +- Marlin/src/HAL/HAL_DUE/spi_impl.cpp | 51 +++++++++++++++++++ Marlin/src/HAL/HAL_DUE/spi_pins.h | 5 ++ ...nt_store.cpp => persistent_store_impl.cpp} | 0 ...nt_store.cpp => persistent_store_impl.cpp} | 3 +- Marlin/src/HAL/HAL_TEENSY35_36/spi_impl.cpp | 51 +++++++++++++++++++ Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h | 5 ++ 10 files changed, 173 insertions(+), 3 deletions(-) rename Marlin/src/HAL/HAL_AVR/{persistent_store.cpp => persistent_store_impl.cpp} (99%) create mode 100644 Marlin/src/HAL/HAL_AVR/spi_impl.cpp rename Marlin/src/HAL/HAL_DUE/{persistent_store.cpp => persistent_store_impl.cpp} (99%) create mode 100644 Marlin/src/HAL/HAL_DUE/spi_impl.cpp rename Marlin/src/HAL/HAL_LPC1768/{persistent_store.cpp => persistent_store_impl.cpp} (100%) rename Marlin/src/HAL/HAL_TEENSY35_36/{persistent_store.cpp => persistent_store_impl.cpp} (99%) create mode 100644 Marlin/src/HAL/HAL_TEENSY35_36/spi_impl.cpp diff --git a/Marlin/src/HAL/HAL_AVR/persistent_store.cpp b/Marlin/src/HAL/HAL_AVR/persistent_store_impl.cpp similarity index 99% rename from Marlin/src/HAL/HAL_AVR/persistent_store.cpp rename to Marlin/src/HAL/HAL_AVR/persistent_store_impl.cpp index 84d0b947f..a4017a144 100644 --- a/Marlin/src/HAL/HAL_AVR/persistent_store.cpp +++ b/Marlin/src/HAL/HAL_AVR/persistent_store_impl.cpp @@ -1,3 +1,5 @@ +#ifdef ARDUINO_ARCH_AVR + #include "../persistent_store_api.h" #include "../../../types.h" @@ -5,7 +7,6 @@ #include "../../../serial.h" #include "../../../utility.h" -#ifdef ARDUINO_ARCH_AVR #if ENABLED(EEPROM_SETTINGS) namespace HAL { diff --git a/Marlin/src/HAL/HAL_AVR/spi_impl.cpp b/Marlin/src/HAL/HAL_AVR/spi_impl.cpp new file mode 100644 index 000000000..647968479 --- /dev/null +++ b/Marlin/src/HAL/HAL_AVR/spi_impl.cpp @@ -0,0 +1,51 @@ +#ifdef ARDUINO_ARCH_AVR + +#include + +namespace HAL { +namespace SPI { + +bool initialise(uint8_t channel) { + return false; +} + +bool enable_cs(uint8_t channel) { + return false; +} + +void disable_cs(uint8_t channel) { + +} + +void set_frequency(uint8_t channel, uint32_t frequency) { + +} + +void read(uint8_t channel, uint8_t *buffer, uint32_t length) { + +} + +uint8_t read(uint8_t channel) { + return '\0'; +} + +void write(uint8_t channel, const uint8_t *buffer, uint32_t length) { + +} + +void write(uint8_t channel, uint8_t value) { + +} + +void transfer(uint8_t channel, const uint8_t *buffer_write, uint8_t *buffer_read, uint32_t length) { + +} + +uint8_t transfer(uint8_t channel, uint8_t value) { + return '\0'; +} + +} // namespace SPI +} // namespace HAL + +#endif //#ifdef ARDUINO_ARCH_AVR diff --git a/Marlin/src/HAL/HAL_AVR/spi_pins.h b/Marlin/src/HAL/HAL_AVR/spi_pins.h index 444534880..128a39c5b 100644 --- a/Marlin/src/HAL/HAL_AVR/spi_pins.h +++ b/Marlin/src/HAL/HAL_AVR/spi_pins.h @@ -20,6 +20,10 @@ #ifndef SPI_PINS_H_ #define SPI_PINS_H_ +#define SD_SPI_CHANNEL (HAL::SPI::CHANNEL_0) +#define LCD_SPI_FREQUENCY 4000000 +#define LCD_SPI_CHANNEL (HAL::SPI::CHANNEL_1) + /** * Define SPI Pins: SCK, MISO, MOSI, SS */ diff --git a/Marlin/src/HAL/HAL_DUE/persistent_store.cpp b/Marlin/src/HAL/HAL_DUE/persistent_store_impl.cpp similarity index 99% rename from Marlin/src/HAL/HAL_DUE/persistent_store.cpp rename to Marlin/src/HAL/HAL_DUE/persistent_store_impl.cpp index ce9336d5c..3ada74020 100644 --- a/Marlin/src/HAL/HAL_DUE/persistent_store.cpp +++ b/Marlin/src/HAL/HAL_DUE/persistent_store_impl.cpp @@ -1,3 +1,5 @@ +#ifdef ARDUINO_ARCH_SAM + #include "../persistent_store_api.h" #include "../../../types.h" @@ -5,7 +7,6 @@ #include "../../../serial.h" #include "../../../utility.h" -#ifdef ARDUINO_ARCH_SAM #if ENABLED(EEPROM_SETTINGS) namespace HAL { diff --git a/Marlin/src/HAL/HAL_DUE/spi_impl.cpp b/Marlin/src/HAL/HAL_DUE/spi_impl.cpp new file mode 100644 index 000000000..f9f50b45a --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/spi_impl.cpp @@ -0,0 +1,51 @@ +#ifdef ARDUINO_ARCH_SAM + +#include + +namespace HAL { +namespace SPI { + +bool initialise(uint8_t channel) { + return false; +} + +bool enable_cs(uint8_t channel) { + return false; +} + +void disable_cs(uint8_t channel) { + +} + +void set_frequency(uint8_t channel, uint32_t frequency) { + +} + +void read(uint8_t channel, uint8_t *buffer, uint32_t length) { + +} + +uint8_t read(uint8_t channel) { + return '\0'; +} + +void write(uint8_t channel, const uint8_t *buffer, uint32_t length) { + +} + +void write(uint8_t channel, uint8_t value) { + +} + +void transfer(uint8_t channel, const uint8_t *buffer_write, uint8_t *buffer_read, uint32_t length) { + +} + +uint8_t transfer(uint8_t channel, uint8_t value) { + return '\0'; +} + +} // namespace SPI +} // namespace HAL + +#endif //#ifdef ARDUINO_ARCH_AVR diff --git a/Marlin/src/HAL/HAL_DUE/spi_pins.h b/Marlin/src/HAL/HAL_DUE/spi_pins.h index 67414710b..d65f53812 100644 --- a/Marlin/src/HAL/HAL_DUE/spi_pins.h +++ b/Marlin/src/HAL/HAL_DUE/spi_pins.h @@ -21,6 +21,11 @@ #ifndef SPI_PINS_H_ #define SPI_PINS_H_ +//new config options +#define SD_SPI_CHANNEL (HAL::SPI::CHANNEL_0) +#define LCD_SPI_FREQUENCY 4000000 +#define LCD_SPI_CHANNEL (HAL::SPI::CHANNEL_1) + /** * Define SPI Pins: SCK, MISO, MOSI, SS * diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store.cpp b/Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp similarity index 100% rename from Marlin/src/HAL/HAL_LPC1768/persistent_store.cpp rename to Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp similarity index 99% rename from Marlin/src/HAL/HAL_TEENSY35_36/persistent_store.cpp rename to Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp index 1cab8473d..95a97a921 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp @@ -1,3 +1,5 @@ +#if defined(__MK64FX512__) || defined(__MK66FX1M0__) + #include "../persistent_store_api.h" #include "../../../types.h" @@ -5,7 +7,6 @@ #include "../../../serial.h" #include "../../../utility.h" -#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #if ENABLED(EEPROM_SETTINGS) namespace HAL { diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/spi_impl.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/spi_impl.cpp new file mode 100644 index 000000000..b068e5564 --- /dev/null +++ b/Marlin/src/HAL/HAL_TEENSY35_36/spi_impl.cpp @@ -0,0 +1,51 @@ +#if defined(__MK64FX512__) || defined(__MK66FX1M0__) + +#include + +namespace HAL { +namespace SPI { + +bool initialise(uint8_t channel) { + return false; +} + +bool enable_cs(uint8_t channel) { + return false; +} + +void disable_cs(uint8_t channel) { + +} + +void set_frequency(uint8_t channel, uint32_t frequency) { + +} + +void read(uint8_t channel, uint8_t *buffer, uint32_t length) { + +} + +uint8_t read(uint8_t channel) { + return '\0'; +} + +void write(uint8_t channel, const uint8_t *buffer, uint32_t length) { + +} + +void write(uint8_t channel, uint8_t value) { + +} + +void transfer(uint8_t channel, const uint8_t *buffer_write, uint8_t *buffer_read, uint32_t length) { + +} + +uint8_t transfer(uint8_t channel, uint8_t value) { + return '\0'; +} + +} // namespace SPI +} // namespace HAL + +#endif //#ifdef ARDUINO_ARCH_AVR diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h b/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h index 416fbf52f..7c62b1d9b 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h @@ -20,6 +20,11 @@ #ifndef SPI_PINS_H_ #define SPI_PINS_H_ +//new config options +#define SD_SPI_CHANNEL (HAL::SPI::CHANNEL_0) +#define LCD_SPI_FREQUENCY 4000000 +#define LCD_SPI_CHANNEL (HAL::SPI::CHANNEL_1) + #define SCK_PIN 13 #define MISO_PIN 12 #define MOSI_PIN 11