四 主机代码: /* USER CODE BEGIN 3 */
HAL_GPIO_WritePin(SPI1_NSS_GPIO_Port, SPI1_NSS_Pin, GPIO_PIN_RESET);
HAL_SPI_TransmitReceive(&hspi1, txbuf, rxbuf, 1, 0xFF);
HAL_GPIO_WritePin(SPI1_NSS_GPIO_Port, SPI1_NSS_Pin, GPIO_PIN_SET);
HAL_Delay(500);
}
/* USER CODE END 3 */
|