From 7bd852c98c52c306e3628acedc33149ebee3cff6 Mon Sep 17 00:00:00 2001 From: guanjiao <sqrgj@163.com> Date: 星期六, 12 五月 2018 23:35:39 +0800 Subject: [PATCH] format all the code --- 源码/核心板/Src/platform/deca_spi.c | 64 ++++++++++++++++---------------- 1 files changed, 32 insertions(+), 32 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/platform/deca_spi.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/platform/deca_spi.c" index 0a165e8..d54ac60 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/platform/deca_spi.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/platform/deca_spi.c" @@ -19,15 +19,15 @@ int writetospi_serial( uint16_t headerLength, - const uint8_t *headerBuffer, - uint32_t bodylength, - const uint8_t *bodyBuffer - ); + const uint8_t *headerBuffer, + uint32_t bodylength, + const uint8_t *bodyBuffer + ); int readfromspi_serial( uint16_t headerLength, - const uint8_t *headerBuffer, - uint32_t readlength, - uint8_t *readBuffer ); + const uint8_t *headerBuffer, + uint32_t readlength, + uint8_t *readBuffer ); /*! ------------------------------------------------------------------------------------------------------------------ * Function: openspi() * @@ -36,9 +36,9 @@ */ int openspi(/*SPI_TypeDef* SPIx*/) { - // done by port.c, default SPI used is SPI1 + // done by port.c, default SPI used is SPI1 - return 0; + return 0; } // end openspi() @@ -50,11 +50,11 @@ */ int closespi(void) { - while (port_SPIx_busy_sending()); //wait for tx buffer to empty + while (port_SPIx_busy_sending()); //wait for tx buffer to empty - port_SPIx_disable(); + port_SPIx_disable(); - return 0; + return 0; } // end closespi() @@ -75,7 +75,7 @@ ) { - int i=0; + int i = 0; decaIrqStatus_t stat ; @@ -83,23 +83,23 @@ SPIx_CS_GPIO->BRR = SPIx_CS; - for(i=0; i<headerLength; i++) + for(i = 0; i < headerLength; i++) { - SPIx->DR = headerBuffer[i]; + SPIx->DR = headerBuffer[i]; - while ((SPIx->SR & SPI_I2S_FLAG_RXNE) == (uint16_t)RESET); + while ((SPIx->SR & SPI_I2S_FLAG_RXNE) == (uint16_t)RESET); - SPIx->DR ; + SPIx->DR ; } - for(i=0; i<bodylength; i++) + for(i = 0; i < bodylength; i++) { - SPIx->DR = bodyBuffer[i]; + SPIx->DR = bodyBuffer[i]; - while((SPIx->SR & SPI_I2S_FLAG_RXNE) == (uint16_t)RESET); + while((SPIx->SR & SPI_I2S_FLAG_RXNE) == (uint16_t)RESET); - SPIx->DR ; - } + SPIx->DR ; + } SPIx_CS_GPIO->BSRR = SPIx_CS; @@ -127,7 +127,7 @@ ) { - int i=0; + int i = 0; decaIrqStatus_t stat ; @@ -138,22 +138,22 @@ SPIx_CS_GPIO->BRR = SPIx_CS; - for(i=0; i<headerLength; i++) + for(i = 0; i < headerLength; i++) { - SPIx->DR = headerBuffer[i]; + SPIx->DR = headerBuffer[i]; - while((SPIx->SR & SPI_I2S_FLAG_RXNE) == (uint16_t)RESET); + while((SPIx->SR & SPI_I2S_FLAG_RXNE) == (uint16_t)RESET); - readBuffer[0] = SPIx->DR ; // Dummy read as we write the header + readBuffer[0] = SPIx->DR ; // Dummy read as we write the header } - for(i=0; i<readlength; i++) + for(i = 0; i < readlength; i++) { - SPIx->DR = 0; // Dummy write as we read the message body + SPIx->DR = 0; // Dummy write as we read the message body - while((SPIx->SR & SPI_I2S_FLAG_RXNE) == (uint16_t)RESET); - - readBuffer[i] = SPIx->DR ;//port_SPIx_receive_data(); //this clears RXNE bit + while((SPIx->SR & SPI_I2S_FLAG_RXNE) == (uint16_t)RESET); + + readBuffer[i] = SPIx->DR ;//port_SPIx_receive_data(); //this clears RXNE bit } SPIx_CS_GPIO->BSRR = SPIx_CS; -- Gitblit v1.9.3