Dump byteIn after xfer->event via SPI. Make the firmware build without using the DEBUG_OVER_SPI macro.

This commit is contained in:
László Monda
2017-10-08 23:12:40 +02:00
parent 6b0ebb1385
commit 859a770ca3
2 changed files with 6 additions and 3 deletions

View File

@@ -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
}

View File

@@ -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();