Skip to content

Commit

Permalink
Merge pull request #499 from jp-bennett/patch-1
Browse files Browse the repository at this point in the history
Add functional SPI implementation for arduino_default
  • Loading branch information
lovyan03 authored Dec 30, 2023
2 parents 529594f + 28db217 commit a8895df
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lgfx/v1/platforms/arduino_default/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ namespace lgfx
/// unimplemented.
namespace spi
{
cpp::result<void, error_t> init(int spi_host, int spi_sclk, int spi_miso, int spi_mosi) { return cpp::fail(error_t::unknown_err); }
cpp::result<void, error_t> init(int spi_host, int spi_sclk, int spi_miso, int spi_mosi) { cpp::result<void, error_t> res = {}; return res; }
void release(int spi_host) {}
void beginTransaction(int spi_host, uint32_t freq, int spi_mode) {}
void endTransaction(int spi_host) {}
void beginTransaction(int spi_host, uint32_t freq, int spi_mode) {
SPISettings setting(freq, MSBFIRST, SPI_MODE0);
SPI.beginTransaction(setting);
}
void endTransaction(int spi_host) {SPI.endTransaction();}
void writeBytes(int spi_host, const uint8_t* data, size_t length) {}
void readBytes(int spi_host, uint8_t* data, size_t length) {}
}
void readBytes(int spi_host, uint8_t* data, size_t length) {SPI.transfer(data, length);} }

//----------------------------------------------------------------------------

Expand All @@ -87,6 +89,7 @@ namespace lgfx
cpp::result<void, error_t> endTransaction(int i2c_port) { return cpp::fail(error_t::unknown_err); }
cpp::result<void, error_t> writeBytes(int i2c_port, const uint8_t *data, size_t length) { return cpp::fail(error_t::unknown_err); }
cpp::result<void, error_t> readBytes(int i2c_port, uint8_t *data, size_t length) { return cpp::fail(error_t::unknown_err); }
cpp::result<void, error_t> readBytes(int i2c_port, uint8_t *data, size_t length, bool last_nack) { return cpp::fail(error_t::unknown_err); }

//--------

Expand Down

0 comments on commit a8895df

Please sign in to comment.