From 859a770ca32fe1a9844fa41d1729a6ead113c39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 8 Oct 2017 23:12:40 +0200 Subject: [PATCH] Dump byteIn after xfer->event via SPI. Make the firmware build without using the DEBUG_OVER_SPI macro. --- left/src/debug_over_spi.c | 3 ++- left/src/init_peripherals.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/left/src/debug_over_spi.c b/left/src/debug_over_spi.c index b009a22..b161f6a 100644 --- a/left/src/debug_over_spi.c +++ b/left/src/debug_over_spi.c @@ -20,7 +20,9 @@ static volatile bool masterFinished = false; static void masterCallback(SPI_Type *base, spi_master_handle_t *masterHandle, status_t status, void *userData) { +#ifdef DEBUG_OVER_SPI masterFinished = true; +#endif } void DebugOverSpi_Init(void) @@ -42,7 +44,6 @@ void DebugOverSpi_Init(void) SPI_MasterGetDefaultConfig(&userConfig); uint32_t srcFreq = CLOCK_GetFreq(EXAMPLE_SPI_MASTER_SOURCE_CLOCK); SPI_MasterInit(EXAMPLE_SPI_MASTER, &userConfig, srcFreq); - SPI_MasterTransferCreateHandle(EXAMPLE_SPI_MASTER, &handle, masterCallback, NULL); #endif } diff --git a/left/src/init_peripherals.c b/left/src/init_peripherals.c index 302bb55..f03562f 100644 --- a/left/src/init_peripherals.c +++ b/left/src/init_peripherals.c @@ -18,12 +18,14 @@ uint8_t byteIn; uint8_t rxMessagePos; i2c_slave_transfer_event_t prevEvent; -uint8_t dosBuffer[60]; +uint8_t dosBuffer[2]; static void i2cSlaveCallback(I2C_Type *base, i2c_slave_transfer_t *xfer, void *userData) { dosBuffer[0] = xfer->event; - DebugOverSpi_Send(dosBuffer, 1); + dosBuffer[1] = byteIn; + DebugOverSpi_Send(dosBuffer, 2); + switch (xfer->event) { case kI2C_SlaveTransmitEvent: SlaveTxHandler();