mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
186:707f6e361f3e
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 158:b23ee177fd68 1 /**
Kojto 158:b23ee177fd68 2 ******************************************************************************
Kojto 158:b23ee177fd68 3 * @file stm32l0xx_ll_spi.h
Kojto 158:b23ee177fd68 4 * @author MCD Application Team
Kojto 158:b23ee177fd68 5 * @brief Header file of SPI LL module.
Kojto 158:b23ee177fd68 6 ******************************************************************************
Kojto 158:b23ee177fd68 7 * @attention
Kojto 158:b23ee177fd68 8 *
Kojto 158:b23ee177fd68 9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Kojto 158:b23ee177fd68 10 *
Kojto 158:b23ee177fd68 11 * Redistribution and use in source and binary forms, with or without modification,
Kojto 158:b23ee177fd68 12 * are permitted provided that the following conditions are met:
Kojto 158:b23ee177fd68 13 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 158:b23ee177fd68 14 * this list of conditions and the following disclaimer.
Kojto 158:b23ee177fd68 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 158:b23ee177fd68 16 * this list of conditions and the following disclaimer in the documentation
Kojto 158:b23ee177fd68 17 * and/or other materials provided with the distribution.
Kojto 158:b23ee177fd68 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 158:b23ee177fd68 19 * may be used to endorse or promote products derived from this software
Kojto 158:b23ee177fd68 20 * without specific prior written permission.
Kojto 158:b23ee177fd68 21 *
Kojto 158:b23ee177fd68 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 158:b23ee177fd68 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 158:b23ee177fd68 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 158:b23ee177fd68 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 158:b23ee177fd68 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 158:b23ee177fd68 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 158:b23ee177fd68 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 158:b23ee177fd68 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 158:b23ee177fd68 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 158:b23ee177fd68 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 158:b23ee177fd68 32 *
Kojto 158:b23ee177fd68 33 ******************************************************************************
Kojto 158:b23ee177fd68 34 */
Kojto 158:b23ee177fd68 35
Kojto 158:b23ee177fd68 36 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 158:b23ee177fd68 37 #ifndef __STM32L0xx_LL_SPI_H
Kojto 158:b23ee177fd68 38 #define __STM32L0xx_LL_SPI_H
Kojto 158:b23ee177fd68 39
Kojto 158:b23ee177fd68 40 #ifdef __cplusplus
Kojto 158:b23ee177fd68 41 extern "C" {
Kojto 158:b23ee177fd68 42 #endif
Kojto 158:b23ee177fd68 43
Kojto 158:b23ee177fd68 44 /* Includes ------------------------------------------------------------------*/
Kojto 158:b23ee177fd68 45 #include "stm32l0xx.h"
Kojto 158:b23ee177fd68 46
Kojto 158:b23ee177fd68 47 /** @addtogroup STM32L0xx_LL_Driver
Kojto 158:b23ee177fd68 48 * @{
Kojto 158:b23ee177fd68 49 */
Kojto 158:b23ee177fd68 50
Kojto 158:b23ee177fd68 51 #if defined (SPI1) || defined (SPI2)
Kojto 158:b23ee177fd68 52
Kojto 158:b23ee177fd68 53 /** @defgroup SPI_LL SPI
Kojto 158:b23ee177fd68 54 * @{
Kojto 158:b23ee177fd68 55 */
Kojto 158:b23ee177fd68 56
Kojto 158:b23ee177fd68 57 /* Private types -------------------------------------------------------------*/
Kojto 158:b23ee177fd68 58 /* Private variables ---------------------------------------------------------*/
Kojto 158:b23ee177fd68 59 /* Private macros ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 60
Kojto 158:b23ee177fd68 61 /* Exported types ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 62 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 63 /** @defgroup SPI_LL_ES_INIT SPI Exported Init structure
Kojto 158:b23ee177fd68 64 * @{
Kojto 158:b23ee177fd68 65 */
Kojto 158:b23ee177fd68 66
Kojto 158:b23ee177fd68 67 /**
Kojto 158:b23ee177fd68 68 * @brief SPI Init structures definition
Kojto 158:b23ee177fd68 69 */
Kojto 158:b23ee177fd68 70 typedef struct
Kojto 158:b23ee177fd68 71 {
Kojto 158:b23ee177fd68 72 uint32_t TransferDirection; /*!< Specifies the SPI unidirectional or bidirectional data mode.
Kojto 158:b23ee177fd68 73 This parameter can be a value of @ref SPI_LL_EC_TRANSFER_MODE.
Kojto 158:b23ee177fd68 74
Kojto 158:b23ee177fd68 75 This feature can be modified afterwards using unitary function @ref LL_SPI_SetTransferDirection().*/
Kojto 158:b23ee177fd68 76
Kojto 158:b23ee177fd68 77 uint32_t Mode; /*!< Specifies the SPI mode (Master/Slave).
Kojto 158:b23ee177fd68 78 This parameter can be a value of @ref SPI_LL_EC_MODE.
Kojto 158:b23ee177fd68 79
Kojto 158:b23ee177fd68 80 This feature can be modified afterwards using unitary function @ref LL_SPI_SetMode().*/
Kojto 158:b23ee177fd68 81
Kojto 158:b23ee177fd68 82 uint32_t DataWidth; /*!< Specifies the SPI data width.
Kojto 158:b23ee177fd68 83 This parameter can be a value of @ref SPI_LL_EC_DATAWIDTH.
Kojto 158:b23ee177fd68 84
Kojto 158:b23ee177fd68 85 This feature can be modified afterwards using unitary function @ref LL_SPI_SetDataWidth().*/
Kojto 158:b23ee177fd68 86
Kojto 158:b23ee177fd68 87 uint32_t ClockPolarity; /*!< Specifies the serial clock steady state.
Kojto 158:b23ee177fd68 88 This parameter can be a value of @ref SPI_LL_EC_POLARITY.
Kojto 158:b23ee177fd68 89
Kojto 158:b23ee177fd68 90 This feature can be modified afterwards using unitary function @ref LL_SPI_SetClockPolarity().*/
Kojto 158:b23ee177fd68 91
Kojto 158:b23ee177fd68 92 uint32_t ClockPhase; /*!< Specifies the clock active edge for the bit capture.
Kojto 158:b23ee177fd68 93 This parameter can be a value of @ref SPI_LL_EC_PHASE.
Kojto 158:b23ee177fd68 94
Kojto 158:b23ee177fd68 95 This feature can be modified afterwards using unitary function @ref LL_SPI_SetClockPhase().*/
Kojto 158:b23ee177fd68 96
Kojto 158:b23ee177fd68 97 uint32_t NSS; /*!< Specifies whether the NSS signal is managed by hardware (NSS pin) or by software using the SSI bit.
Kojto 158:b23ee177fd68 98 This parameter can be a value of @ref SPI_LL_EC_NSS_MODE.
Kojto 158:b23ee177fd68 99
Kojto 158:b23ee177fd68 100 This feature can be modified afterwards using unitary function @ref LL_SPI_SetNSSMode().*/
Kojto 158:b23ee177fd68 101
Kojto 158:b23ee177fd68 102 uint32_t BaudRate; /*!< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock.
Kojto 158:b23ee177fd68 103 This parameter can be a value of @ref SPI_LL_EC_BAUDRATEPRESCALER.
Kojto 158:b23ee177fd68 104 @note The communication clock is derived from the master clock. The slave clock does not need to be set.
Kojto 158:b23ee177fd68 105
Kojto 158:b23ee177fd68 106 This feature can be modified afterwards using unitary function @ref LL_SPI_SetBaudRatePrescaler().*/
Kojto 158:b23ee177fd68 107
Kojto 158:b23ee177fd68 108 uint32_t BitOrder; /*!< Specifies whether data transfers start from MSB or LSB bit.
Kojto 158:b23ee177fd68 109 This parameter can be a value of @ref SPI_LL_EC_BIT_ORDER.
Kojto 158:b23ee177fd68 110
Kojto 158:b23ee177fd68 111 This feature can be modified afterwards using unitary function @ref LL_SPI_SetTransferBitOrder().*/
Kojto 158:b23ee177fd68 112
Kojto 158:b23ee177fd68 113 uint32_t CRCCalculation; /*!< Specifies if the CRC calculation is enabled or not.
Kojto 158:b23ee177fd68 114 This parameter can be a value of @ref SPI_LL_EC_CRC_CALCULATION.
Kojto 158:b23ee177fd68 115
Kojto 158:b23ee177fd68 116 This feature can be modified afterwards using unitary functions @ref LL_SPI_EnableCRC() and @ref LL_SPI_DisableCRC().*/
Kojto 158:b23ee177fd68 117
Kojto 158:b23ee177fd68 118 uint32_t CRCPoly; /*!< Specifies the polynomial used for the CRC calculation.
Kojto 158:b23ee177fd68 119 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF.
Kojto 158:b23ee177fd68 120
Kojto 158:b23ee177fd68 121 This feature can be modified afterwards using unitary function @ref LL_SPI_SetCRCPolynomial().*/
Kojto 158:b23ee177fd68 122
Kojto 158:b23ee177fd68 123 } LL_SPI_InitTypeDef;
Kojto 158:b23ee177fd68 124
Kojto 158:b23ee177fd68 125 /**
Kojto 158:b23ee177fd68 126 * @}
Kojto 158:b23ee177fd68 127 */
Kojto 158:b23ee177fd68 128 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 129
Kojto 158:b23ee177fd68 130 /* Exported constants --------------------------------------------------------*/
Kojto 158:b23ee177fd68 131 /** @defgroup SPI_LL_Exported_Constants SPI Exported Constants
Kojto 158:b23ee177fd68 132 * @{
Kojto 158:b23ee177fd68 133 */
Kojto 158:b23ee177fd68 134
Kojto 158:b23ee177fd68 135 /** @defgroup SPI_LL_EC_GET_FLAG Get Flags Defines
Kojto 158:b23ee177fd68 136 * @brief Flags defines which can be used with LL_SPI_ReadReg function
Kojto 158:b23ee177fd68 137 * @{
Kojto 158:b23ee177fd68 138 */
Kojto 158:b23ee177fd68 139 #define LL_SPI_SR_RXNE SPI_SR_RXNE /*!< Rx buffer not empty flag */
Kojto 158:b23ee177fd68 140 #define LL_SPI_SR_TXE SPI_SR_TXE /*!< Tx buffer empty flag */
Kojto 158:b23ee177fd68 141 #define LL_SPI_SR_BSY SPI_SR_BSY /*!< Busy flag */
Kojto 158:b23ee177fd68 142 #define LL_SPI_SR_UDR SPI_SR_UDR /*!< Underrun flag */
Kojto 158:b23ee177fd68 143 #define LL_SPI_SR_CRCERR SPI_SR_CRCERR /*!< CRC error flag */
Kojto 158:b23ee177fd68 144 #define LL_SPI_SR_MODF SPI_SR_MODF /*!< Mode fault flag */
Kojto 158:b23ee177fd68 145 #define LL_SPI_SR_OVR SPI_SR_OVR /*!< Overrun flag */
Kojto 158:b23ee177fd68 146 #define LL_SPI_SR_FRE SPI_SR_FRE /*!< TI mode frame format error flag */
Kojto 158:b23ee177fd68 147 /**
Kojto 158:b23ee177fd68 148 * @}
Kojto 158:b23ee177fd68 149 */
Kojto 158:b23ee177fd68 150
Kojto 158:b23ee177fd68 151 /** @defgroup SPI_LL_EC_IT IT Defines
Kojto 158:b23ee177fd68 152 * @brief IT defines which can be used with LL_SPI_ReadReg and LL_SPI_WriteReg functions
Kojto 158:b23ee177fd68 153 * @{
Kojto 158:b23ee177fd68 154 */
Kojto 158:b23ee177fd68 155 #define LL_SPI_CR2_RXNEIE SPI_CR2_RXNEIE /*!< Rx buffer not empty interrupt enable */
Kojto 158:b23ee177fd68 156 #define LL_SPI_CR2_TXEIE SPI_CR2_TXEIE /*!< Tx buffer empty interrupt enable */
Kojto 158:b23ee177fd68 157 #define LL_SPI_CR2_ERRIE SPI_CR2_ERRIE /*!< Error interrupt enable */
Kojto 158:b23ee177fd68 158 /**
Kojto 158:b23ee177fd68 159 * @}
Kojto 158:b23ee177fd68 160 */
Kojto 158:b23ee177fd68 161
Kojto 158:b23ee177fd68 162 /** @defgroup SPI_LL_EC_MODE Operation Mode
Kojto 158:b23ee177fd68 163 * @{
Kojto 158:b23ee177fd68 164 */
Kojto 158:b23ee177fd68 165 #define LL_SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI) /*!< Master configuration */
Kojto 158:b23ee177fd68 166 #define LL_SPI_MODE_SLAVE ((uint32_t)0x00000000U) /*!< Slave configuration */
Kojto 158:b23ee177fd68 167 /**
Kojto 158:b23ee177fd68 168 * @}
Kojto 158:b23ee177fd68 169 */
Kojto 158:b23ee177fd68 170
Kojto 158:b23ee177fd68 171 /** @defgroup SPI_LL_EC_PROTOCOL Serial Protocol
Kojto 158:b23ee177fd68 172 * @{
Kojto 158:b23ee177fd68 173 */
Kojto 158:b23ee177fd68 174 #define LL_SPI_PROTOCOL_MOTOROLA ((uint32_t)0x00000000U) /*!< Motorola mode. Used as default value */
Kojto 158:b23ee177fd68 175 #define LL_SPI_PROTOCOL_TI (SPI_CR2_FRF) /*!< TI mode */
Kojto 158:b23ee177fd68 176 /**
Kojto 158:b23ee177fd68 177 * @}
Kojto 158:b23ee177fd68 178 */
Kojto 158:b23ee177fd68 179
Kojto 158:b23ee177fd68 180 /** @defgroup SPI_LL_EC_PHASE Clock Phase
Kojto 158:b23ee177fd68 181 * @{
Kojto 158:b23ee177fd68 182 */
Kojto 158:b23ee177fd68 183 #define LL_SPI_PHASE_1EDGE ((uint32_t)0x00000000U) /*!< First clock transition is the first data capture edge */
Kojto 158:b23ee177fd68 184 #define LL_SPI_PHASE_2EDGE (SPI_CR1_CPHA) /*!< Second clock transition is the first data capture edge */
Kojto 158:b23ee177fd68 185 /**
Kojto 158:b23ee177fd68 186 * @}
Kojto 158:b23ee177fd68 187 */
Kojto 158:b23ee177fd68 188
Kojto 158:b23ee177fd68 189 /** @defgroup SPI_LL_EC_POLARITY Clock Polarity
Kojto 158:b23ee177fd68 190 * @{
Kojto 158:b23ee177fd68 191 */
Kojto 158:b23ee177fd68 192 #define LL_SPI_POLARITY_LOW ((uint32_t)0x00000000U) /*!< Clock to 0 when idle */
Kojto 158:b23ee177fd68 193 #define LL_SPI_POLARITY_HIGH (SPI_CR1_CPOL) /*!< Clock to 1 when idle */
Kojto 158:b23ee177fd68 194 /**
Kojto 158:b23ee177fd68 195 * @}
Kojto 158:b23ee177fd68 196 */
Kojto 158:b23ee177fd68 197
Kojto 158:b23ee177fd68 198 /** @defgroup SPI_LL_EC_BAUDRATEPRESCALER Baud Rate Prescaler
Kojto 158:b23ee177fd68 199 * @{
Kojto 158:b23ee177fd68 200 */
Kojto 158:b23ee177fd68 201 #define LL_SPI_BAUDRATEPRESCALER_DIV2 ((uint32_t)0x00000000U) /*!< BaudRate control equal to fPCLK/2 */
Kojto 158:b23ee177fd68 202 #define LL_SPI_BAUDRATEPRESCALER_DIV4 (SPI_CR1_BR_0) /*!< BaudRate control equal to fPCLK/4 */
Kojto 158:b23ee177fd68 203 #define LL_SPI_BAUDRATEPRESCALER_DIV8 (SPI_CR1_BR_1) /*!< BaudRate control equal to fPCLK/8 */
Kojto 158:b23ee177fd68 204 #define LL_SPI_BAUDRATEPRESCALER_DIV16 (SPI_CR1_BR_1 | SPI_CR1_BR_0) /*!< BaudRate control equal to fPCLK/16 */
Kojto 158:b23ee177fd68 205 #define LL_SPI_BAUDRATEPRESCALER_DIV32 (SPI_CR1_BR_2) /*!< BaudRate control equal to fPCLK/32 */
Kojto 158:b23ee177fd68 206 #define LL_SPI_BAUDRATEPRESCALER_DIV64 (SPI_CR1_BR_2 | SPI_CR1_BR_0) /*!< BaudRate control equal to fPCLK/64 */
Kojto 158:b23ee177fd68 207 #define LL_SPI_BAUDRATEPRESCALER_DIV128 (SPI_CR1_BR_2 | SPI_CR1_BR_1) /*!< BaudRate control equal to fPCLK/128 */
Kojto 158:b23ee177fd68 208 #define LL_SPI_BAUDRATEPRESCALER_DIV256 (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0) /*!< BaudRate control equal to fPCLK/256 */
Kojto 158:b23ee177fd68 209 /**
Kojto 158:b23ee177fd68 210 * @}
Kojto 158:b23ee177fd68 211 */
Kojto 158:b23ee177fd68 212
Kojto 158:b23ee177fd68 213 /** @defgroup SPI_LL_EC_BIT_ORDER Transmission Bit Order
Kojto 158:b23ee177fd68 214 * @{
Kojto 158:b23ee177fd68 215 */
Kojto 158:b23ee177fd68 216 #define LL_SPI_LSB_FIRST (SPI_CR1_LSBFIRST) /*!< Data is transmitted/received with the LSB first */
Kojto 158:b23ee177fd68 217 #define LL_SPI_MSB_FIRST ((uint32_t)0x00000000U) /*!< Data is transmitted/received with the MSB first */
Kojto 158:b23ee177fd68 218 /**
Kojto 158:b23ee177fd68 219 * @}
Kojto 158:b23ee177fd68 220 */
Kojto 158:b23ee177fd68 221
Kojto 158:b23ee177fd68 222 /** @defgroup SPI_LL_EC_TRANSFER_MODE Transfer Mode
Kojto 158:b23ee177fd68 223 * @{
Kojto 158:b23ee177fd68 224 */
Kojto 158:b23ee177fd68 225 #define LL_SPI_FULL_DUPLEX ((uint32_t)0x00000000U) /*!< Full-Duplex mode. Rx and Tx transfer on 2 lines */
Kojto 158:b23ee177fd68 226 #define LL_SPI_SIMPLEX_RX (SPI_CR1_RXONLY) /*!< Simplex Rx mode. Rx transfer only on 1 line */
Kojto 158:b23ee177fd68 227 #define LL_SPI_HALF_DUPLEX_RX (SPI_CR1_BIDIMODE) /*!< Half-Duplex Rx mode. Rx transfer on 1 line */
Kojto 158:b23ee177fd68 228 #define LL_SPI_HALF_DUPLEX_TX (SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE) /*!< Half-Duplex Tx mode. Tx transfer on 1 line */
Kojto 158:b23ee177fd68 229 /**
Kojto 158:b23ee177fd68 230 * @}
Kojto 158:b23ee177fd68 231 */
Kojto 158:b23ee177fd68 232
Kojto 158:b23ee177fd68 233 /** @defgroup SPI_LL_EC_NSS_MODE Slave Select Pin Mode
Kojto 158:b23ee177fd68 234 * @{
Kojto 158:b23ee177fd68 235 */
Kojto 158:b23ee177fd68 236 #define LL_SPI_NSS_SOFT (SPI_CR1_SSM) /*!< NSS managed internally. NSS pin not used and free */
Kojto 158:b23ee177fd68 237 #define LL_SPI_NSS_HARD_INPUT ((uint32_t)0x00000000U) /*!< NSS pin used in Input. Only used in Master mode */
Kojto 158:b23ee177fd68 238 #define LL_SPI_NSS_HARD_OUTPUT (((uint32_t)SPI_CR2_SSOE << 16U)) /*!< NSS pin used in Output. Only used in Slave mode as chip select */
Kojto 158:b23ee177fd68 239 /**
Kojto 158:b23ee177fd68 240 * @}
Kojto 158:b23ee177fd68 241 */
Kojto 158:b23ee177fd68 242
Kojto 158:b23ee177fd68 243 /** @defgroup SPI_LL_EC_DATAWIDTH Datawidth
Kojto 158:b23ee177fd68 244 * @{
Kojto 158:b23ee177fd68 245 */
Kojto 158:b23ee177fd68 246 #define LL_SPI_DATAWIDTH_8BIT ((uint32_t)0x00000000U) /*!< Data length for SPI transfer: 8 bits */
Kojto 158:b23ee177fd68 247 #define LL_SPI_DATAWIDTH_16BIT (SPI_CR1_DFF) /*!< Data length for SPI transfer: 16 bits */
Kojto 158:b23ee177fd68 248 /**
Kojto 158:b23ee177fd68 249 * @}
Kojto 158:b23ee177fd68 250 */
Kojto 158:b23ee177fd68 251 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 252
Kojto 158:b23ee177fd68 253 /** @defgroup SPI_LL_EC_CRC_CALCULATION CRC Calculation
Kojto 158:b23ee177fd68 254 * @{
Kojto 158:b23ee177fd68 255 */
Kojto 158:b23ee177fd68 256 #define LL_SPI_CRCCALCULATION_DISABLE ((uint32_t)0x00000000U) /*!< CRC calculation disabled */
Kojto 158:b23ee177fd68 257 #define LL_SPI_CRCCALCULATION_ENABLE (SPI_CR1_CRCEN) /*!< CRC calculation enabled */
Kojto 158:b23ee177fd68 258 /**
Kojto 158:b23ee177fd68 259 * @}
Kojto 158:b23ee177fd68 260 */
Kojto 158:b23ee177fd68 261 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 262
Kojto 158:b23ee177fd68 263 /**
Kojto 158:b23ee177fd68 264 * @}
Kojto 158:b23ee177fd68 265 */
Kojto 158:b23ee177fd68 266
Kojto 158:b23ee177fd68 267 /* Exported macro ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 268 /** @defgroup SPI_LL_Exported_Macros SPI Exported Macros
Kojto 158:b23ee177fd68 269 * @{
Kojto 158:b23ee177fd68 270 */
Kojto 158:b23ee177fd68 271
Kojto 158:b23ee177fd68 272 /** @defgroup SPI_LL_EM_WRITE_READ Common Write and read registers Macros
Kojto 158:b23ee177fd68 273 * @{
Kojto 158:b23ee177fd68 274 */
Kojto 158:b23ee177fd68 275
Kojto 158:b23ee177fd68 276 /**
Kojto 158:b23ee177fd68 277 * @brief Write a value in SPI register
Kojto 158:b23ee177fd68 278 * @param __INSTANCE__ SPI Instance
Kojto 158:b23ee177fd68 279 * @param __REG__ Register to be written
Kojto 158:b23ee177fd68 280 * @param __VALUE__ Value to be written in the register
Kojto 158:b23ee177fd68 281 * @retval None
Kojto 158:b23ee177fd68 282 */
Kojto 158:b23ee177fd68 283 #define LL_SPI_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 158:b23ee177fd68 284
Kojto 158:b23ee177fd68 285 /**
Kojto 158:b23ee177fd68 286 * @brief Read a value in SPI register
Kojto 158:b23ee177fd68 287 * @param __INSTANCE__ SPI Instance
Kojto 158:b23ee177fd68 288 * @param __REG__ Register to be read
Kojto 158:b23ee177fd68 289 * @retval Register value
Kojto 158:b23ee177fd68 290 */
Kojto 158:b23ee177fd68 291 #define LL_SPI_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 158:b23ee177fd68 292 /**
Kojto 158:b23ee177fd68 293 * @}
Kojto 158:b23ee177fd68 294 */
Kojto 158:b23ee177fd68 295
Kojto 158:b23ee177fd68 296 /**
Kojto 158:b23ee177fd68 297 * @}
Kojto 158:b23ee177fd68 298 */
Kojto 158:b23ee177fd68 299
Kojto 158:b23ee177fd68 300 /* Exported functions --------------------------------------------------------*/
Kojto 158:b23ee177fd68 301 /** @defgroup SPI_LL_Exported_Functions SPI Exported Functions
Kojto 158:b23ee177fd68 302 * @{
Kojto 158:b23ee177fd68 303 */
Kojto 158:b23ee177fd68 304
Kojto 158:b23ee177fd68 305 /** @defgroup SPI_LL_EF_Configuration Configuration
Kojto 158:b23ee177fd68 306 * @{
Kojto 158:b23ee177fd68 307 */
Kojto 158:b23ee177fd68 308
Kojto 158:b23ee177fd68 309 /**
Kojto 158:b23ee177fd68 310 * @brief Enable SPI peripheral
Kojto 158:b23ee177fd68 311 * @rmtoll CR1 SPE LL_SPI_Enable
Kojto 158:b23ee177fd68 312 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 313 * @retval None
Kojto 158:b23ee177fd68 314 */
Kojto 158:b23ee177fd68 315 __STATIC_INLINE void LL_SPI_Enable(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 316 {
Kojto 158:b23ee177fd68 317 SET_BIT(SPIx->CR1, SPI_CR1_SPE);
Kojto 158:b23ee177fd68 318 }
Kojto 158:b23ee177fd68 319
Kojto 158:b23ee177fd68 320 /**
Kojto 158:b23ee177fd68 321 * @brief Disable SPI peripheral
Kojto 158:b23ee177fd68 322 * @note When disabling the SPI, follow the procedure described in the Reference Manual.
Kojto 158:b23ee177fd68 323 * @rmtoll CR1 SPE LL_SPI_Disable
Kojto 158:b23ee177fd68 324 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 325 * @retval None
Kojto 158:b23ee177fd68 326 */
Kojto 158:b23ee177fd68 327 __STATIC_INLINE void LL_SPI_Disable(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 328 {
Kojto 158:b23ee177fd68 329 CLEAR_BIT(SPIx->CR1, SPI_CR1_SPE);
Kojto 158:b23ee177fd68 330 }
Kojto 158:b23ee177fd68 331
Kojto 158:b23ee177fd68 332 /**
Kojto 158:b23ee177fd68 333 * @brief Check if SPI peripheral is enabled
Kojto 158:b23ee177fd68 334 * @rmtoll CR1 SPE LL_SPI_IsEnabled
Kojto 158:b23ee177fd68 335 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 336 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 337 */
Kojto 158:b23ee177fd68 338 __STATIC_INLINE uint32_t LL_SPI_IsEnabled(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 339 {
Kojto 158:b23ee177fd68 340 return (READ_BIT(SPIx->CR1, SPI_CR1_SPE) == (SPI_CR1_SPE));
Kojto 158:b23ee177fd68 341 }
Kojto 158:b23ee177fd68 342
Kojto 158:b23ee177fd68 343 /**
Kojto 158:b23ee177fd68 344 * @brief Set SPI operation mode to Master or Slave
Kojto 158:b23ee177fd68 345 * @note This bit should not be changed when communication is ongoing.
Kojto 158:b23ee177fd68 346 * @rmtoll CR1 MSTR LL_SPI_SetMode\n
Kojto 158:b23ee177fd68 347 * CR1 SSI LL_SPI_SetMode
Kojto 158:b23ee177fd68 348 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 349 * @param Mode This parameter can be one of the following values:
Kojto 158:b23ee177fd68 350 * @arg @ref LL_SPI_MODE_MASTER
Kojto 158:b23ee177fd68 351 * @arg @ref LL_SPI_MODE_SLAVE
Kojto 158:b23ee177fd68 352 * @retval None
Kojto 158:b23ee177fd68 353 */
Kojto 158:b23ee177fd68 354 __STATIC_INLINE void LL_SPI_SetMode(SPI_TypeDef *SPIx, uint32_t Mode)
Kojto 158:b23ee177fd68 355 {
Kojto 158:b23ee177fd68 356 MODIFY_REG(SPIx->CR1, SPI_CR1_MSTR | SPI_CR1_SSI, Mode);
Kojto 158:b23ee177fd68 357 }
Kojto 158:b23ee177fd68 358
Kojto 158:b23ee177fd68 359 /**
Kojto 158:b23ee177fd68 360 * @brief Get SPI operation mode (Master or Slave)
Kojto 158:b23ee177fd68 361 * @rmtoll CR1 MSTR LL_SPI_GetMode\n
Kojto 158:b23ee177fd68 362 * CR1 SSI LL_SPI_GetMode
Kojto 158:b23ee177fd68 363 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 364 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 365 * @arg @ref LL_SPI_MODE_MASTER
Kojto 158:b23ee177fd68 366 * @arg @ref LL_SPI_MODE_SLAVE
Kojto 158:b23ee177fd68 367 */
Kojto 158:b23ee177fd68 368 __STATIC_INLINE uint32_t LL_SPI_GetMode(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 369 {
Kojto 158:b23ee177fd68 370 return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_MSTR | SPI_CR1_SSI));
Kojto 158:b23ee177fd68 371 }
Kojto 158:b23ee177fd68 372
Kojto 158:b23ee177fd68 373 /**
Kojto 158:b23ee177fd68 374 * @brief Set serial protocol used
Kojto 158:b23ee177fd68 375 * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation.
Kojto 158:b23ee177fd68 376 * @rmtoll CR2 FRF LL_SPI_SetStandard
Kojto 158:b23ee177fd68 377 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 378 * @param Standard This parameter can be one of the following values:
Kojto 158:b23ee177fd68 379 * @arg @ref LL_SPI_PROTOCOL_MOTOROLA
Kojto 158:b23ee177fd68 380 * @arg @ref LL_SPI_PROTOCOL_TI
Kojto 158:b23ee177fd68 381 * @retval None
Kojto 158:b23ee177fd68 382 */
Kojto 158:b23ee177fd68 383 __STATIC_INLINE void LL_SPI_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard)
Kojto 158:b23ee177fd68 384 {
Kojto 158:b23ee177fd68 385 MODIFY_REG(SPIx->CR2, SPI_CR2_FRF, Standard);
Kojto 158:b23ee177fd68 386 }
Kojto 158:b23ee177fd68 387
Kojto 158:b23ee177fd68 388 /**
Kojto 158:b23ee177fd68 389 * @brief Get serial protocol used
Kojto 158:b23ee177fd68 390 * @rmtoll CR2 FRF LL_SPI_GetStandard
Kojto 158:b23ee177fd68 391 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 392 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 393 * @arg @ref LL_SPI_PROTOCOL_MOTOROLA
Kojto 158:b23ee177fd68 394 * @arg @ref LL_SPI_PROTOCOL_TI
Kojto 158:b23ee177fd68 395 */
Kojto 158:b23ee177fd68 396 __STATIC_INLINE uint32_t LL_SPI_GetStandard(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 397 {
Kojto 158:b23ee177fd68 398 return (uint32_t)(READ_BIT(SPIx->CR2, SPI_CR2_FRF));
Kojto 158:b23ee177fd68 399 }
Kojto 158:b23ee177fd68 400
Kojto 158:b23ee177fd68 401 /**
Kojto 158:b23ee177fd68 402 * @brief Set clock phase
Kojto 158:b23ee177fd68 403 * @note This bit should not be changed when communication is ongoing.
Kojto 158:b23ee177fd68 404 * This bit is not used in SPI TI mode.
Kojto 158:b23ee177fd68 405 * @rmtoll CR1 CPHA LL_SPI_SetClockPhase
Kojto 158:b23ee177fd68 406 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 407 * @param ClockPhase This parameter can be one of the following values:
Kojto 158:b23ee177fd68 408 * @arg @ref LL_SPI_PHASE_1EDGE
Kojto 158:b23ee177fd68 409 * @arg @ref LL_SPI_PHASE_2EDGE
Kojto 158:b23ee177fd68 410 * @retval None
Kojto 158:b23ee177fd68 411 */
Kojto 158:b23ee177fd68 412 __STATIC_INLINE void LL_SPI_SetClockPhase(SPI_TypeDef *SPIx, uint32_t ClockPhase)
Kojto 158:b23ee177fd68 413 {
Kojto 158:b23ee177fd68 414 MODIFY_REG(SPIx->CR1, SPI_CR1_CPHA, ClockPhase);
Kojto 158:b23ee177fd68 415 }
Kojto 158:b23ee177fd68 416
Kojto 158:b23ee177fd68 417 /**
Kojto 158:b23ee177fd68 418 * @brief Get clock phase
Kojto 158:b23ee177fd68 419 * @rmtoll CR1 CPHA LL_SPI_GetClockPhase
Kojto 158:b23ee177fd68 420 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 421 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 422 * @arg @ref LL_SPI_PHASE_1EDGE
Kojto 158:b23ee177fd68 423 * @arg @ref LL_SPI_PHASE_2EDGE
Kojto 158:b23ee177fd68 424 */
Kojto 158:b23ee177fd68 425 __STATIC_INLINE uint32_t LL_SPI_GetClockPhase(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 426 {
Kojto 158:b23ee177fd68 427 return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_CPHA));
Kojto 158:b23ee177fd68 428 }
Kojto 158:b23ee177fd68 429
Kojto 158:b23ee177fd68 430 /**
Kojto 158:b23ee177fd68 431 * @brief Set clock polarity
Kojto 158:b23ee177fd68 432 * @note This bit should not be changed when communication is ongoing.
Kojto 158:b23ee177fd68 433 * This bit is not used in SPI TI mode.
Kojto 158:b23ee177fd68 434 * @rmtoll CR1 CPOL LL_SPI_SetClockPolarity
Kojto 158:b23ee177fd68 435 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 436 * @param ClockPolarity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 437 * @arg @ref LL_SPI_POLARITY_LOW
Kojto 158:b23ee177fd68 438 * @arg @ref LL_SPI_POLARITY_HIGH
Kojto 158:b23ee177fd68 439 * @retval None
Kojto 158:b23ee177fd68 440 */
Kojto 158:b23ee177fd68 441 __STATIC_INLINE void LL_SPI_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity)
Kojto 158:b23ee177fd68 442 {
Kojto 158:b23ee177fd68 443 MODIFY_REG(SPIx->CR1, SPI_CR1_CPOL, ClockPolarity);
Kojto 158:b23ee177fd68 444 }
Kojto 158:b23ee177fd68 445
Kojto 158:b23ee177fd68 446 /**
Kojto 158:b23ee177fd68 447 * @brief Get clock polarity
Kojto 158:b23ee177fd68 448 * @rmtoll CR1 CPOL LL_SPI_GetClockPolarity
Kojto 158:b23ee177fd68 449 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 450 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 451 * @arg @ref LL_SPI_POLARITY_LOW
Kojto 158:b23ee177fd68 452 * @arg @ref LL_SPI_POLARITY_HIGH
Kojto 158:b23ee177fd68 453 */
Kojto 158:b23ee177fd68 454 __STATIC_INLINE uint32_t LL_SPI_GetClockPolarity(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 455 {
Kojto 158:b23ee177fd68 456 return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_CPOL));
Kojto 158:b23ee177fd68 457 }
Kojto 158:b23ee177fd68 458
Kojto 158:b23ee177fd68 459 /**
Kojto 158:b23ee177fd68 460 * @brief Set baud rate prescaler
Kojto 158:b23ee177fd68 461 * @note These bits should not be changed when communication is ongoing. SPI BaudRate = fPCLK/Prescaler.
Kojto 158:b23ee177fd68 462 * @rmtoll CR1 BR LL_SPI_SetBaudRatePrescaler
Kojto 158:b23ee177fd68 463 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 464 * @param BaudRate This parameter can be one of the following values:
Kojto 158:b23ee177fd68 465 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV2
Kojto 158:b23ee177fd68 466 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV4
Kojto 158:b23ee177fd68 467 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV8
Kojto 158:b23ee177fd68 468 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV16
Kojto 158:b23ee177fd68 469 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV32
Kojto 158:b23ee177fd68 470 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV64
Kojto 158:b23ee177fd68 471 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV128
Kojto 158:b23ee177fd68 472 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV256
Kojto 158:b23ee177fd68 473 * @retval None
Kojto 158:b23ee177fd68 474 */
Kojto 158:b23ee177fd68 475 __STATIC_INLINE void LL_SPI_SetBaudRatePrescaler(SPI_TypeDef *SPIx, uint32_t BaudRate)
Kojto 158:b23ee177fd68 476 {
Kojto 158:b23ee177fd68 477 MODIFY_REG(SPIx->CR1, SPI_CR1_BR, BaudRate);
Kojto 158:b23ee177fd68 478 }
Kojto 158:b23ee177fd68 479
Kojto 158:b23ee177fd68 480 /**
Kojto 158:b23ee177fd68 481 * @brief Get baud rate prescaler
Kojto 158:b23ee177fd68 482 * @rmtoll CR1 BR LL_SPI_GetBaudRatePrescaler
Kojto 158:b23ee177fd68 483 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 484 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 485 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV2
Kojto 158:b23ee177fd68 486 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV4
Kojto 158:b23ee177fd68 487 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV8
Kojto 158:b23ee177fd68 488 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV16
Kojto 158:b23ee177fd68 489 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV32
Kojto 158:b23ee177fd68 490 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV64
Kojto 158:b23ee177fd68 491 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV128
Kojto 158:b23ee177fd68 492 * @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV256
Kojto 158:b23ee177fd68 493 */
Kojto 158:b23ee177fd68 494 __STATIC_INLINE uint32_t LL_SPI_GetBaudRatePrescaler(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 495 {
Kojto 158:b23ee177fd68 496 return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_BR));
Kojto 158:b23ee177fd68 497 }
Kojto 158:b23ee177fd68 498
Kojto 158:b23ee177fd68 499 /**
Kojto 158:b23ee177fd68 500 * @brief Set transfer bit order
Kojto 158:b23ee177fd68 501 * @note This bit should not be changed when communication is ongoing. This bit is not used in SPI TI mode.
Kojto 158:b23ee177fd68 502 * @rmtoll CR1 LSBFIRST LL_SPI_SetTransferBitOrder
Kojto 158:b23ee177fd68 503 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 504 * @param BitOrder This parameter can be one of the following values:
Kojto 158:b23ee177fd68 505 * @arg @ref LL_SPI_LSB_FIRST
Kojto 158:b23ee177fd68 506 * @arg @ref LL_SPI_MSB_FIRST
Kojto 158:b23ee177fd68 507 * @retval None
Kojto 158:b23ee177fd68 508 */
Kojto 158:b23ee177fd68 509 __STATIC_INLINE void LL_SPI_SetTransferBitOrder(SPI_TypeDef *SPIx, uint32_t BitOrder)
Kojto 158:b23ee177fd68 510 {
Kojto 158:b23ee177fd68 511 MODIFY_REG(SPIx->CR1, SPI_CR1_LSBFIRST, BitOrder);
Kojto 158:b23ee177fd68 512 }
Kojto 158:b23ee177fd68 513
Kojto 158:b23ee177fd68 514 /**
Kojto 158:b23ee177fd68 515 * @brief Get transfer bit order
Kojto 158:b23ee177fd68 516 * @rmtoll CR1 LSBFIRST LL_SPI_GetTransferBitOrder
Kojto 158:b23ee177fd68 517 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 518 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 519 * @arg @ref LL_SPI_LSB_FIRST
Kojto 158:b23ee177fd68 520 * @arg @ref LL_SPI_MSB_FIRST
Kojto 158:b23ee177fd68 521 */
Kojto 158:b23ee177fd68 522 __STATIC_INLINE uint32_t LL_SPI_GetTransferBitOrder(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 523 {
Kojto 158:b23ee177fd68 524 return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_LSBFIRST));
Kojto 158:b23ee177fd68 525 }
Kojto 158:b23ee177fd68 526
Kojto 158:b23ee177fd68 527 /**
Kojto 158:b23ee177fd68 528 * @brief Set transfer direction mode
Kojto 158:b23ee177fd68 529 * @note For Half-Duplex mode, Rx Direction is set by default.
Kojto 158:b23ee177fd68 530 * In master mode, the MOSI pin is used and in slave mode, the MISO pin is used for Half-Duplex.
Kojto 158:b23ee177fd68 531 * @rmtoll CR1 RXONLY LL_SPI_SetTransferDirection\n
Kojto 158:b23ee177fd68 532 * CR1 BIDIMODE LL_SPI_SetTransferDirection\n
Kojto 158:b23ee177fd68 533 * CR1 BIDIOE LL_SPI_SetTransferDirection
Kojto 158:b23ee177fd68 534 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 535 * @param TransferDirection This parameter can be one of the following values:
Kojto 158:b23ee177fd68 536 * @arg @ref LL_SPI_FULL_DUPLEX
Kojto 158:b23ee177fd68 537 * @arg @ref LL_SPI_SIMPLEX_RX
Kojto 158:b23ee177fd68 538 * @arg @ref LL_SPI_HALF_DUPLEX_RX
Kojto 158:b23ee177fd68 539 * @arg @ref LL_SPI_HALF_DUPLEX_TX
Kojto 158:b23ee177fd68 540 * @retval None
Kojto 158:b23ee177fd68 541 */
Kojto 158:b23ee177fd68 542 __STATIC_INLINE void LL_SPI_SetTransferDirection(SPI_TypeDef *SPIx, uint32_t TransferDirection)
Kojto 158:b23ee177fd68 543 {
Kojto 158:b23ee177fd68 544 MODIFY_REG(SPIx->CR1, SPI_CR1_RXONLY | SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE, TransferDirection);
Kojto 158:b23ee177fd68 545 }
Kojto 158:b23ee177fd68 546
Kojto 158:b23ee177fd68 547 /**
Kojto 158:b23ee177fd68 548 * @brief Get transfer direction mode
Kojto 158:b23ee177fd68 549 * @rmtoll CR1 RXONLY LL_SPI_GetTransferDirection\n
Kojto 158:b23ee177fd68 550 * CR1 BIDIMODE LL_SPI_GetTransferDirection\n
Kojto 158:b23ee177fd68 551 * CR1 BIDIOE LL_SPI_GetTransferDirection
Kojto 158:b23ee177fd68 552 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 553 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 554 * @arg @ref LL_SPI_FULL_DUPLEX
Kojto 158:b23ee177fd68 555 * @arg @ref LL_SPI_SIMPLEX_RX
Kojto 158:b23ee177fd68 556 * @arg @ref LL_SPI_HALF_DUPLEX_RX
Kojto 158:b23ee177fd68 557 * @arg @ref LL_SPI_HALF_DUPLEX_TX
Kojto 158:b23ee177fd68 558 */
Kojto 158:b23ee177fd68 559 __STATIC_INLINE uint32_t LL_SPI_GetTransferDirection(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 560 {
Kojto 158:b23ee177fd68 561 return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_RXONLY | SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE));
Kojto 158:b23ee177fd68 562 }
Kojto 158:b23ee177fd68 563
Kojto 158:b23ee177fd68 564 /**
Kojto 158:b23ee177fd68 565 * @brief Set frame data width
Kojto 158:b23ee177fd68 566 * @rmtoll CR1 DFF LL_SPI_SetDataWidth
Kojto 158:b23ee177fd68 567 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 568 * @param DataWidth This parameter can be one of the following values:
Kojto 158:b23ee177fd68 569 * @arg @ref LL_SPI_DATAWIDTH_8BIT
Kojto 158:b23ee177fd68 570 * @arg @ref LL_SPI_DATAWIDTH_16BIT
Kojto 158:b23ee177fd68 571 * @retval None
Kojto 158:b23ee177fd68 572 */
Kojto 158:b23ee177fd68 573 __STATIC_INLINE void LL_SPI_SetDataWidth(SPI_TypeDef *SPIx, uint32_t DataWidth)
Kojto 158:b23ee177fd68 574 {
Kojto 158:b23ee177fd68 575 MODIFY_REG(SPIx->CR1, SPI_CR1_DFF, DataWidth);
Kojto 158:b23ee177fd68 576 }
Kojto 158:b23ee177fd68 577
Kojto 158:b23ee177fd68 578 /**
Kojto 158:b23ee177fd68 579 * @brief Get frame data width
Kojto 158:b23ee177fd68 580 * @rmtoll CR1 DFF LL_SPI_GetDataWidth
Kojto 158:b23ee177fd68 581 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 582 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 583 * @arg @ref LL_SPI_DATAWIDTH_8BIT
Kojto 158:b23ee177fd68 584 * @arg @ref LL_SPI_DATAWIDTH_16BIT
Kojto 158:b23ee177fd68 585 */
Kojto 158:b23ee177fd68 586 __STATIC_INLINE uint32_t LL_SPI_GetDataWidth(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 587 {
Kojto 158:b23ee177fd68 588 return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_DFF));
Kojto 158:b23ee177fd68 589 }
Kojto 158:b23ee177fd68 590
Kojto 158:b23ee177fd68 591 /**
Kojto 158:b23ee177fd68 592 * @}
Kojto 158:b23ee177fd68 593 */
Kojto 158:b23ee177fd68 594
Kojto 158:b23ee177fd68 595 /** @defgroup SPI_LL_EF_CRC_Management CRC Management
Kojto 158:b23ee177fd68 596 * @{
Kojto 158:b23ee177fd68 597 */
Kojto 158:b23ee177fd68 598
Kojto 158:b23ee177fd68 599 /**
Kojto 158:b23ee177fd68 600 * @brief Enable CRC
Kojto 158:b23ee177fd68 601 * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation.
Kojto 158:b23ee177fd68 602 * @rmtoll CR1 CRCEN LL_SPI_EnableCRC
Kojto 158:b23ee177fd68 603 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 604 * @retval None
Kojto 158:b23ee177fd68 605 */
Kojto 158:b23ee177fd68 606 __STATIC_INLINE void LL_SPI_EnableCRC(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 607 {
Kojto 158:b23ee177fd68 608 SET_BIT(SPIx->CR1, SPI_CR1_CRCEN);
Kojto 158:b23ee177fd68 609 }
Kojto 158:b23ee177fd68 610
Kojto 158:b23ee177fd68 611 /**
Kojto 158:b23ee177fd68 612 * @brief Disable CRC
Kojto 158:b23ee177fd68 613 * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation.
Kojto 158:b23ee177fd68 614 * @rmtoll CR1 CRCEN LL_SPI_DisableCRC
Kojto 158:b23ee177fd68 615 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 616 * @retval None
Kojto 158:b23ee177fd68 617 */
Kojto 158:b23ee177fd68 618 __STATIC_INLINE void LL_SPI_DisableCRC(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 619 {
Kojto 158:b23ee177fd68 620 CLEAR_BIT(SPIx->CR1, SPI_CR1_CRCEN);
Kojto 158:b23ee177fd68 621 }
Kojto 158:b23ee177fd68 622
Kojto 158:b23ee177fd68 623 /**
Kojto 158:b23ee177fd68 624 * @brief Check if CRC is enabled
Kojto 158:b23ee177fd68 625 * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation.
Kojto 158:b23ee177fd68 626 * @rmtoll CR1 CRCEN LL_SPI_IsEnabledCRC
Kojto 158:b23ee177fd68 627 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 628 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 629 */
Kojto 158:b23ee177fd68 630 __STATIC_INLINE uint32_t LL_SPI_IsEnabledCRC(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 631 {
Kojto 158:b23ee177fd68 632 return (READ_BIT(SPIx->CR1, SPI_CR1_CRCEN) == (SPI_CR1_CRCEN));
Kojto 158:b23ee177fd68 633 }
Kojto 158:b23ee177fd68 634
Kojto 158:b23ee177fd68 635 /**
Kojto 158:b23ee177fd68 636 * @brief Set CRCNext to transfer CRC on the line
Kojto 158:b23ee177fd68 637 * @note This bit has to be written as soon as the last data is written in the SPIx_DR register.
Kojto 158:b23ee177fd68 638 * @rmtoll CR1 CRCNEXT LL_SPI_SetCRCNext
Kojto 158:b23ee177fd68 639 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 640 * @retval None
Kojto 158:b23ee177fd68 641 */
Kojto 158:b23ee177fd68 642 __STATIC_INLINE void LL_SPI_SetCRCNext(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 643 {
Kojto 158:b23ee177fd68 644 SET_BIT(SPIx->CR1, SPI_CR1_CRCNEXT);
Kojto 158:b23ee177fd68 645 }
Kojto 158:b23ee177fd68 646
Kojto 158:b23ee177fd68 647 /**
Kojto 158:b23ee177fd68 648 * @brief Set polynomial for CRC calculation
Kojto 158:b23ee177fd68 649 * @rmtoll CRCPR CRCPOLY LL_SPI_SetCRCPolynomial
Kojto 158:b23ee177fd68 650 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 651 * @param CRCPoly This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF
Kojto 158:b23ee177fd68 652 * @retval None
Kojto 158:b23ee177fd68 653 */
Kojto 158:b23ee177fd68 654 __STATIC_INLINE void LL_SPI_SetCRCPolynomial(SPI_TypeDef *SPIx, uint32_t CRCPoly)
Kojto 158:b23ee177fd68 655 {
Kojto 158:b23ee177fd68 656 WRITE_REG(SPIx->CRCPR, (uint16_t)CRCPoly);
Kojto 158:b23ee177fd68 657 }
Kojto 158:b23ee177fd68 658
Kojto 158:b23ee177fd68 659 /**
Kojto 158:b23ee177fd68 660 * @brief Get polynomial for CRC calculation
Kojto 158:b23ee177fd68 661 * @rmtoll CRCPR CRCPOLY LL_SPI_GetCRCPolynomial
Kojto 158:b23ee177fd68 662 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 663 * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF
Kojto 158:b23ee177fd68 664 */
Kojto 158:b23ee177fd68 665 __STATIC_INLINE uint32_t LL_SPI_GetCRCPolynomial(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 666 {
Kojto 158:b23ee177fd68 667 return (uint32_t)(READ_REG(SPIx->CRCPR));
Kojto 158:b23ee177fd68 668 }
Kojto 158:b23ee177fd68 669
Kojto 158:b23ee177fd68 670 /**
Kojto 158:b23ee177fd68 671 * @brief Get Rx CRC
Kojto 158:b23ee177fd68 672 * @rmtoll RXCRCR RXCRC LL_SPI_GetRxCRC
Kojto 158:b23ee177fd68 673 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 674 * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF
Kojto 158:b23ee177fd68 675 */
Kojto 158:b23ee177fd68 676 __STATIC_INLINE uint32_t LL_SPI_GetRxCRC(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 677 {
Kojto 158:b23ee177fd68 678 return (uint32_t)(READ_REG(SPIx->RXCRCR));
Kojto 158:b23ee177fd68 679 }
Kojto 158:b23ee177fd68 680
Kojto 158:b23ee177fd68 681 /**
Kojto 158:b23ee177fd68 682 * @brief Get Tx CRC
Kojto 158:b23ee177fd68 683 * @rmtoll TXCRCR TXCRC LL_SPI_GetTxCRC
Kojto 158:b23ee177fd68 684 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 685 * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF
Kojto 158:b23ee177fd68 686 */
Kojto 158:b23ee177fd68 687 __STATIC_INLINE uint32_t LL_SPI_GetTxCRC(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 688 {
Kojto 158:b23ee177fd68 689 return (uint32_t)(READ_REG(SPIx->TXCRCR));
Kojto 158:b23ee177fd68 690 }
Kojto 158:b23ee177fd68 691
Kojto 158:b23ee177fd68 692 /**
Kojto 158:b23ee177fd68 693 * @}
Kojto 158:b23ee177fd68 694 */
Kojto 158:b23ee177fd68 695
Kojto 158:b23ee177fd68 696 /** @defgroup SPI_LL_EF_NSS_Management Slave Select Pin Management
Kojto 158:b23ee177fd68 697 * @{
Kojto 158:b23ee177fd68 698 */
Kojto 158:b23ee177fd68 699
Kojto 158:b23ee177fd68 700 /**
Kojto 158:b23ee177fd68 701 * @brief Set NSS mode
Kojto 158:b23ee177fd68 702 * @note LL_SPI_NSS_SOFT Mode is not used in SPI TI mode.
Kojto 158:b23ee177fd68 703 * @rmtoll CR1 SSM LL_SPI_SetNSSMode\n
Kojto 158:b23ee177fd68 704 * @rmtoll CR2 SSOE LL_SPI_SetNSSMode
Kojto 158:b23ee177fd68 705 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 706 * @param NSS This parameter can be one of the following values:
Kojto 158:b23ee177fd68 707 * @arg @ref LL_SPI_NSS_SOFT
Kojto 158:b23ee177fd68 708 * @arg @ref LL_SPI_NSS_HARD_INPUT
Kojto 158:b23ee177fd68 709 * @arg @ref LL_SPI_NSS_HARD_OUTPUT
Kojto 158:b23ee177fd68 710 * @retval None
Kojto 158:b23ee177fd68 711 */
Kojto 158:b23ee177fd68 712 __STATIC_INLINE void LL_SPI_SetNSSMode(SPI_TypeDef *SPIx, uint32_t NSS)
Kojto 158:b23ee177fd68 713 {
Kojto 158:b23ee177fd68 714 MODIFY_REG(SPIx->CR1, SPI_CR1_SSM, NSS);
Kojto 158:b23ee177fd68 715 MODIFY_REG(SPIx->CR2, SPI_CR2_SSOE, ((uint32_t)(NSS >> 16U)));
Kojto 158:b23ee177fd68 716 }
Kojto 158:b23ee177fd68 717
Kojto 158:b23ee177fd68 718 /**
Kojto 158:b23ee177fd68 719 * @brief Get NSS mode
Kojto 158:b23ee177fd68 720 * @rmtoll CR1 SSM LL_SPI_GetNSSMode\n
Kojto 158:b23ee177fd68 721 * @rmtoll CR2 SSOE LL_SPI_GetNSSMode
Kojto 158:b23ee177fd68 722 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 723 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 724 * @arg @ref LL_SPI_NSS_SOFT
Kojto 158:b23ee177fd68 725 * @arg @ref LL_SPI_NSS_HARD_INPUT
Kojto 158:b23ee177fd68 726 * @arg @ref LL_SPI_NSS_HARD_OUTPUT
Kojto 158:b23ee177fd68 727 */
Kojto 158:b23ee177fd68 728 __STATIC_INLINE uint32_t LL_SPI_GetNSSMode(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 729 {
Kojto 158:b23ee177fd68 730 register uint32_t Ssm = (READ_BIT(SPIx->CR1, SPI_CR1_SSM));
Kojto 158:b23ee177fd68 731 register uint32_t Ssoe = (READ_BIT(SPIx->CR2, SPI_CR2_SSOE) << 16U);
Kojto 158:b23ee177fd68 732 return (Ssm | Ssoe);
Kojto 158:b23ee177fd68 733 }
Kojto 158:b23ee177fd68 734
Kojto 158:b23ee177fd68 735 /**
Kojto 158:b23ee177fd68 736 * @}
Kojto 158:b23ee177fd68 737 */
Kojto 158:b23ee177fd68 738
Kojto 158:b23ee177fd68 739 /** @defgroup SPI_LL_EF_FLAG_Management FLAG Management
Kojto 158:b23ee177fd68 740 * @{
Kojto 158:b23ee177fd68 741 */
Kojto 158:b23ee177fd68 742
Kojto 158:b23ee177fd68 743 /**
Kojto 158:b23ee177fd68 744 * @brief Check if Rx buffer is not empty
Kojto 158:b23ee177fd68 745 * @rmtoll SR RXNE LL_SPI_IsActiveFlag_RXNE
Kojto 158:b23ee177fd68 746 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 747 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 748 */
Kojto 158:b23ee177fd68 749 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_RXNE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 750 {
Kojto 158:b23ee177fd68 751 return (READ_BIT(SPIx->SR, SPI_SR_RXNE) == (SPI_SR_RXNE));
Kojto 158:b23ee177fd68 752 }
Kojto 158:b23ee177fd68 753
Kojto 158:b23ee177fd68 754 /**
Kojto 158:b23ee177fd68 755 * @brief Check if Tx buffer is empty
Kojto 158:b23ee177fd68 756 * @rmtoll SR TXE LL_SPI_IsActiveFlag_TXE
Kojto 158:b23ee177fd68 757 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 758 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 759 */
Kojto 158:b23ee177fd68 760 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_TXE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 761 {
Kojto 158:b23ee177fd68 762 return (READ_BIT(SPIx->SR, SPI_SR_TXE) == (SPI_SR_TXE));
Kojto 158:b23ee177fd68 763 }
Kojto 158:b23ee177fd68 764
Kojto 158:b23ee177fd68 765 /**
Kojto 158:b23ee177fd68 766 * @brief Get CRC error flag
Kojto 158:b23ee177fd68 767 * @rmtoll SR CRCERR LL_SPI_IsActiveFlag_CRCERR
Kojto 158:b23ee177fd68 768 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 769 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 770 */
Kojto 158:b23ee177fd68 771 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_CRCERR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 772 {
Kojto 158:b23ee177fd68 773 return (READ_BIT(SPIx->SR, SPI_SR_CRCERR) == (SPI_SR_CRCERR));
Kojto 158:b23ee177fd68 774 }
Kojto 158:b23ee177fd68 775
Kojto 158:b23ee177fd68 776 /**
Kojto 158:b23ee177fd68 777 * @brief Get mode fault error flag
Kojto 158:b23ee177fd68 778 * @rmtoll SR MODF LL_SPI_IsActiveFlag_MODF
Kojto 158:b23ee177fd68 779 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 780 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 781 */
Kojto 158:b23ee177fd68 782 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_MODF(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 783 {
Kojto 158:b23ee177fd68 784 return (READ_BIT(SPIx->SR, SPI_SR_MODF) == (SPI_SR_MODF));
Kojto 158:b23ee177fd68 785 }
Kojto 158:b23ee177fd68 786
Kojto 158:b23ee177fd68 787 /**
Kojto 158:b23ee177fd68 788 * @brief Get overrun error flag
Kojto 158:b23ee177fd68 789 * @rmtoll SR OVR LL_SPI_IsActiveFlag_OVR
Kojto 158:b23ee177fd68 790 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 791 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 792 */
Kojto 158:b23ee177fd68 793 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_OVR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 794 {
Kojto 158:b23ee177fd68 795 return (READ_BIT(SPIx->SR, SPI_SR_OVR) == (SPI_SR_OVR));
Kojto 158:b23ee177fd68 796 }
Kojto 158:b23ee177fd68 797
Kojto 158:b23ee177fd68 798 /**
Kojto 158:b23ee177fd68 799 * @brief Get busy flag
Kojto 158:b23ee177fd68 800 * @note The BSY flag is cleared under any one of the following conditions:
Kojto 158:b23ee177fd68 801 * -When the SPI is correctly disabled
Kojto 158:b23ee177fd68 802 * -When a fault is detected in Master mode (MODF bit set to 1)
Kojto 158:b23ee177fd68 803 * -In Master mode, when it finishes a data transmission and no new data is ready to be
Kojto 158:b23ee177fd68 804 * sent
Kojto 158:b23ee177fd68 805 * -In Slave mode, when the BSY flag is set to '0' for at least one SPI clock cycle between
Kojto 158:b23ee177fd68 806 * each data transfer.
Kojto 158:b23ee177fd68 807 * @rmtoll SR BSY LL_SPI_IsActiveFlag_BSY
Kojto 158:b23ee177fd68 808 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 809 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 810 */
Kojto 158:b23ee177fd68 811 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_BSY(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 812 {
Kojto 158:b23ee177fd68 813 return (READ_BIT(SPIx->SR, SPI_SR_BSY) == (SPI_SR_BSY));
Kojto 158:b23ee177fd68 814 }
Kojto 158:b23ee177fd68 815
Kojto 158:b23ee177fd68 816 /**
Kojto 158:b23ee177fd68 817 * @brief Get frame format error flag
Kojto 158:b23ee177fd68 818 * @rmtoll SR FRE LL_SPI_IsActiveFlag_FRE
Kojto 158:b23ee177fd68 819 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 820 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 821 */
Kojto 158:b23ee177fd68 822 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_FRE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 823 {
Kojto 158:b23ee177fd68 824 return (READ_BIT(SPIx->SR, SPI_SR_FRE) == (SPI_SR_FRE));
Kojto 158:b23ee177fd68 825 }
Kojto 158:b23ee177fd68 826
Kojto 158:b23ee177fd68 827 /**
Kojto 158:b23ee177fd68 828 * @brief Clear CRC error flag
Kojto 158:b23ee177fd68 829 * @rmtoll SR CRCERR LL_SPI_ClearFlag_CRCERR
Kojto 158:b23ee177fd68 830 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 831 * @retval None
Kojto 158:b23ee177fd68 832 */
Kojto 158:b23ee177fd68 833 __STATIC_INLINE void LL_SPI_ClearFlag_CRCERR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 834 {
Kojto 158:b23ee177fd68 835 CLEAR_BIT(SPIx->SR, SPI_SR_CRCERR);
Kojto 158:b23ee177fd68 836 }
Kojto 158:b23ee177fd68 837
Kojto 158:b23ee177fd68 838 /**
Kojto 158:b23ee177fd68 839 * @brief Clear mode fault error flag
Kojto 158:b23ee177fd68 840 * @note Clearing this flag is done by a read access to the SPIx_SR
Kojto 158:b23ee177fd68 841 * register followed by a write access to the SPIx_CR1 register
Kojto 158:b23ee177fd68 842 * @rmtoll SR MODF LL_SPI_ClearFlag_MODF
Kojto 158:b23ee177fd68 843 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 844 * @retval None
Kojto 158:b23ee177fd68 845 */
Kojto 158:b23ee177fd68 846 __STATIC_INLINE void LL_SPI_ClearFlag_MODF(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 847 {
Kojto 158:b23ee177fd68 848 __IO uint32_t tmpreg;
Kojto 158:b23ee177fd68 849 tmpreg = SPIx->SR;
Kojto 158:b23ee177fd68 850 (void) tmpreg;
Kojto 158:b23ee177fd68 851 tmpreg = CLEAR_BIT(SPIx->CR1, SPI_CR1_SPE);
Kojto 158:b23ee177fd68 852 (void) tmpreg;
Kojto 158:b23ee177fd68 853 }
Kojto 158:b23ee177fd68 854
Kojto 158:b23ee177fd68 855 /**
Kojto 158:b23ee177fd68 856 * @brief Clear overrun error flag
Kojto 158:b23ee177fd68 857 * @note Clearing this flag is done by a read access to the SPIx_DR
Kojto 158:b23ee177fd68 858 * register followed by a read access to the SPIx_SR register
Kojto 158:b23ee177fd68 859 * @rmtoll SR OVR LL_SPI_ClearFlag_OVR
Kojto 158:b23ee177fd68 860 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 861 * @retval None
Kojto 158:b23ee177fd68 862 */
Kojto 158:b23ee177fd68 863 __STATIC_INLINE void LL_SPI_ClearFlag_OVR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 864 {
Kojto 158:b23ee177fd68 865 __IO uint32_t tmpreg;
Kojto 158:b23ee177fd68 866 tmpreg = SPIx->DR;
Kojto 158:b23ee177fd68 867 (void) tmpreg;
Kojto 158:b23ee177fd68 868 tmpreg = SPIx->SR;
Kojto 158:b23ee177fd68 869 (void) tmpreg;
Kojto 158:b23ee177fd68 870 }
Kojto 158:b23ee177fd68 871
Kojto 158:b23ee177fd68 872 /**
Kojto 158:b23ee177fd68 873 * @brief Clear frame format error flag
Kojto 158:b23ee177fd68 874 * @note Clearing this flag is done by reading SPIx_SR register
Kojto 158:b23ee177fd68 875 * @rmtoll SR FRE LL_SPI_ClearFlag_FRE
Kojto 158:b23ee177fd68 876 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 877 * @retval None
Kojto 158:b23ee177fd68 878 */
Kojto 158:b23ee177fd68 879 __STATIC_INLINE void LL_SPI_ClearFlag_FRE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 880 {
Kojto 158:b23ee177fd68 881 __IO uint32_t tmpreg;
Kojto 158:b23ee177fd68 882 tmpreg = SPIx->SR;
Kojto 158:b23ee177fd68 883 (void) tmpreg;
Kojto 158:b23ee177fd68 884 }
Kojto 158:b23ee177fd68 885
Kojto 158:b23ee177fd68 886 /**
Kojto 158:b23ee177fd68 887 * @}
Kojto 158:b23ee177fd68 888 */
Kojto 158:b23ee177fd68 889
Kojto 158:b23ee177fd68 890 /** @defgroup SPI_LL_EF_IT_Management Interrupt Management
Kojto 158:b23ee177fd68 891 * @{
Kojto 158:b23ee177fd68 892 */
Kojto 158:b23ee177fd68 893
Kojto 158:b23ee177fd68 894 /**
Kojto 158:b23ee177fd68 895 * @brief Enable error interrupt
Kojto 158:b23ee177fd68 896 * @note This bit controls the generation of an interrupt when an error condition occurs (CRCERR, OVR, MODF in SPI mode, FRE at TI mode).
Kojto 158:b23ee177fd68 897 * @rmtoll CR2 ERRIE LL_SPI_EnableIT_ERR
Kojto 158:b23ee177fd68 898 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 899 * @retval None
Kojto 158:b23ee177fd68 900 */
Kojto 158:b23ee177fd68 901 __STATIC_INLINE void LL_SPI_EnableIT_ERR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 902 {
Kojto 158:b23ee177fd68 903 SET_BIT(SPIx->CR2, SPI_CR2_ERRIE);
Kojto 158:b23ee177fd68 904 }
Kojto 158:b23ee177fd68 905
Kojto 158:b23ee177fd68 906 /**
Kojto 158:b23ee177fd68 907 * @brief Enable Rx buffer not empty interrupt
Kojto 158:b23ee177fd68 908 * @rmtoll CR2 RXNEIE LL_SPI_EnableIT_RXNE
Kojto 158:b23ee177fd68 909 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 910 * @retval None
Kojto 158:b23ee177fd68 911 */
Kojto 158:b23ee177fd68 912 __STATIC_INLINE void LL_SPI_EnableIT_RXNE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 913 {
Kojto 158:b23ee177fd68 914 SET_BIT(SPIx->CR2, SPI_CR2_RXNEIE);
Kojto 158:b23ee177fd68 915 }
Kojto 158:b23ee177fd68 916
Kojto 158:b23ee177fd68 917 /**
Kojto 158:b23ee177fd68 918 * @brief Enable Tx buffer empty interrupt
Kojto 158:b23ee177fd68 919 * @rmtoll CR2 TXEIE LL_SPI_EnableIT_TXE
Kojto 158:b23ee177fd68 920 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 921 * @retval None
Kojto 158:b23ee177fd68 922 */
Kojto 158:b23ee177fd68 923 __STATIC_INLINE void LL_SPI_EnableIT_TXE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 924 {
Kojto 158:b23ee177fd68 925 SET_BIT(SPIx->CR2, SPI_CR2_TXEIE);
Kojto 158:b23ee177fd68 926 }
Kojto 158:b23ee177fd68 927
Kojto 158:b23ee177fd68 928 /**
Kojto 158:b23ee177fd68 929 * @brief Disable error interrupt
Kojto 158:b23ee177fd68 930 * @note This bit controls the generation of an interrupt when an error condition occurs (CRCERR, OVR, MODF in SPI mode, FRE at TI mode).
Kojto 158:b23ee177fd68 931 * @rmtoll CR2 ERRIE LL_SPI_DisableIT_ERR
Kojto 158:b23ee177fd68 932 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 933 * @retval None
Kojto 158:b23ee177fd68 934 */
Kojto 158:b23ee177fd68 935 __STATIC_INLINE void LL_SPI_DisableIT_ERR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 936 {
Kojto 158:b23ee177fd68 937 CLEAR_BIT(SPIx->CR2, SPI_CR2_ERRIE);
Kojto 158:b23ee177fd68 938 }
Kojto 158:b23ee177fd68 939
Kojto 158:b23ee177fd68 940 /**
Kojto 158:b23ee177fd68 941 * @brief Disable Rx buffer not empty interrupt
Kojto 158:b23ee177fd68 942 * @rmtoll CR2 RXNEIE LL_SPI_DisableIT_RXNE
Kojto 158:b23ee177fd68 943 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 944 * @retval None
Kojto 158:b23ee177fd68 945 */
Kojto 158:b23ee177fd68 946 __STATIC_INLINE void LL_SPI_DisableIT_RXNE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 947 {
Kojto 158:b23ee177fd68 948 CLEAR_BIT(SPIx->CR2, SPI_CR2_RXNEIE);
Kojto 158:b23ee177fd68 949 }
Kojto 158:b23ee177fd68 950
Kojto 158:b23ee177fd68 951 /**
Kojto 158:b23ee177fd68 952 * @brief Disable Tx buffer empty interrupt
Kojto 158:b23ee177fd68 953 * @rmtoll CR2 TXEIE LL_SPI_DisableIT_TXE
Kojto 158:b23ee177fd68 954 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 955 * @retval None
Kojto 158:b23ee177fd68 956 */
Kojto 158:b23ee177fd68 957 __STATIC_INLINE void LL_SPI_DisableIT_TXE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 958 {
Kojto 158:b23ee177fd68 959 CLEAR_BIT(SPIx->CR2, SPI_CR2_TXEIE);
Kojto 158:b23ee177fd68 960 }
Kojto 158:b23ee177fd68 961
Kojto 158:b23ee177fd68 962 /**
Kojto 158:b23ee177fd68 963 * @brief Check if error interrupt is enabled
Kojto 158:b23ee177fd68 964 * @rmtoll CR2 ERRIE LL_SPI_IsEnabledIT_ERR
Kojto 158:b23ee177fd68 965 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 966 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 967 */
Kojto 158:b23ee177fd68 968 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_ERR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 969 {
Kojto 158:b23ee177fd68 970 return (READ_BIT(SPIx->CR2, SPI_CR2_ERRIE) == (SPI_CR2_ERRIE));
Kojto 158:b23ee177fd68 971 }
Kojto 158:b23ee177fd68 972
Kojto 158:b23ee177fd68 973 /**
Kojto 158:b23ee177fd68 974 * @brief Check if Rx buffer not empty interrupt is enabled
Kojto 158:b23ee177fd68 975 * @rmtoll CR2 RXNEIE LL_SPI_IsEnabledIT_RXNE
Kojto 158:b23ee177fd68 976 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 977 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 978 */
Kojto 158:b23ee177fd68 979 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_RXNE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 980 {
Kojto 158:b23ee177fd68 981 return (READ_BIT(SPIx->CR2, SPI_CR2_RXNEIE) == (SPI_CR2_RXNEIE));
Kojto 158:b23ee177fd68 982 }
Kojto 158:b23ee177fd68 983
Kojto 158:b23ee177fd68 984 /**
Kojto 158:b23ee177fd68 985 * @brief Check if Tx buffer empty interrupt
Kojto 158:b23ee177fd68 986 * @rmtoll CR2 TXEIE LL_SPI_IsEnabledIT_TXE
Kojto 158:b23ee177fd68 987 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 988 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 989 */
Kojto 158:b23ee177fd68 990 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_TXE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 991 {
Kojto 158:b23ee177fd68 992 return (READ_BIT(SPIx->CR2, SPI_CR2_TXEIE) == (SPI_CR2_TXEIE));
Kojto 158:b23ee177fd68 993 }
Kojto 158:b23ee177fd68 994
Kojto 158:b23ee177fd68 995 /**
Kojto 158:b23ee177fd68 996 * @}
Kojto 158:b23ee177fd68 997 */
Kojto 158:b23ee177fd68 998
Kojto 158:b23ee177fd68 999 /** @defgroup SPI_LL_EF_DMA_Management DMA Management
Kojto 158:b23ee177fd68 1000 * @{
Kojto 158:b23ee177fd68 1001 */
Kojto 158:b23ee177fd68 1002
Kojto 158:b23ee177fd68 1003 /**
Kojto 158:b23ee177fd68 1004 * @brief Enable DMA Rx
Kojto 158:b23ee177fd68 1005 * @rmtoll CR2 RXDMAEN LL_SPI_EnableDMAReq_RX
Kojto 158:b23ee177fd68 1006 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1007 * @retval None
Kojto 158:b23ee177fd68 1008 */
Kojto 158:b23ee177fd68 1009 __STATIC_INLINE void LL_SPI_EnableDMAReq_RX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1010 {
Kojto 158:b23ee177fd68 1011 SET_BIT(SPIx->CR2, SPI_CR2_RXDMAEN);
Kojto 158:b23ee177fd68 1012 }
Kojto 158:b23ee177fd68 1013
Kojto 158:b23ee177fd68 1014 /**
Kojto 158:b23ee177fd68 1015 * @brief Disable DMA Rx
Kojto 158:b23ee177fd68 1016 * @rmtoll CR2 RXDMAEN LL_SPI_DisableDMAReq_RX
Kojto 158:b23ee177fd68 1017 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1018 * @retval None
Kojto 158:b23ee177fd68 1019 */
Kojto 158:b23ee177fd68 1020 __STATIC_INLINE void LL_SPI_DisableDMAReq_RX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1021 {
Kojto 158:b23ee177fd68 1022 CLEAR_BIT(SPIx->CR2, SPI_CR2_RXDMAEN);
Kojto 158:b23ee177fd68 1023 }
Kojto 158:b23ee177fd68 1024
Kojto 158:b23ee177fd68 1025 /**
Kojto 158:b23ee177fd68 1026 * @brief Check if DMA Rx is enabled
Kojto 158:b23ee177fd68 1027 * @rmtoll CR2 RXDMAEN LL_SPI_IsEnabledDMAReq_RX
Kojto 158:b23ee177fd68 1028 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1029 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1030 */
Kojto 158:b23ee177fd68 1031 __STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_RX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1032 {
Kojto 158:b23ee177fd68 1033 return (READ_BIT(SPIx->CR2, SPI_CR2_RXDMAEN) == (SPI_CR2_RXDMAEN));
Kojto 158:b23ee177fd68 1034 }
Kojto 158:b23ee177fd68 1035
Kojto 158:b23ee177fd68 1036 /**
Kojto 158:b23ee177fd68 1037 * @brief Enable DMA Tx
Kojto 158:b23ee177fd68 1038 * @rmtoll CR2 TXDMAEN LL_SPI_EnableDMAReq_TX
Kojto 158:b23ee177fd68 1039 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1040 * @retval None
Kojto 158:b23ee177fd68 1041 */
Kojto 158:b23ee177fd68 1042 __STATIC_INLINE void LL_SPI_EnableDMAReq_TX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1043 {
Kojto 158:b23ee177fd68 1044 SET_BIT(SPIx->CR2, SPI_CR2_TXDMAEN);
Kojto 158:b23ee177fd68 1045 }
Kojto 158:b23ee177fd68 1046
Kojto 158:b23ee177fd68 1047 /**
Kojto 158:b23ee177fd68 1048 * @brief Disable DMA Tx
Kojto 158:b23ee177fd68 1049 * @rmtoll CR2 TXDMAEN LL_SPI_DisableDMAReq_TX
Kojto 158:b23ee177fd68 1050 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1051 * @retval None
Kojto 158:b23ee177fd68 1052 */
Kojto 158:b23ee177fd68 1053 __STATIC_INLINE void LL_SPI_DisableDMAReq_TX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1054 {
Kojto 158:b23ee177fd68 1055 CLEAR_BIT(SPIx->CR2, SPI_CR2_TXDMAEN);
Kojto 158:b23ee177fd68 1056 }
Kojto 158:b23ee177fd68 1057
Kojto 158:b23ee177fd68 1058 /**
Kojto 158:b23ee177fd68 1059 * @brief Check if DMA Tx is enabled
Kojto 158:b23ee177fd68 1060 * @rmtoll CR2 TXDMAEN LL_SPI_IsEnabledDMAReq_TX
Kojto 158:b23ee177fd68 1061 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1062 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1063 */
Kojto 158:b23ee177fd68 1064 __STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_TX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1065 {
Kojto 158:b23ee177fd68 1066 return (READ_BIT(SPIx->CR2, SPI_CR2_TXDMAEN) == (SPI_CR2_TXDMAEN));
Kojto 158:b23ee177fd68 1067 }
Kojto 158:b23ee177fd68 1068
Kojto 158:b23ee177fd68 1069 /**
Kojto 158:b23ee177fd68 1070 * @brief Get the data register address used for DMA transfer
Kojto 158:b23ee177fd68 1071 * @rmtoll DR DR LL_SPI_DMA_GetRegAddr
Kojto 158:b23ee177fd68 1072 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1073 * @retval Address of data register
Kojto 158:b23ee177fd68 1074 */
Kojto 158:b23ee177fd68 1075 __STATIC_INLINE uint32_t LL_SPI_DMA_GetRegAddr(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1076 {
Kojto 158:b23ee177fd68 1077 return (uint32_t) & (SPIx->DR);
Kojto 158:b23ee177fd68 1078 }
Kojto 158:b23ee177fd68 1079
Kojto 158:b23ee177fd68 1080 /**
Kojto 158:b23ee177fd68 1081 * @}
Kojto 158:b23ee177fd68 1082 */
Kojto 158:b23ee177fd68 1083
Kojto 158:b23ee177fd68 1084 /** @defgroup SPI_LL_EF_DATA_Management DATA Management
Kojto 158:b23ee177fd68 1085 * @{
Kojto 158:b23ee177fd68 1086 */
Kojto 158:b23ee177fd68 1087
Kojto 158:b23ee177fd68 1088 /**
Kojto 158:b23ee177fd68 1089 * @brief Read 8-Bits in the data register
Kojto 158:b23ee177fd68 1090 * @rmtoll DR DR LL_SPI_ReceiveData8
Kojto 158:b23ee177fd68 1091 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1092 * @retval RxData Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 158:b23ee177fd68 1093 */
Kojto 158:b23ee177fd68 1094 __STATIC_INLINE uint8_t LL_SPI_ReceiveData8(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1095 {
Kojto 158:b23ee177fd68 1096 return (uint8_t)(READ_REG(SPIx->DR));
Kojto 158:b23ee177fd68 1097 }
Kojto 158:b23ee177fd68 1098
Kojto 158:b23ee177fd68 1099 /**
Kojto 158:b23ee177fd68 1100 * @brief Read 16-Bits in the data register
Kojto 158:b23ee177fd68 1101 * @rmtoll DR DR LL_SPI_ReceiveData16
Kojto 158:b23ee177fd68 1102 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1103 * @retval RxData Value between Min_Data=0x00 and Max_Data=0xFFFF
Kojto 158:b23ee177fd68 1104 */
Kojto 158:b23ee177fd68 1105 __STATIC_INLINE uint16_t LL_SPI_ReceiveData16(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1106 {
Kojto 158:b23ee177fd68 1107 return (uint16_t)(READ_REG(SPIx->DR));
Kojto 158:b23ee177fd68 1108 }
Kojto 158:b23ee177fd68 1109
Kojto 158:b23ee177fd68 1110 /**
Kojto 158:b23ee177fd68 1111 * @brief Write 8-Bits in the data register
Kojto 158:b23ee177fd68 1112 * @rmtoll DR DR LL_SPI_TransmitData8
Kojto 158:b23ee177fd68 1113 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1114 * @param TxData Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 158:b23ee177fd68 1115 * @retval None
Kojto 158:b23ee177fd68 1116 */
Kojto 158:b23ee177fd68 1117 __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
Kojto 158:b23ee177fd68 1118 {
Kojto 158:b23ee177fd68 1119 *((__IO uint8_t *)&SPIx->DR) = TxData;
Kojto 158:b23ee177fd68 1120 }
Kojto 158:b23ee177fd68 1121
Anna Bridge 186:707f6e361f3e 1122 #if __GNUC__
Anna Bridge 186:707f6e361f3e 1123 # define MAY_ALIAS __attribute__ ((__may_alias__))
Anna Bridge 186:707f6e361f3e 1124 #else
Anna Bridge 186:707f6e361f3e 1125 # define MAY_ALIAS
Anna Bridge 186:707f6e361f3e 1126 #endif
Anna Bridge 186:707f6e361f3e 1127
Anna Bridge 186:707f6e361f3e 1128 typedef __IO uint16_t MAY_ALIAS uint16_io_t;
Anna Bridge 186:707f6e361f3e 1129
Kojto 158:b23ee177fd68 1130 /**
Kojto 158:b23ee177fd68 1131 * @brief Write 16-Bits in the data register
Kojto 158:b23ee177fd68 1132 * @rmtoll DR DR LL_SPI_TransmitData16
Kojto 158:b23ee177fd68 1133 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1134 * @param TxData Value between Min_Data=0x00 and Max_Data=0xFFFF
Kojto 158:b23ee177fd68 1135 * @retval None
Kojto 158:b23ee177fd68 1136 */
Kojto 158:b23ee177fd68 1137 __STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
Kojto 158:b23ee177fd68 1138 {
Anna Bridge 186:707f6e361f3e 1139 *((uint16_io_t*)&SPIx->DR) = TxData;
Kojto 158:b23ee177fd68 1140 }
Kojto 158:b23ee177fd68 1141
Kojto 158:b23ee177fd68 1142 /**
Kojto 158:b23ee177fd68 1143 * @}
Kojto 158:b23ee177fd68 1144 */
Kojto 158:b23ee177fd68 1145 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 1146 /** @defgroup SPI_LL_EF_Init Initialization and de-initialization functions
Kojto 158:b23ee177fd68 1147 * @{
Kojto 158:b23ee177fd68 1148 */
Kojto 158:b23ee177fd68 1149
Kojto 158:b23ee177fd68 1150 ErrorStatus LL_SPI_DeInit(SPI_TypeDef *SPIx);
Kojto 158:b23ee177fd68 1151 ErrorStatus LL_SPI_Init(SPI_TypeDef *SPIx, LL_SPI_InitTypeDef *SPI_InitStruct);
Kojto 158:b23ee177fd68 1152 void LL_SPI_StructInit(LL_SPI_InitTypeDef *SPI_InitStruct);
Kojto 158:b23ee177fd68 1153
Kojto 158:b23ee177fd68 1154 /**
Kojto 158:b23ee177fd68 1155 * @}
Kojto 158:b23ee177fd68 1156 */
Kojto 158:b23ee177fd68 1157 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 1158 /**
Kojto 158:b23ee177fd68 1159 * @}
Kojto 158:b23ee177fd68 1160 */
Kojto 158:b23ee177fd68 1161
Kojto 158:b23ee177fd68 1162 /**
Kojto 158:b23ee177fd68 1163 * @}
Kojto 158:b23ee177fd68 1164 */
Kojto 158:b23ee177fd68 1165
Kojto 158:b23ee177fd68 1166 #if defined(SPI_I2S_SUPPORT)
Kojto 158:b23ee177fd68 1167 /** @defgroup I2S_LL I2S
Kojto 158:b23ee177fd68 1168 * @{
Kojto 158:b23ee177fd68 1169 */
Kojto 158:b23ee177fd68 1170
Kojto 158:b23ee177fd68 1171 /* Private variables ---------------------------------------------------------*/
Kojto 158:b23ee177fd68 1172 /* Private constants ---------------------------------------------------------*/
Kojto 158:b23ee177fd68 1173 /* Private macros ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 1174
Kojto 158:b23ee177fd68 1175 /* Exported types ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 1176 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 1177 /** @defgroup I2S_LL_ES_INIT I2S Exported Init structure
Kojto 158:b23ee177fd68 1178 * @{
Kojto 158:b23ee177fd68 1179 */
Kojto 158:b23ee177fd68 1180
Kojto 158:b23ee177fd68 1181 /**
Kojto 158:b23ee177fd68 1182 * @brief I2S Init structure definition
Kojto 158:b23ee177fd68 1183 */
Kojto 158:b23ee177fd68 1184
Kojto 158:b23ee177fd68 1185 typedef struct
Kojto 158:b23ee177fd68 1186 {
Kojto 158:b23ee177fd68 1187 uint32_t Mode; /*!< Specifies the I2S operating mode.
Kojto 158:b23ee177fd68 1188 This parameter can be a value of @ref I2S_LL_EC_MODE
Kojto 158:b23ee177fd68 1189
Kojto 158:b23ee177fd68 1190 This feature can be modified afterwards using unitary function @ref LL_I2S_SetTransferMode().*/
Kojto 158:b23ee177fd68 1191
Kojto 158:b23ee177fd68 1192 uint32_t Standard; /*!< Specifies the standard used for the I2S communication.
Kojto 158:b23ee177fd68 1193 This parameter can be a value of @ref I2S_LL_EC_STANDARD
Kojto 158:b23ee177fd68 1194
Kojto 158:b23ee177fd68 1195 This feature can be modified afterwards using unitary function @ref LL_I2S_SetStandard().*/
Kojto 158:b23ee177fd68 1196
Kojto 158:b23ee177fd68 1197
Kojto 158:b23ee177fd68 1198 uint32_t DataFormat; /*!< Specifies the data format for the I2S communication.
Kojto 158:b23ee177fd68 1199 This parameter can be a value of @ref I2S_LL_EC_DATA_FORMAT
Kojto 158:b23ee177fd68 1200
Kojto 158:b23ee177fd68 1201 This feature can be modified afterwards using unitary function @ref LL_I2S_SetDataFormat().*/
Kojto 158:b23ee177fd68 1202
Kojto 158:b23ee177fd68 1203
Kojto 158:b23ee177fd68 1204 uint32_t MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not.
Kojto 158:b23ee177fd68 1205 This parameter can be a value of @ref I2S_LL_EC_MCLK_OUTPUT
Kojto 158:b23ee177fd68 1206
Kojto 158:b23ee177fd68 1207 This feature can be modified afterwards using unitary functions @ref LL_I2S_EnableMasterClock() or @ref LL_I2S_DisableMasterClock.*/
Kojto 158:b23ee177fd68 1208
Kojto 158:b23ee177fd68 1209
Kojto 158:b23ee177fd68 1210 uint32_t AudioFreq; /*!< Specifies the frequency selected for the I2S communication.
Kojto 158:b23ee177fd68 1211 This parameter can be a value of @ref I2S_LL_EC_AUDIO_FREQ
Kojto 158:b23ee177fd68 1212
Kojto 158:b23ee177fd68 1213 Audio Frequency can be modified afterwards using Reference manual formulas to calculate Prescaler Linear, Parity
Kojto 158:b23ee177fd68 1214 and unitary functions @ref LL_I2S_SetPrescalerLinear() and @ref LL_I2S_SetPrescalerParity() to set it.*/
Kojto 158:b23ee177fd68 1215
Kojto 158:b23ee177fd68 1216
Kojto 158:b23ee177fd68 1217 uint32_t ClockPolarity; /*!< Specifies the idle state of the I2S clock.
Kojto 158:b23ee177fd68 1218 This parameter can be a value of @ref I2S_LL_EC_POLARITY
Kojto 158:b23ee177fd68 1219
Kojto 158:b23ee177fd68 1220 This feature can be modified afterwards using unitary function @ref LL_I2S_SetClockPolarity().*/
Kojto 158:b23ee177fd68 1221
Kojto 158:b23ee177fd68 1222 } LL_I2S_InitTypeDef;
Kojto 158:b23ee177fd68 1223
Kojto 158:b23ee177fd68 1224 /**
Kojto 158:b23ee177fd68 1225 * @}
Kojto 158:b23ee177fd68 1226 */
Kojto 158:b23ee177fd68 1227 #endif /*USE_FULL_LL_DRIVER*/
Kojto 158:b23ee177fd68 1228
Kojto 158:b23ee177fd68 1229 /* Exported constants --------------------------------------------------------*/
Kojto 158:b23ee177fd68 1230 /** @defgroup I2S_LL_Exported_Constants I2S Exported Constants
Kojto 158:b23ee177fd68 1231 * @{
Kojto 158:b23ee177fd68 1232 */
Kojto 158:b23ee177fd68 1233
Kojto 158:b23ee177fd68 1234 /** @defgroup I2S_LL_EC_GET_FLAG Get Flags Defines
Kojto 158:b23ee177fd68 1235 * @brief Flags defines which can be used with LL_I2S_ReadReg function
Kojto 158:b23ee177fd68 1236 * @{
Kojto 158:b23ee177fd68 1237 */
Kojto 158:b23ee177fd68 1238 #define LL_I2S_SR_RXNE LL_SPI_SR_RXNE /*!< Rx buffer not empty flag */
Kojto 158:b23ee177fd68 1239 #define LL_I2S_SR_TXE LL_SPI_SR_TXE /*!< Tx buffer empty flag */
Kojto 158:b23ee177fd68 1240 #define LL_I2S_SR_BSY LL_SPI_SR_BSY /*!< Busy flag */
Kojto 158:b23ee177fd68 1241 #define LL_I2S_SR_UDR LL_SPI_SR_UDR /*!< Underrun flag */
Kojto 158:b23ee177fd68 1242 #define LL_I2S_SR_OVR LL_SPI_SR_OVR /*!< Overrun flag */
Kojto 158:b23ee177fd68 1243 #define LL_I2S_SR_FRE LL_SPI_SR_FRE /*!< TI mode frame format error flag */
Kojto 158:b23ee177fd68 1244 /**
Kojto 158:b23ee177fd68 1245 * @}
Kojto 158:b23ee177fd68 1246 */
Kojto 158:b23ee177fd68 1247
Kojto 158:b23ee177fd68 1248 /** @defgroup SPI_LL_EC_IT IT Defines
Kojto 158:b23ee177fd68 1249 * @brief IT defines which can be used with LL_SPI_ReadReg and LL_SPI_WriteReg functions
Kojto 158:b23ee177fd68 1250 * @{
Kojto 158:b23ee177fd68 1251 */
Kojto 158:b23ee177fd68 1252 #define LL_I2S_CR2_RXNEIE LL_SPI_CR2_RXNEIE /*!< Rx buffer not empty interrupt enable */
Kojto 158:b23ee177fd68 1253 #define LL_I2S_CR2_TXEIE LL_SPI_CR2_TXEIE /*!< Tx buffer empty interrupt enable */
Kojto 158:b23ee177fd68 1254 #define LL_I2S_CR2_ERRIE LL_SPI_CR2_ERRIE /*!< Error interrupt enable */
Kojto 158:b23ee177fd68 1255 /**
Kojto 158:b23ee177fd68 1256 * @}
Kojto 158:b23ee177fd68 1257 */
Kojto 158:b23ee177fd68 1258
Kojto 158:b23ee177fd68 1259 /** @defgroup I2S_LL_EC_DATA_FORMAT Data format
Kojto 158:b23ee177fd68 1260 * @{
Kojto 158:b23ee177fd68 1261 */
Kojto 158:b23ee177fd68 1262 #define LL_I2S_DATAFORMAT_16B ((uint32_t)0x00000000U) /*!< Data length 16 bits, Channel lenght 16bit */
Kojto 158:b23ee177fd68 1263 #define LL_I2S_DATAFORMAT_16B_EXTENDED (SPI_I2SCFGR_CHLEN) /*!< Data length 16 bits, Channel lenght 32bit */
Kojto 158:b23ee177fd68 1264 #define LL_I2S_DATAFORMAT_24B (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_0) /*!< Data length 24 bits, Channel lenght 32bit */
Kojto 158:b23ee177fd68 1265 #define LL_I2S_DATAFORMAT_32B (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_1) /*!< Data length 16 bits, Channel lenght 32bit */
Kojto 158:b23ee177fd68 1266 /**
Kojto 158:b23ee177fd68 1267 * @}
Kojto 158:b23ee177fd68 1268 */
Kojto 158:b23ee177fd68 1269
Kojto 158:b23ee177fd68 1270 /** @defgroup I2S_LL_EC_POLARITY Clock Polarity
Kojto 158:b23ee177fd68 1271 * @{
Kojto 158:b23ee177fd68 1272 */
Kojto 158:b23ee177fd68 1273 #define LL_I2S_POLARITY_LOW ((uint32_t)0x00000000U) /*!< Clock steady state is low level */
Kojto 158:b23ee177fd68 1274 #define LL_I2S_POLARITY_HIGH (SPI_I2SCFGR_CKPOL) /*!< Clock steady state is high level */
Kojto 158:b23ee177fd68 1275 /**
Kojto 158:b23ee177fd68 1276 * @}
Kojto 158:b23ee177fd68 1277 */
Kojto 158:b23ee177fd68 1278
Kojto 158:b23ee177fd68 1279 /** @defgroup I2S_LL_EC_STANDARD I2s Standard
Kojto 158:b23ee177fd68 1280 * @{
Kojto 158:b23ee177fd68 1281 */
Kojto 158:b23ee177fd68 1282 #define LL_I2S_STANDARD_PHILIPS ((uint32_t)0x00000000U) /*!< I2S standard philips */
Kojto 158:b23ee177fd68 1283 #define LL_I2S_STANDARD_MSB (SPI_I2SCFGR_I2SSTD_0) /*!< MSB justified standard (left justified) */
Kojto 158:b23ee177fd68 1284 #define LL_I2S_STANDARD_LSB (SPI_I2SCFGR_I2SSTD_1) /*!< LSB justified standard (right justified) */
Kojto 158:b23ee177fd68 1285 #define LL_I2S_STANDARD_PCM_SHORT (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1) /*!< PCM standard, short frame synchronization */
Kojto 158:b23ee177fd68 1286 #define LL_I2S_STANDARD_PCM_LONG (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1 | SPI_I2SCFGR_PCMSYNC) /*!< PCM standard, long frame synchronization */
Kojto 158:b23ee177fd68 1287 /**
Kojto 158:b23ee177fd68 1288 * @}
Kojto 158:b23ee177fd68 1289 */
Kojto 158:b23ee177fd68 1290
Kojto 158:b23ee177fd68 1291 /** @defgroup I2S_LL_EC_MODE Operation Mode
Kojto 158:b23ee177fd68 1292 * @{
Kojto 158:b23ee177fd68 1293 */
Kojto 158:b23ee177fd68 1294 #define LL_I2S_MODE_SLAVE_TX ((uint32_t)0x00000000U) /*!< Slave Tx configuration */
Kojto 158:b23ee177fd68 1295 #define LL_I2S_MODE_SLAVE_RX (SPI_I2SCFGR_I2SCFG_0) /*!< Slave Rx configuration */
Kojto 158:b23ee177fd68 1296 #define LL_I2S_MODE_MASTER_TX (SPI_I2SCFGR_I2SCFG_1) /*!< Master Tx configuration */
Kojto 158:b23ee177fd68 1297 #define LL_I2S_MODE_MASTER_RX (SPI_I2SCFGR_I2SCFG_0 | SPI_I2SCFGR_I2SCFG_1) /*!< Master Rx configuration */
Kojto 158:b23ee177fd68 1298 /**
Kojto 158:b23ee177fd68 1299 * @}
Kojto 158:b23ee177fd68 1300 */
Kojto 158:b23ee177fd68 1301
Kojto 158:b23ee177fd68 1302 /** @defgroup I2S_LL_EC_PRESCALER_FACTOR Prescaler Factor
Kojto 158:b23ee177fd68 1303 * @{
Kojto 158:b23ee177fd68 1304 */
Kojto 158:b23ee177fd68 1305 #define LL_I2S_PRESCALER_PARITY_EVEN ((uint32_t)0x00000000U) /*!< Odd factor: Real divider value is = I2SDIV * 2 */
Kojto 158:b23ee177fd68 1306 #define LL_I2S_PRESCALER_PARITY_ODD (SPI_I2SPR_ODD >> 8U) /*!< Odd factor: Real divider value is = (I2SDIV * 2)+1 */
Kojto 158:b23ee177fd68 1307 /**
Kojto 158:b23ee177fd68 1308 * @}
Kojto 158:b23ee177fd68 1309 */
Kojto 158:b23ee177fd68 1310
Kojto 158:b23ee177fd68 1311 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 1312
Kojto 158:b23ee177fd68 1313 /** @defgroup I2S_LL_EC_MCLK_OUTPUT MCLK Output
Kojto 158:b23ee177fd68 1314 * @{
Kojto 158:b23ee177fd68 1315 */
Kojto 158:b23ee177fd68 1316 #define LL_I2S_MCLK_OUTPUT_DISABLE ((uint32_t)0x00000000U) /*!< Master clock output is disabled */
Kojto 158:b23ee177fd68 1317 #define LL_I2S_MCLK_OUTPUT_ENABLE (SPI_I2SPR_MCKOE) /*!< Master clock output is enabled */
Kojto 158:b23ee177fd68 1318 /**
Kojto 158:b23ee177fd68 1319 * @}
Kojto 158:b23ee177fd68 1320 */
Kojto 158:b23ee177fd68 1321
Kojto 158:b23ee177fd68 1322 /** @defgroup I2S_LL_EC_AUDIO_FREQ Audio Frequency
Kojto 158:b23ee177fd68 1323 * @{
Kojto 158:b23ee177fd68 1324 */
Kojto 158:b23ee177fd68 1325
Kojto 158:b23ee177fd68 1326 #define LL_I2S_AUDIOFREQ_192K ((uint32_t)192000) /*!< Audio Frequency configuration 192000 Hz */
Kojto 158:b23ee177fd68 1327 #define LL_I2S_AUDIOFREQ_96K ((uint32_t) 96000) /*!< Audio Frequency configuration 96000 Hz */
Kojto 158:b23ee177fd68 1328 #define LL_I2S_AUDIOFREQ_48K ((uint32_t) 48000) /*!< Audio Frequency configuration 48000 Hz */
Kojto 158:b23ee177fd68 1329 #define LL_I2S_AUDIOFREQ_44K ((uint32_t) 44100) /*!< Audio Frequency configuration 44100 Hz */
Kojto 158:b23ee177fd68 1330 #define LL_I2S_AUDIOFREQ_32K ((uint32_t) 32000) /*!< Audio Frequency configuration 32000 Hz */
Kojto 158:b23ee177fd68 1331 #define LL_I2S_AUDIOFREQ_22K ((uint32_t) 22050) /*!< Audio Frequency configuration 22050 Hz */
Kojto 158:b23ee177fd68 1332 #define LL_I2S_AUDIOFREQ_16K ((uint32_t) 16000) /*!< Audio Frequency configuration 16000 Hz */
Kojto 158:b23ee177fd68 1333 #define LL_I2S_AUDIOFREQ_11K ((uint32_t) 11025) /*!< Audio Frequency configuration 11025 Hz */
Kojto 158:b23ee177fd68 1334 #define LL_I2S_AUDIOFREQ_8K ((uint32_t) 8000) /*!< Audio Frequency configuration 8000 Hz */
Kojto 158:b23ee177fd68 1335 #define LL_I2S_AUDIOFREQ_DEFAULT ((uint32_t) 2) /*!< Audio Freq not specified. Register I2SDIV = 2 */
Kojto 158:b23ee177fd68 1336 /**
Kojto 158:b23ee177fd68 1337 * @}
Kojto 158:b23ee177fd68 1338 */
Kojto 158:b23ee177fd68 1339 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 1340
Kojto 158:b23ee177fd68 1341 /**
Kojto 158:b23ee177fd68 1342 * @}
Kojto 158:b23ee177fd68 1343 */
Kojto 158:b23ee177fd68 1344
Kojto 158:b23ee177fd68 1345 /* Exported macro ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 1346 /** @defgroup I2S_LL_Exported_Macros I2S Exported Macros
Kojto 158:b23ee177fd68 1347 * @{
Kojto 158:b23ee177fd68 1348 */
Kojto 158:b23ee177fd68 1349
Kojto 158:b23ee177fd68 1350 /** @defgroup I2S_LL_EM_WRITE_READ Common Write and read registers Macros
Kojto 158:b23ee177fd68 1351 * @{
Kojto 158:b23ee177fd68 1352 */
Kojto 158:b23ee177fd68 1353
Kojto 158:b23ee177fd68 1354 /**
Kojto 158:b23ee177fd68 1355 * @brief Write a value in I2S register
Kojto 158:b23ee177fd68 1356 * @param __INSTANCE__ I2S Instance
Kojto 158:b23ee177fd68 1357 * @param __REG__ Register to be written
Kojto 158:b23ee177fd68 1358 * @param __VALUE__ Value to be written in the register
Kojto 158:b23ee177fd68 1359 * @retval None
Kojto 158:b23ee177fd68 1360 */
Kojto 158:b23ee177fd68 1361 #define LL_I2S_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 158:b23ee177fd68 1362
Kojto 158:b23ee177fd68 1363 /**
Kojto 158:b23ee177fd68 1364 * @brief Read a value in I2S register
Kojto 158:b23ee177fd68 1365 * @param __INSTANCE__ I2S Instance
Kojto 158:b23ee177fd68 1366 * @param __REG__ Register to be read
Kojto 158:b23ee177fd68 1367 * @retval Register value
Kojto 158:b23ee177fd68 1368 */
Kojto 158:b23ee177fd68 1369 #define LL_I2S_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 158:b23ee177fd68 1370 /**
Kojto 158:b23ee177fd68 1371 * @}
Kojto 158:b23ee177fd68 1372 */
Kojto 158:b23ee177fd68 1373
Kojto 158:b23ee177fd68 1374 /**
Kojto 158:b23ee177fd68 1375 * @}
Kojto 158:b23ee177fd68 1376 */
Kojto 158:b23ee177fd68 1377
Kojto 158:b23ee177fd68 1378
Kojto 158:b23ee177fd68 1379 /* Exported functions --------------------------------------------------------*/
Kojto 158:b23ee177fd68 1380
Kojto 158:b23ee177fd68 1381 /** @defgroup I2S_LL_Exported_Functions I2S Exported Functions
Kojto 158:b23ee177fd68 1382 * @{
Kojto 158:b23ee177fd68 1383 */
Kojto 158:b23ee177fd68 1384
Kojto 158:b23ee177fd68 1385 /** @defgroup I2S_LL_EF_Configuration Configuration
Kojto 158:b23ee177fd68 1386 * @{
Kojto 158:b23ee177fd68 1387 */
Kojto 158:b23ee177fd68 1388
Kojto 158:b23ee177fd68 1389 /**
Kojto 158:b23ee177fd68 1390 * @brief Select I2S mode and Enable I2S peripheral
Kojto 158:b23ee177fd68 1391 * @rmtoll I2SCFGR I2SMOD LL_I2S_Enable\n
Kojto 158:b23ee177fd68 1392 * I2SCFGR I2SE LL_I2S_Enable
Kojto 158:b23ee177fd68 1393 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1394 * @retval None
Kojto 158:b23ee177fd68 1395 */
Kojto 158:b23ee177fd68 1396 __STATIC_INLINE void LL_I2S_Enable(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1397 {
Kojto 158:b23ee177fd68 1398 SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD | SPI_I2SCFGR_I2SE);
Kojto 158:b23ee177fd68 1399 }
Kojto 158:b23ee177fd68 1400
Kojto 158:b23ee177fd68 1401 /**
Kojto 158:b23ee177fd68 1402 * @brief Disable I2S peripheral
Kojto 158:b23ee177fd68 1403 * @rmtoll I2SCFGR I2SE LL_I2S_Disable
Kojto 158:b23ee177fd68 1404 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1405 * @retval None
Kojto 158:b23ee177fd68 1406 */
Kojto 158:b23ee177fd68 1407 __STATIC_INLINE void LL_I2S_Disable(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1408 {
Kojto 158:b23ee177fd68 1409 CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD | SPI_I2SCFGR_I2SE);
Kojto 158:b23ee177fd68 1410 }
Kojto 158:b23ee177fd68 1411
Kojto 158:b23ee177fd68 1412 /**
Kojto 158:b23ee177fd68 1413 * @brief Check if I2S peripheral is enabled
Kojto 158:b23ee177fd68 1414 * @rmtoll I2SCFGR I2SE LL_I2S_IsEnabled
Kojto 158:b23ee177fd68 1415 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1416 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1417 */
Kojto 158:b23ee177fd68 1418 __STATIC_INLINE uint32_t LL_I2S_IsEnabled(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1419 {
Kojto 158:b23ee177fd68 1420 return (READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SE) == (SPI_I2SCFGR_I2SE));
Kojto 158:b23ee177fd68 1421 }
Kojto 158:b23ee177fd68 1422
Kojto 158:b23ee177fd68 1423 /**
Anna Bridge 186:707f6e361f3e 1424 * @brief Set I2S data frame length
Kojto 158:b23ee177fd68 1425 * @rmtoll I2SCFGR DATLEN LL_I2S_SetDataFormat\n
Kojto 158:b23ee177fd68 1426 * I2SCFGR CHLEN LL_I2S_SetDataFormat
Kojto 158:b23ee177fd68 1427 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1428 * @param DataFormat This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1429 * @arg @ref LL_I2S_DATAFORMAT_16B
Kojto 158:b23ee177fd68 1430 * @arg @ref LL_I2S_DATAFORMAT_16B_EXTENDED
Kojto 158:b23ee177fd68 1431 * @arg @ref LL_I2S_DATAFORMAT_24B
Kojto 158:b23ee177fd68 1432 * @arg @ref LL_I2S_DATAFORMAT_32B
Kojto 158:b23ee177fd68 1433 * @retval None
Kojto 158:b23ee177fd68 1434 */
Kojto 158:b23ee177fd68 1435 __STATIC_INLINE void LL_I2S_SetDataFormat(SPI_TypeDef *SPIx, uint32_t DataFormat)
Kojto 158:b23ee177fd68 1436 {
Kojto 158:b23ee177fd68 1437 MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN, DataFormat);
Kojto 158:b23ee177fd68 1438 }
Kojto 158:b23ee177fd68 1439
Kojto 158:b23ee177fd68 1440 /**
Anna Bridge 186:707f6e361f3e 1441 * @brief Get I2S data frame length
Kojto 158:b23ee177fd68 1442 * @rmtoll I2SCFGR DATLEN LL_I2S_GetDataFormat\n
Kojto 158:b23ee177fd68 1443 * I2SCFGR CHLEN LL_I2S_GetDataFormat
Kojto 158:b23ee177fd68 1444 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1445 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1446 * @arg @ref LL_I2S_DATAFORMAT_16B
Kojto 158:b23ee177fd68 1447 * @arg @ref LL_I2S_DATAFORMAT_16B_EXTENDED
Kojto 158:b23ee177fd68 1448 * @arg @ref LL_I2S_DATAFORMAT_24B
Kojto 158:b23ee177fd68 1449 * @arg @ref LL_I2S_DATAFORMAT_32B
Kojto 158:b23ee177fd68 1450 */
Kojto 158:b23ee177fd68 1451 __STATIC_INLINE uint32_t LL_I2S_GetDataFormat(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1452 {
Kojto 158:b23ee177fd68 1453 return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN));
Kojto 158:b23ee177fd68 1454 }
Kojto 158:b23ee177fd68 1455
Kojto 158:b23ee177fd68 1456 /**
Kojto 158:b23ee177fd68 1457 * @brief Set I2S clock polarity
Kojto 158:b23ee177fd68 1458 * @rmtoll I2SCFGR CKPOL LL_I2S_SetClockPolarity
Kojto 158:b23ee177fd68 1459 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1460 * @param ClockPolarity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1461 * @arg @ref LL_I2S_POLARITY_LOW
Kojto 158:b23ee177fd68 1462 * @arg @ref LL_I2S_POLARITY_HIGH
Kojto 158:b23ee177fd68 1463 * @retval None
Kojto 158:b23ee177fd68 1464 */
Kojto 158:b23ee177fd68 1465 __STATIC_INLINE void LL_I2S_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity)
Kojto 158:b23ee177fd68 1466 {
Kojto 158:b23ee177fd68 1467 SET_BIT(SPIx->I2SCFGR, ClockPolarity);
Kojto 158:b23ee177fd68 1468 }
Kojto 158:b23ee177fd68 1469
Kojto 158:b23ee177fd68 1470 /**
Kojto 158:b23ee177fd68 1471 * @brief Get I2S clock polarity
Kojto 158:b23ee177fd68 1472 * @rmtoll I2SCFGR CKPOL LL_I2S_GetClockPolarity
Kojto 158:b23ee177fd68 1473 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1474 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1475 * @arg @ref LL_I2S_POLARITY_LOW
Kojto 158:b23ee177fd68 1476 * @arg @ref LL_I2S_POLARITY_HIGH
Kojto 158:b23ee177fd68 1477 */
Kojto 158:b23ee177fd68 1478 __STATIC_INLINE uint32_t LL_I2S_GetClockPolarity(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1479 {
Kojto 158:b23ee177fd68 1480 return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_CKPOL));
Kojto 158:b23ee177fd68 1481 }
Kojto 158:b23ee177fd68 1482
Kojto 158:b23ee177fd68 1483 /**
Anna Bridge 186:707f6e361f3e 1484 * @brief Set I2S standard protocol
Kojto 158:b23ee177fd68 1485 * @rmtoll I2SCFGR I2SSTD LL_I2S_SetStandard\n
Kojto 158:b23ee177fd68 1486 * I2SCFGR PCMSYNC LL_I2S_SetStandard
Kojto 158:b23ee177fd68 1487 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1488 * @param Standard This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1489 * @arg @ref LL_I2S_STANDARD_PHILIPS
Kojto 158:b23ee177fd68 1490 * @arg @ref LL_I2S_STANDARD_MSB
Kojto 158:b23ee177fd68 1491 * @arg @ref LL_I2S_STANDARD_LSB
Kojto 158:b23ee177fd68 1492 * @arg @ref LL_I2S_STANDARD_PCM_SHORT
Kojto 158:b23ee177fd68 1493 * @arg @ref LL_I2S_STANDARD_PCM_LONG
Kojto 158:b23ee177fd68 1494 * @retval None
Kojto 158:b23ee177fd68 1495 */
Kojto 158:b23ee177fd68 1496 __STATIC_INLINE void LL_I2S_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard)
Kojto 158:b23ee177fd68 1497 {
Kojto 158:b23ee177fd68 1498 MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC, Standard);
Kojto 158:b23ee177fd68 1499 }
Kojto 158:b23ee177fd68 1500
Kojto 158:b23ee177fd68 1501 /**
Anna Bridge 186:707f6e361f3e 1502 * @brief Get I2S standard protocol
Kojto 158:b23ee177fd68 1503 * @rmtoll I2SCFGR I2SSTD LL_I2S_GetStandard\n
Kojto 158:b23ee177fd68 1504 * I2SCFGR PCMSYNC LL_I2S_GetStandard
Kojto 158:b23ee177fd68 1505 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1506 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1507 * @arg @ref LL_I2S_STANDARD_PHILIPS
Kojto 158:b23ee177fd68 1508 * @arg @ref LL_I2S_STANDARD_MSB
Kojto 158:b23ee177fd68 1509 * @arg @ref LL_I2S_STANDARD_LSB
Kojto 158:b23ee177fd68 1510 * @arg @ref LL_I2S_STANDARD_PCM_SHORT
Kojto 158:b23ee177fd68 1511 * @arg @ref LL_I2S_STANDARD_PCM_LONG
Kojto 158:b23ee177fd68 1512 */
Kojto 158:b23ee177fd68 1513 __STATIC_INLINE uint32_t LL_I2S_GetStandard(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1514 {
Kojto 158:b23ee177fd68 1515 return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC));
Kojto 158:b23ee177fd68 1516 }
Kojto 158:b23ee177fd68 1517
Kojto 158:b23ee177fd68 1518 /**
Anna Bridge 186:707f6e361f3e 1519 * @brief Set I2S transfer mode
Kojto 158:b23ee177fd68 1520 * @rmtoll I2SCFGR I2SCFG LL_I2S_SetTransferMode
Kojto 158:b23ee177fd68 1521 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1522 * @param Mode This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1523 * @arg @ref LL_I2S_MODE_SLAVE_TX
Kojto 158:b23ee177fd68 1524 * @arg @ref LL_I2S_MODE_SLAVE_RX
Kojto 158:b23ee177fd68 1525 * @arg @ref LL_I2S_MODE_MASTER_TX
Kojto 158:b23ee177fd68 1526 * @arg @ref LL_I2S_MODE_MASTER_RX
Kojto 158:b23ee177fd68 1527 * @retval None
Kojto 158:b23ee177fd68 1528 */
Kojto 158:b23ee177fd68 1529 __STATIC_INLINE void LL_I2S_SetTransferMode(SPI_TypeDef *SPIx, uint32_t Mode)
Kojto 158:b23ee177fd68 1530 {
Kojto 158:b23ee177fd68 1531 MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SCFG, Mode);
Kojto 158:b23ee177fd68 1532 }
Kojto 158:b23ee177fd68 1533
Kojto 158:b23ee177fd68 1534 /**
Anna Bridge 186:707f6e361f3e 1535 * @brief Get I2S transfer mode
Kojto 158:b23ee177fd68 1536 * @rmtoll I2SCFGR I2SCFG LL_I2S_GetTransferMode
Kojto 158:b23ee177fd68 1537 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1538 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1539 * @arg @ref LL_I2S_MODE_SLAVE_TX
Kojto 158:b23ee177fd68 1540 * @arg @ref LL_I2S_MODE_SLAVE_RX
Kojto 158:b23ee177fd68 1541 * @arg @ref LL_I2S_MODE_MASTER_TX
Kojto 158:b23ee177fd68 1542 * @arg @ref LL_I2S_MODE_MASTER_RX
Kojto 158:b23ee177fd68 1543 */
Kojto 158:b23ee177fd68 1544 __STATIC_INLINE uint32_t LL_I2S_GetTransferMode(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1545 {
Kojto 158:b23ee177fd68 1546 return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SCFG));
Kojto 158:b23ee177fd68 1547 }
Kojto 158:b23ee177fd68 1548
Kojto 158:b23ee177fd68 1549 /**
Kojto 158:b23ee177fd68 1550 * @brief Set I2S linear prescaler
Kojto 158:b23ee177fd68 1551 * @rmtoll I2SPR I2SDIV LL_I2S_SetPrescalerLinear
Kojto 158:b23ee177fd68 1552 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1553 * @param PrescalerLinear Value between Min_Data=0x02 and Max_Data=0xFF
Kojto 158:b23ee177fd68 1554 * @retval None
Kojto 158:b23ee177fd68 1555 */
Kojto 158:b23ee177fd68 1556 __STATIC_INLINE void LL_I2S_SetPrescalerLinear(SPI_TypeDef *SPIx, uint8_t PrescalerLinear)
Kojto 158:b23ee177fd68 1557 {
Kojto 158:b23ee177fd68 1558 MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_I2SDIV, PrescalerLinear);
Kojto 158:b23ee177fd68 1559 }
Kojto 158:b23ee177fd68 1560
Kojto 158:b23ee177fd68 1561 /**
Kojto 158:b23ee177fd68 1562 * @brief Get I2S linear prescaler
Kojto 158:b23ee177fd68 1563 * @rmtoll I2SPR I2SDIV LL_I2S_GetPrescalerLinear
Kojto 158:b23ee177fd68 1564 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1565 * @retval PrescalerLinear Value between Min_Data=0x02 and Max_Data=0xFF
Kojto 158:b23ee177fd68 1566 */
Kojto 158:b23ee177fd68 1567 __STATIC_INLINE uint32_t LL_I2S_GetPrescalerLinear(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1568 {
Kojto 158:b23ee177fd68 1569 return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_I2SDIV));
Kojto 158:b23ee177fd68 1570 }
Kojto 158:b23ee177fd68 1571
Kojto 158:b23ee177fd68 1572 /**
Kojto 158:b23ee177fd68 1573 * @brief Set I2S parity prescaler
Kojto 158:b23ee177fd68 1574 * @rmtoll I2SPR ODD LL_I2S_SetPrescalerParity
Kojto 158:b23ee177fd68 1575 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1576 * @param PrescalerParity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1577 * @arg @ref LL_I2S_PRESCALER_PARITY_EVEN
Kojto 158:b23ee177fd68 1578 * @arg @ref LL_I2S_PRESCALER_PARITY_ODD
Kojto 158:b23ee177fd68 1579 * @retval None
Kojto 158:b23ee177fd68 1580 */
Kojto 158:b23ee177fd68 1581 __STATIC_INLINE void LL_I2S_SetPrescalerParity(SPI_TypeDef *SPIx, uint32_t PrescalerParity)
Kojto 158:b23ee177fd68 1582 {
Kojto 158:b23ee177fd68 1583 MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_ODD, PrescalerParity << 8U);
Kojto 158:b23ee177fd68 1584 }
Kojto 158:b23ee177fd68 1585
Kojto 158:b23ee177fd68 1586 /**
Kojto 158:b23ee177fd68 1587 * @brief Get I2S parity prescaler
Kojto 158:b23ee177fd68 1588 * @rmtoll I2SPR ODD LL_I2S_GetPrescalerParity
Kojto 158:b23ee177fd68 1589 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1590 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1591 * @arg @ref LL_I2S_PRESCALER_PARITY_EVEN
Kojto 158:b23ee177fd68 1592 * @arg @ref LL_I2S_PRESCALER_PARITY_ODD
Kojto 158:b23ee177fd68 1593 */
Kojto 158:b23ee177fd68 1594 __STATIC_INLINE uint32_t LL_I2S_GetPrescalerParity(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1595 {
Kojto 158:b23ee177fd68 1596 return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_ODD) >> 8U);
Kojto 158:b23ee177fd68 1597 }
Kojto 158:b23ee177fd68 1598
Kojto 158:b23ee177fd68 1599 /**
Anna Bridge 186:707f6e361f3e 1600 * @brief Enable the master clock ouput (Pin MCK)
Kojto 158:b23ee177fd68 1601 * @rmtoll I2SPR MCKOE LL_I2S_EnableMasterClock
Kojto 158:b23ee177fd68 1602 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1603 * @retval None
Kojto 158:b23ee177fd68 1604 */
Kojto 158:b23ee177fd68 1605 __STATIC_INLINE void LL_I2S_EnableMasterClock(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1606 {
Kojto 158:b23ee177fd68 1607 SET_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE);
Kojto 158:b23ee177fd68 1608 }
Kojto 158:b23ee177fd68 1609
Kojto 158:b23ee177fd68 1610 /**
Anna Bridge 186:707f6e361f3e 1611 * @brief Disable the master clock ouput (Pin MCK)
Kojto 158:b23ee177fd68 1612 * @rmtoll I2SPR MCKOE LL_I2S_DisableMasterClock
Kojto 158:b23ee177fd68 1613 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1614 * @retval None
Kojto 158:b23ee177fd68 1615 */
Kojto 158:b23ee177fd68 1616 __STATIC_INLINE void LL_I2S_DisableMasterClock(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1617 {
Kojto 158:b23ee177fd68 1618 CLEAR_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE);
Kojto 158:b23ee177fd68 1619 }
Kojto 158:b23ee177fd68 1620
Kojto 158:b23ee177fd68 1621 /**
Anna Bridge 186:707f6e361f3e 1622 * @brief Check if the master clock ouput (Pin MCK) is enabled
Kojto 158:b23ee177fd68 1623 * @rmtoll I2SPR MCKOE LL_I2S_IsEnabledMasterClock
Kojto 158:b23ee177fd68 1624 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1625 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1626 */
Kojto 158:b23ee177fd68 1627 __STATIC_INLINE uint32_t LL_I2S_IsEnabledMasterClock(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1628 {
Kojto 158:b23ee177fd68 1629 return (READ_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE) == (SPI_I2SPR_MCKOE));
Kojto 158:b23ee177fd68 1630 }
Kojto 158:b23ee177fd68 1631
Kojto 158:b23ee177fd68 1632 #if defined(SPI_I2SCFGR_ASTRTEN)
Kojto 158:b23ee177fd68 1633 /**
Anna Bridge 186:707f6e361f3e 1634 * @brief Enable asynchronous start
Kojto 158:b23ee177fd68 1635 * @rmtoll I2SCFGR ASTRTEN LL_I2S_EnableAsyncStart
Kojto 158:b23ee177fd68 1636 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1637 * @retval None
Kojto 158:b23ee177fd68 1638 */
Kojto 158:b23ee177fd68 1639 __STATIC_INLINE void LL_I2S_EnableAsyncStart(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1640 {
Kojto 158:b23ee177fd68 1641 SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN);
Kojto 158:b23ee177fd68 1642 }
Kojto 158:b23ee177fd68 1643
Kojto 158:b23ee177fd68 1644 /**
Anna Bridge 186:707f6e361f3e 1645 * @brief Disable asynchronous start
Kojto 158:b23ee177fd68 1646 * @rmtoll I2SCFGR ASTRTEN LL_I2S_DisableAsyncStart
Kojto 158:b23ee177fd68 1647 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1648 * @retval None
Kojto 158:b23ee177fd68 1649 */
Kojto 158:b23ee177fd68 1650 __STATIC_INLINE void LL_I2S_DisableAsyncStart(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1651 {
Kojto 158:b23ee177fd68 1652 CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN);
Kojto 158:b23ee177fd68 1653 }
Kojto 158:b23ee177fd68 1654
Kojto 158:b23ee177fd68 1655 /**
Anna Bridge 186:707f6e361f3e 1656 * @brief Check if asynchronous start is enabled
Kojto 158:b23ee177fd68 1657 * @rmtoll I2SCFGR ASTRTEN LL_I2S_IsEnabledAsyncStart
Kojto 158:b23ee177fd68 1658 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1659 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1660 */
Kojto 158:b23ee177fd68 1661 __STATIC_INLINE uint32_t LL_I2S_IsEnabledAsyncStart(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1662 {
Kojto 158:b23ee177fd68 1663 return (READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN) == (SPI_I2SCFGR_ASTRTEN));
Kojto 158:b23ee177fd68 1664 }
Kojto 158:b23ee177fd68 1665 #endif /* SPI_I2SCFGR_ASTRTEN */
Kojto 158:b23ee177fd68 1666
Kojto 158:b23ee177fd68 1667 /**
Kojto 158:b23ee177fd68 1668 * @}
Kojto 158:b23ee177fd68 1669 */
Kojto 158:b23ee177fd68 1670
Kojto 158:b23ee177fd68 1671 /** @defgroup I2S_LL_EF_FLAG FLAG Management
Kojto 158:b23ee177fd68 1672 * @{
Kojto 158:b23ee177fd68 1673 */
Kojto 158:b23ee177fd68 1674
Kojto 158:b23ee177fd68 1675 /**
Kojto 158:b23ee177fd68 1676 * @brief Check if Rx buffer is not empty
Kojto 158:b23ee177fd68 1677 * @rmtoll SR RXNE LL_I2S_IsActiveFlag_RXNE
Kojto 158:b23ee177fd68 1678 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1679 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1680 */
Kojto 158:b23ee177fd68 1681 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_RXNE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1682 {
Kojto 158:b23ee177fd68 1683 return LL_SPI_IsActiveFlag_RXNE(SPIx);
Kojto 158:b23ee177fd68 1684 }
Kojto 158:b23ee177fd68 1685
Kojto 158:b23ee177fd68 1686 /**
Kojto 158:b23ee177fd68 1687 * @brief Check if Tx buffer is empty
Kojto 158:b23ee177fd68 1688 * @rmtoll SR TXE LL_I2S_IsActiveFlag_TXE
Kojto 158:b23ee177fd68 1689 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1690 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1691 */
Kojto 158:b23ee177fd68 1692 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_TXE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1693 {
Kojto 158:b23ee177fd68 1694 return LL_SPI_IsActiveFlag_TXE(SPIx);
Kojto 158:b23ee177fd68 1695 }
Kojto 158:b23ee177fd68 1696
Kojto 158:b23ee177fd68 1697 /**
Anna Bridge 186:707f6e361f3e 1698 * @brief Get busy flag
Kojto 158:b23ee177fd68 1699 * @rmtoll SR BSY LL_I2S_IsActiveFlag_BSY
Kojto 158:b23ee177fd68 1700 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1701 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1702 */
Kojto 158:b23ee177fd68 1703 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_BSY(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1704 {
Kojto 158:b23ee177fd68 1705 return LL_SPI_IsActiveFlag_BSY(SPIx);
Kojto 158:b23ee177fd68 1706 }
Kojto 158:b23ee177fd68 1707
Kojto 158:b23ee177fd68 1708 /**
Anna Bridge 186:707f6e361f3e 1709 * @brief Get overrun error flag
Kojto 158:b23ee177fd68 1710 * @rmtoll SR OVR LL_I2S_IsActiveFlag_OVR
Kojto 158:b23ee177fd68 1711 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1712 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1713 */
Kojto 158:b23ee177fd68 1714 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_OVR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1715 {
Kojto 158:b23ee177fd68 1716 return LL_SPI_IsActiveFlag_OVR(SPIx);
Kojto 158:b23ee177fd68 1717 }
Kojto 158:b23ee177fd68 1718
Kojto 158:b23ee177fd68 1719 /**
Anna Bridge 186:707f6e361f3e 1720 * @brief Get underrun error flag
Kojto 158:b23ee177fd68 1721 * @rmtoll SR UDR LL_I2S_IsActiveFlag_UDR
Kojto 158:b23ee177fd68 1722 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1723 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1724 */
Kojto 158:b23ee177fd68 1725 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_UDR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1726 {
Kojto 158:b23ee177fd68 1727 return (READ_BIT(SPIx->SR, SPI_SR_UDR) == (SPI_SR_UDR));
Kojto 158:b23ee177fd68 1728 }
Kojto 158:b23ee177fd68 1729
Kojto 158:b23ee177fd68 1730 /**
Anna Bridge 186:707f6e361f3e 1731 * @brief Get frame format error flag
Kojto 158:b23ee177fd68 1732 * @rmtoll SR FRE LL_I2S_IsActiveFlag_FRE
Kojto 158:b23ee177fd68 1733 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1734 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1735 */
Kojto 158:b23ee177fd68 1736 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_FRE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1737 {
Kojto 158:b23ee177fd68 1738 return LL_SPI_IsActiveFlag_FRE(SPIx);
Kojto 158:b23ee177fd68 1739 }
Kojto 158:b23ee177fd68 1740
Kojto 158:b23ee177fd68 1741 /**
Anna Bridge 186:707f6e361f3e 1742 * @brief Get channel side flag.
Kojto 158:b23ee177fd68 1743 * @note 0: Channel Left has to be transmitted or has been received\n
Kojto 158:b23ee177fd68 1744 * 1: Channel Right has to be transmitted or has been received\n
Kojto 158:b23ee177fd68 1745 * It has no significance in PCM mode.
Kojto 158:b23ee177fd68 1746 * @rmtoll SR CHSIDE LL_I2S_IsActiveFlag_CHSIDE
Kojto 158:b23ee177fd68 1747 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1748 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1749 */
Kojto 158:b23ee177fd68 1750 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_CHSIDE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1751 {
Kojto 158:b23ee177fd68 1752 return (READ_BIT(SPIx->SR, SPI_SR_CHSIDE) == (SPI_SR_CHSIDE));
Kojto 158:b23ee177fd68 1753 }
Kojto 158:b23ee177fd68 1754
Kojto 158:b23ee177fd68 1755 /**
Anna Bridge 186:707f6e361f3e 1756 * @brief Clear overrun error flag
Kojto 158:b23ee177fd68 1757 * @rmtoll SR OVR LL_I2S_ClearFlag_OVR
Kojto 158:b23ee177fd68 1758 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1759 * @retval None
Kojto 158:b23ee177fd68 1760 */
Kojto 158:b23ee177fd68 1761 __STATIC_INLINE void LL_I2S_ClearFlag_OVR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1762 {
Kojto 158:b23ee177fd68 1763 LL_SPI_ClearFlag_OVR(SPIx);
Kojto 158:b23ee177fd68 1764 }
Kojto 158:b23ee177fd68 1765
Kojto 158:b23ee177fd68 1766 /**
Anna Bridge 186:707f6e361f3e 1767 * @brief Clear underrun error flag
Kojto 158:b23ee177fd68 1768 * @rmtoll SR UDR LL_I2S_ClearFlag_UDR
Kojto 158:b23ee177fd68 1769 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1770 * @retval None
Kojto 158:b23ee177fd68 1771 */
Kojto 158:b23ee177fd68 1772 __STATIC_INLINE void LL_I2S_ClearFlag_UDR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1773 {
Kojto 158:b23ee177fd68 1774 __IO uint32_t tmpreg;
Kojto 158:b23ee177fd68 1775 tmpreg = SPIx->SR;
Kojto 158:b23ee177fd68 1776 (void)tmpreg;
Kojto 158:b23ee177fd68 1777 }
Kojto 158:b23ee177fd68 1778
Kojto 158:b23ee177fd68 1779 /**
Anna Bridge 186:707f6e361f3e 1780 * @brief Clear frame format error flag
Kojto 158:b23ee177fd68 1781 * @rmtoll SR FRE LL_I2S_ClearFlag_FRE
Kojto 158:b23ee177fd68 1782 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1783 * @retval None
Kojto 158:b23ee177fd68 1784 */
Kojto 158:b23ee177fd68 1785 __STATIC_INLINE void LL_I2S_ClearFlag_FRE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1786 {
Kojto 158:b23ee177fd68 1787 LL_SPI_ClearFlag_FRE(SPIx);
Kojto 158:b23ee177fd68 1788 }
Kojto 158:b23ee177fd68 1789
Kojto 158:b23ee177fd68 1790 /**
Kojto 158:b23ee177fd68 1791 * @}
Kojto 158:b23ee177fd68 1792 */
Kojto 158:b23ee177fd68 1793
Kojto 158:b23ee177fd68 1794 /** @defgroup I2S_LL_EF_IT Interrupt Management
Kojto 158:b23ee177fd68 1795 * @{
Kojto 158:b23ee177fd68 1796 */
Kojto 158:b23ee177fd68 1797
Kojto 158:b23ee177fd68 1798 /**
Kojto 158:b23ee177fd68 1799 * @brief Enable error IT
Kojto 158:b23ee177fd68 1800 * @note This bit controls the generation of an interrupt when an error condition occurs (OVR, UDR and FRE in I2S mode).
Kojto 158:b23ee177fd68 1801 * @rmtoll CR2 ERRIE LL_I2S_EnableIT_ERR
Kojto 158:b23ee177fd68 1802 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1803 * @retval None
Kojto 158:b23ee177fd68 1804 */
Kojto 158:b23ee177fd68 1805 __STATIC_INLINE void LL_I2S_EnableIT_ERR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1806 {
Kojto 158:b23ee177fd68 1807 LL_SPI_EnableIT_ERR(SPIx);
Kojto 158:b23ee177fd68 1808 }
Kojto 158:b23ee177fd68 1809
Kojto 158:b23ee177fd68 1810 /**
Kojto 158:b23ee177fd68 1811 * @brief Enable Rx buffer not empty IT
Kojto 158:b23ee177fd68 1812 * @rmtoll CR2 RXNEIE LL_I2S_EnableIT_RXNE
Kojto 158:b23ee177fd68 1813 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1814 * @retval None
Kojto 158:b23ee177fd68 1815 */
Kojto 158:b23ee177fd68 1816 __STATIC_INLINE void LL_I2S_EnableIT_RXNE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1817 {
Kojto 158:b23ee177fd68 1818 LL_SPI_EnableIT_RXNE(SPIx);
Kojto 158:b23ee177fd68 1819 }
Kojto 158:b23ee177fd68 1820
Kojto 158:b23ee177fd68 1821 /**
Kojto 158:b23ee177fd68 1822 * @brief Enable Tx buffer empty IT
Kojto 158:b23ee177fd68 1823 * @rmtoll CR2 TXEIE LL_I2S_EnableIT_TXE
Kojto 158:b23ee177fd68 1824 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1825 * @retval None
Kojto 158:b23ee177fd68 1826 */
Kojto 158:b23ee177fd68 1827 __STATIC_INLINE void LL_I2S_EnableIT_TXE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1828 {
Kojto 158:b23ee177fd68 1829 LL_SPI_EnableIT_TXE(SPIx);
Kojto 158:b23ee177fd68 1830 }
Kojto 158:b23ee177fd68 1831
Kojto 158:b23ee177fd68 1832 /**
Anna Bridge 186:707f6e361f3e 1833 * @brief Disable error IT
Kojto 158:b23ee177fd68 1834 * @note This bit controls the generation of an interrupt when an error condition occurs (OVR, UDR and FRE in I2S mode).
Kojto 158:b23ee177fd68 1835 * @rmtoll CR2 ERRIE LL_I2S_DisableIT_ERR
Kojto 158:b23ee177fd68 1836 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1837 * @retval None
Kojto 158:b23ee177fd68 1838 */
Kojto 158:b23ee177fd68 1839 __STATIC_INLINE void LL_I2S_DisableIT_ERR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1840 {
Kojto 158:b23ee177fd68 1841 LL_SPI_DisableIT_ERR(SPIx);
Kojto 158:b23ee177fd68 1842 }
Kojto 158:b23ee177fd68 1843
Kojto 158:b23ee177fd68 1844 /**
Kojto 158:b23ee177fd68 1845 * @brief Disable Rx buffer not empty IT
Kojto 158:b23ee177fd68 1846 * @rmtoll CR2 RXNEIE LL_I2S_DisableIT_RXNE
Kojto 158:b23ee177fd68 1847 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1848 * @retval None
Kojto 158:b23ee177fd68 1849 */
Kojto 158:b23ee177fd68 1850 __STATIC_INLINE void LL_I2S_DisableIT_RXNE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1851 {
Kojto 158:b23ee177fd68 1852 LL_SPI_DisableIT_RXNE(SPIx);
Kojto 158:b23ee177fd68 1853 }
Kojto 158:b23ee177fd68 1854
Kojto 158:b23ee177fd68 1855 /**
Kojto 158:b23ee177fd68 1856 * @brief Disable Tx buffer empty IT
Kojto 158:b23ee177fd68 1857 * @rmtoll CR2 TXEIE LL_I2S_DisableIT_TXE
Kojto 158:b23ee177fd68 1858 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1859 * @retval None
Kojto 158:b23ee177fd68 1860 */
Kojto 158:b23ee177fd68 1861 __STATIC_INLINE void LL_I2S_DisableIT_TXE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1862 {
Kojto 158:b23ee177fd68 1863 LL_SPI_DisableIT_TXE(SPIx);
Kojto 158:b23ee177fd68 1864 }
Kojto 158:b23ee177fd68 1865
Kojto 158:b23ee177fd68 1866 /**
Kojto 158:b23ee177fd68 1867 * @brief Check if ERR IT is enabled
Kojto 158:b23ee177fd68 1868 * @rmtoll CR2 ERRIE LL_I2S_IsEnabledIT_ERR
Kojto 158:b23ee177fd68 1869 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1870 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1871 */
Kojto 158:b23ee177fd68 1872 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_ERR(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1873 {
Kojto 158:b23ee177fd68 1874 return LL_SPI_IsEnabledIT_ERR(SPIx);
Kojto 158:b23ee177fd68 1875 }
Kojto 158:b23ee177fd68 1876
Kojto 158:b23ee177fd68 1877 /**
Kojto 158:b23ee177fd68 1878 * @brief Check if RXNE IT is enabled
Kojto 158:b23ee177fd68 1879 * @rmtoll CR2 RXNEIE LL_I2S_IsEnabledIT_RXNE
Kojto 158:b23ee177fd68 1880 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1881 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1882 */
Kojto 158:b23ee177fd68 1883 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_RXNE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1884 {
Kojto 158:b23ee177fd68 1885 return LL_SPI_IsEnabledIT_RXNE(SPIx);
Kojto 158:b23ee177fd68 1886 }
Kojto 158:b23ee177fd68 1887
Kojto 158:b23ee177fd68 1888 /**
Kojto 158:b23ee177fd68 1889 * @brief Check if TXE IT is enabled
Kojto 158:b23ee177fd68 1890 * @rmtoll CR2 TXEIE LL_I2S_IsEnabledIT_TXE
Kojto 158:b23ee177fd68 1891 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1892 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1893 */
Kojto 158:b23ee177fd68 1894 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_TXE(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1895 {
Kojto 158:b23ee177fd68 1896 return LL_SPI_IsEnabledIT_TXE(SPIx);
Kojto 158:b23ee177fd68 1897 }
Kojto 158:b23ee177fd68 1898
Kojto 158:b23ee177fd68 1899 /**
Kojto 158:b23ee177fd68 1900 * @}
Kojto 158:b23ee177fd68 1901 */
Kojto 158:b23ee177fd68 1902
Kojto 158:b23ee177fd68 1903 /** @defgroup I2S_LL_EF_DMA DMA Management
Kojto 158:b23ee177fd68 1904 * @{
Kojto 158:b23ee177fd68 1905 */
Kojto 158:b23ee177fd68 1906
Kojto 158:b23ee177fd68 1907 /**
Kojto 158:b23ee177fd68 1908 * @brief Enable DMA Rx
Kojto 158:b23ee177fd68 1909 * @rmtoll CR2 RXDMAEN LL_I2S_EnableDMAReq_RX
Kojto 158:b23ee177fd68 1910 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1911 * @retval None
Kojto 158:b23ee177fd68 1912 */
Kojto 158:b23ee177fd68 1913 __STATIC_INLINE void LL_I2S_EnableDMAReq_RX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1914 {
Kojto 158:b23ee177fd68 1915 LL_SPI_EnableDMAReq_RX(SPIx);
Kojto 158:b23ee177fd68 1916 }
Kojto 158:b23ee177fd68 1917
Kojto 158:b23ee177fd68 1918 /**
Kojto 158:b23ee177fd68 1919 * @brief Disable DMA Rx
Kojto 158:b23ee177fd68 1920 * @rmtoll CR2 RXDMAEN LL_I2S_DisableDMAReq_RX
Kojto 158:b23ee177fd68 1921 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1922 * @retval None
Kojto 158:b23ee177fd68 1923 */
Kojto 158:b23ee177fd68 1924 __STATIC_INLINE void LL_I2S_DisableDMAReq_RX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1925 {
Kojto 158:b23ee177fd68 1926 LL_SPI_DisableDMAReq_RX(SPIx);
Kojto 158:b23ee177fd68 1927 }
Kojto 158:b23ee177fd68 1928
Kojto 158:b23ee177fd68 1929 /**
Kojto 158:b23ee177fd68 1930 * @brief Check if DMA Rx is enabled
Kojto 158:b23ee177fd68 1931 * @rmtoll CR2 RXDMAEN LL_I2S_IsEnabledDMAReq_RX
Kojto 158:b23ee177fd68 1932 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1933 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1934 */
Kojto 158:b23ee177fd68 1935 __STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_RX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1936 {
Kojto 158:b23ee177fd68 1937 return LL_SPI_IsEnabledDMAReq_RX(SPIx);
Kojto 158:b23ee177fd68 1938 }
Kojto 158:b23ee177fd68 1939
Kojto 158:b23ee177fd68 1940 /**
Kojto 158:b23ee177fd68 1941 * @brief Enable DMA Tx
Kojto 158:b23ee177fd68 1942 * @rmtoll CR2 TXDMAEN LL_I2S_EnableDMAReq_TX
Kojto 158:b23ee177fd68 1943 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1944 * @retval None
Kojto 158:b23ee177fd68 1945 */
Kojto 158:b23ee177fd68 1946 __STATIC_INLINE void LL_I2S_EnableDMAReq_TX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1947 {
Kojto 158:b23ee177fd68 1948 LL_SPI_EnableDMAReq_TX(SPIx);
Kojto 158:b23ee177fd68 1949 }
Kojto 158:b23ee177fd68 1950
Kojto 158:b23ee177fd68 1951 /**
Kojto 158:b23ee177fd68 1952 * @brief Disable DMA Tx
Kojto 158:b23ee177fd68 1953 * @rmtoll CR2 TXDMAEN LL_I2S_DisableDMAReq_TX
Kojto 158:b23ee177fd68 1954 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1955 * @retval None
Kojto 158:b23ee177fd68 1956 */
Kojto 158:b23ee177fd68 1957 __STATIC_INLINE void LL_I2S_DisableDMAReq_TX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1958 {
Kojto 158:b23ee177fd68 1959 LL_SPI_DisableDMAReq_TX(SPIx);
Kojto 158:b23ee177fd68 1960 }
Kojto 158:b23ee177fd68 1961
Kojto 158:b23ee177fd68 1962 /**
Kojto 158:b23ee177fd68 1963 * @brief Check if DMA Tx is enabled
Kojto 158:b23ee177fd68 1964 * @rmtoll CR2 TXDMAEN LL_I2S_IsEnabledDMAReq_TX
Kojto 158:b23ee177fd68 1965 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1966 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1967 */
Kojto 158:b23ee177fd68 1968 __STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_TX(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1969 {
Kojto 158:b23ee177fd68 1970 return LL_SPI_IsEnabledDMAReq_TX(SPIx);
Kojto 158:b23ee177fd68 1971 }
Kojto 158:b23ee177fd68 1972
Kojto 158:b23ee177fd68 1973 /**
Kojto 158:b23ee177fd68 1974 * @}
Kojto 158:b23ee177fd68 1975 */
Kojto 158:b23ee177fd68 1976
Kojto 158:b23ee177fd68 1977 /** @defgroup I2S_LL_EF_DATA DATA Management
Kojto 158:b23ee177fd68 1978 * @{
Kojto 158:b23ee177fd68 1979 */
Kojto 158:b23ee177fd68 1980
Kojto 158:b23ee177fd68 1981 /**
Kojto 158:b23ee177fd68 1982 * @brief Read 16-Bits in data register
Kojto 158:b23ee177fd68 1983 * @rmtoll DR DR LL_I2S_ReceiveData16
Kojto 158:b23ee177fd68 1984 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1985 * @retval RxData Value between Min_Data=0x0000 and Max_Data=0xFFFF
Kojto 158:b23ee177fd68 1986 */
Kojto 158:b23ee177fd68 1987 __STATIC_INLINE uint16_t LL_I2S_ReceiveData16(SPI_TypeDef *SPIx)
Kojto 158:b23ee177fd68 1988 {
Kojto 158:b23ee177fd68 1989 return LL_SPI_ReceiveData16(SPIx);
Kojto 158:b23ee177fd68 1990 }
Kojto 158:b23ee177fd68 1991
Kojto 158:b23ee177fd68 1992 /**
Kojto 158:b23ee177fd68 1993 * @brief Write 16-Bits in data register
Kojto 158:b23ee177fd68 1994 * @rmtoll DR DR LL_I2S_TransmitData16
Kojto 158:b23ee177fd68 1995 * @param SPIx SPI Instance
Kojto 158:b23ee177fd68 1996 * @param TxData Value between Min_Data=0x0000 and Max_Data=0xFFFF
Kojto 158:b23ee177fd68 1997 * @retval None
Kojto 158:b23ee177fd68 1998 */
Kojto 158:b23ee177fd68 1999 __STATIC_INLINE void LL_I2S_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
Kojto 158:b23ee177fd68 2000 {
Kojto 158:b23ee177fd68 2001 LL_SPI_TransmitData16(SPIx, TxData);
Kojto 158:b23ee177fd68 2002 }
Kojto 158:b23ee177fd68 2003
Kojto 158:b23ee177fd68 2004 /**
Kojto 158:b23ee177fd68 2005 * @}
Kojto 158:b23ee177fd68 2006 */
Kojto 158:b23ee177fd68 2007
Kojto 158:b23ee177fd68 2008 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 2009 /** @defgroup I2S_LL_EF_Init Initialization and de-initialization functions
Kojto 158:b23ee177fd68 2010 * @{
Kojto 158:b23ee177fd68 2011 */
Kojto 158:b23ee177fd68 2012
Kojto 158:b23ee177fd68 2013 ErrorStatus LL_I2S_DeInit(SPI_TypeDef *SPIx);
Kojto 158:b23ee177fd68 2014 ErrorStatus LL_I2S_Init(SPI_TypeDef *SPIx, LL_I2S_InitTypeDef *I2S_InitStruct);
Kojto 158:b23ee177fd68 2015 void LL_I2S_StructInit(LL_I2S_InitTypeDef *I2S_InitStruct);
Kojto 158:b23ee177fd68 2016 void LL_I2S_ConfigPrescaler(SPI_TypeDef *SPIx, uint32_t PrescalerLinear, uint32_t PrescalerParity);
Kojto 158:b23ee177fd68 2017
Kojto 158:b23ee177fd68 2018 /**
Kojto 158:b23ee177fd68 2019 * @}
Kojto 158:b23ee177fd68 2020 */
Kojto 158:b23ee177fd68 2021 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 2022
Kojto 158:b23ee177fd68 2023 /**
Kojto 158:b23ee177fd68 2024 * @}
Kojto 158:b23ee177fd68 2025 */
Kojto 158:b23ee177fd68 2026
Kojto 158:b23ee177fd68 2027 /**
Kojto 158:b23ee177fd68 2028 * @}
Kojto 158:b23ee177fd68 2029 */
Kojto 158:b23ee177fd68 2030 #endif /* SPI_I2S_SUPPORT */
Kojto 158:b23ee177fd68 2031
Kojto 158:b23ee177fd68 2032 #endif /* defined (SPI1) || defined (SPI2) */
Kojto 158:b23ee177fd68 2033
Kojto 158:b23ee177fd68 2034 /**
Kojto 158:b23ee177fd68 2035 * @}
Kojto 158:b23ee177fd68 2036 */
Kojto 158:b23ee177fd68 2037
Kojto 158:b23ee177fd68 2038 #ifdef __cplusplus
Kojto 158:b23ee177fd68 2039 }
Kojto 158:b23ee177fd68 2040 #endif
Kojto 158:b23ee177fd68 2041
Kojto 158:b23ee177fd68 2042 #endif /* __STM32L0xx_LL_SPI_H */
Kojto 158:b23ee177fd68 2043
Kojto 158:b23ee177fd68 2044 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/