From 246d94e2de20b12287f48f40b750697c33222c91 Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期二, 06 四月 2021 16:28:17 +0800 Subject: [PATCH] 1 --- 源码/核心板/Src/OnChipDevices/Spi.c | 26 ++++++++++---------------- 1 files changed, 10 insertions(+), 16 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/Spi.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/Spi.c" index b918be1..22dd470 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/Spi.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/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 ) { -- Gitblit v1.9.3