From 8fe83dd6102c40537aea40f9e104caa843c930cf Mon Sep 17 00:00:00 2001 From: tianjialong Date: Sun, 12 Mar 2023 10:20:32 +0800 Subject: [PATCH] update --- usersrc/usermain.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/usersrc/usermain.c b/usersrc/usermain.c index 2bc1ee4..ed12970 100644 --- a/usersrc/usermain.c +++ b/usersrc/usermain.c @@ -4,40 +4,18 @@ #include #include "main.h" #include "usart.h" -#include "spi.h" #define READ_CMD 0x80 #define SPI_TIMEOUT_VALUE 1000 #define SPI_CS_Enable() HAL_GPIO_WritePin(SPI_SEL_GPIO_Port, SPI_SEL_Pin, GPIO_PIN_RESET) #define SPI_CS_Disable() HAL_GPIO_WritePin(SPI_SEL_GPIO_Port, SPI_SEL_Pin, GPIO_PIN_SET) -bool BSP_Read(uint8_t *pData, uint8_t register_address, uint32_t Size) -{ - uint8_t cmd; - cmd = READ_CMD; - if (register_address <= 0x3F) - { - cmd += register_address; - } - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET); - SPI_CS_Enable(); - HAL_SPI_Transmit(&hspi1, &cmd, 1, SPI_TIMEOUT_VALUE); - // if (HAL_SPI_Receive(&hspi1, pData, Size, SPI_TIMEOUT_VALUE) != HAL_OK) - // { - // return false; - // } - SPI_CS_Disable(); - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET); - return true; -} - void user_main() { uint8_t temp; while (1) { - BSP_Read(&temp, 0X06, 1); // HAL_UART_Transmit(&huart1, &temp, 1, 100); HAL_Delay(100); }