From cd77713255a19db6f5eb0f897a831bdcbacbff95 Mon Sep 17 00:00:00 2001 From: Ari Sundholm Date: Thu, 5 Nov 2020 18:39:22 +0200 Subject: [PATCH] ulibSD/spi_io.[ch]: Add function to write a single byte over SPI. Additionally, fix the misleading documentation for SPI_RW(). The new function, SPI_WW() follows the same naming logic, for better or worse. --- software/sys_controller/ulibSD/spi_io.c | 4 ++++ software/sys_controller/ulibSD/spi_io.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/software/sys_controller/ulibSD/spi_io.c b/software/sys_controller/ulibSD/spi_io.c index c6f1afd..2e3cd7b 100644 --- a/software/sys_controller/ulibSD/spi_io.c +++ b/software/sys_controller/ulibSD/spi_io.c @@ -23,6 +23,10 @@ void SPI_R(BYTE *rd, int len) { SPI_read(SD_SPI_BASE, rd, len); } +void SPI_WW(BYTE d) { + SPI_W(&d, 1); +} + BYTE SPI_RW (BYTE d) { BYTE w; SPI_R(&w, 1); diff --git a/software/sys_controller/ulibSD/spi_io.h b/software/sys_controller/ulibSD/spi_io.h index e2d0615..b490469 100644 --- a/software/sys_controller/ulibSD/spi_io.h +++ b/software/sys_controller/ulibSD/spi_io.h @@ -36,12 +36,18 @@ void SPI_R (BYTE *rd, int len); void SPI_W (BYTE *wd, int len); /** - \brief Read/Write a single byte. - \param d Byte to send. + \brief Read a single byte. + \param d Byte. Ignored. \return Byte that arrived. */ BYTE SPI_RW (BYTE d); +/** + \brief Write a single byte. + \param d Byte to write. + */ +void SPI_WW(BYTE d); + /** \brief Flush of SPI buffer. */