mbed library sources. Supersedes mbed-src.

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

Committer:
Kojto
Date:
Tue Feb 14 14:44:10 2017 +0000
Revision:
158:b23ee177fd68
Child:
186:707f6e361f3e
This updates the lib to the mbed lib v136

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