From 8b1137c6a0586ee1129d41203c6571435570c7a6 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 2 Feb 2012 11:23:40 -0600 Subject: [PATCH] Align the tx and rx SPI buffers from Overosync --- flight/Modules/OveroSync/overosync.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/flight/Modules/OveroSync/overosync.c b/flight/Modules/OveroSync/overosync.c index eba472ee9..131dec915 100644 --- a/flight/Modules/OveroSync/overosync.c +++ b/flight/Modules/OveroSync/overosync.c @@ -134,8 +134,8 @@ static void overoSyncTask(void *parameters) } } -uint8_t tx_buffer[OVEROSYNC_PACKET_SIZE]; -uint8_t rx_buffer[OVEROSYNC_PACKET_SIZE]; +uint8_t tx_buffer[OVEROSYNC_PACKET_SIZE] __attribute__ ((aligned(4))); +uint8_t rx_buffer[OVEROSYNC_PACKET_SIZE] __attribute__ ((aligned(4))); int32_t transactionsDone = 0; static void transmitDataDone(bool crc_ok, uint8_t crc_val) @@ -154,17 +154,16 @@ int32_t transactionsStarted = 0; */ static int32_t transmitData(uint8_t * data, int32_t length) { -// memcpy(tx_buffer,data,length); - memset(tx_buffer, 6, length); - memset(tx_buffer + length, 3, sizeof(tx_buffer) - length); - + memcpy(tx_buffer,data,length); + memset(tx_buffer + length, 0xfe, sizeof(tx_buffer) - length); +// memset(tx_buffer, 0x3d, sizeof(tx_buffer)); int32_t retval = 0; transactionsStarted++; - retval = PIOS_SPI_TransferBlock(pios_spi_overo_id, (uint8_t *) tx_buffer, (uint8_t *) rx_buffer, OVEROSYNC_PACKET_SIZE, &transmitDataDone); + retval = PIOS_SPI_TransferBlock(pios_spi_overo_id, (uint8_t *) tx_buffer, (uint8_t *) rx_buffer, sizeof(tx_buffer), &transmitDataDone); -// for (uint32_t i = 0; rx_buffer[0] != 0 && i < OVEROSYNC_PACKET_SIZE; i++) -// UAVTalkProcessInputStream(uavTalkCon, rx_buffer[i]); + for (uint32_t i = 0; rx_buffer[0] != 0 && i < sizeof(rx_buffer) ; i++) + UAVTalkProcessInputStream(uavTalkCon, rx_buffer[i]); return retval; }