diff --git a/usersrc/usermain.c b/usersrc/usermain.c index 7103418..2249b62 100644 --- a/usersrc/usermain.c +++ b/usersrc/usermain.c @@ -6,7 +6,7 @@ #include "usart.h" #include "spi.h" -#define READ_CMD 0xC0 +#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) @@ -14,11 +14,11 @@ bool BSP_Read(uint8_t *pData, uint8_t register_address, uint32_t Size) { uint8_t cmd; - cmd = 0XCA; - // if (register_address <= 0x3F) - // { - // cmd += register_address; - // } + cmd = READ_CMD; + if (register_address <= 0x3F) + { + cmd += register_address; + } SPI_CS_Enable(); HAL_SPI_Transmit(&hspi1, &cmd, 1, SPI_TIMEOUT_VALUE); @@ -36,8 +36,8 @@ void user_main() while (1) { - BSP_Read(&temp, 0X3F, 1); + BSP_Read(&temp, 0X06, 1); // HAL_UART_Transmit(&huart1, &temp, 1, 100); - // HAL_Delay(100); + HAL_Delay(100); } }