1 /* 2 * Copyright (c) 2022 Talkweb Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #if defined(USE_FULL_LL_DRIVER) 17 18 #include "hal_spi.h" 19 #include "stm32f4xx_ll_bus.h" 20 #include "stm32f4xx_ll_rcc.h" 21 22 #if defined (SPI1) || defined (SPI2) || defined (SPI3) || defined (SPI4) || defined (SPI5) || defined(SPI6) 23 LL_SPI_Transmit(SPI_TypeDef * SPIx,uint8_t byte)24uint8_t LL_SPI_Transmit(SPI_TypeDef* SPIx, uint8_t byte) 25 { 26 uint8_t read, send = byte; 27 while (LL_SPI_IsActiveFlag_TXE(SPIx) == 0); 28 LL_SPI_TransmitData8(SPIx, send); 29 while (LL_SPI_IsActiveFlag_RXNE(SPIx) == 0); 30 read = LL_SPI_ReceiveData8(SPIx); 31 return read; 32 } 33 34 #endif /* defined (SPI1) || defined (SPI2) || defined (SPI3) || defined (SPI4) || defined (SPI5) || defined(SPI6) */ 35 36 #endif /* USE_FULL_LL_DRIVER */ 37