zhyinch
2020-06-28 0b743fcf84103459673ec08ed683a9c767f7b367
源码/核心板/Src/OnChipDevices/Spi.c
@@ -12,15 +12,10 @@
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
   
   /* SPI GPIO setup */
   // SPIx SCK and MOSI pin setup
    GPIO_InitStructure.GPIO_Pin = SPIx_SCK | SPIx_MOSI;
   // SPIx SCK, MISO and MOSI pin setup
    GPIO_InitStructure.GPIO_Pin = SPIx_SCK | SPIx_MOSI | SPIx_MISO;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(SPIx_GPIO, &GPIO_InitStructure);
    // SPIx MISO pin setup
    GPIO_InitStructure.GPIO_Pin = SPIx_MISO;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IPU;
    GPIO_Init(SPIx_GPIO, &GPIO_InitStructure);
    // SPIx CS pin setup
@@ -31,7 +26,6 @@
   
   // Set CS high
    GPIO_SetBits(SPIx_CS_GPIO, SPIx_CS);
    SPI_I2S_DeInit(SPIx);
@@ -82,10 +76,10 @@
 */
int writetospi
(
    uint16       headerLength,
    const uint8 *headerBuffer,
    uint32       bodylength,
    const uint8 *bodyBuffer
    uint16_t       headerLength,
    const uint8_t *headerBuffer,
    uint32_t       bodylength,
    const uint8_t *bodyBuffer
)
{
@@ -133,10 +127,10 @@
 */
int readfromspi
(
    uint16       headerLength,
    const uint8 *headerBuffer,
    uint32       readlength,
    uint8       *readBuffer
    uint16_t       headerLength,
    const uint8_t *headerBuffer,
    uint32_t       readlength,
    uint8_t       *readBuffer
)
{