STM32F4xx_HAL_Driver  1.8.3
stm32f4xx_ll_spi.h
Go to the documentation of this file.
1 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32F4xx_LL_SPI_H
21 #define STM32F4xx_LL_SPI_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32f4xx.h"
29 
34 #if defined (SPI1) || defined (SPI2) || defined (SPI3) || defined (SPI4) || defined (SPI5) || defined(SPI6)
35 
40 /* Private types -------------------------------------------------------------*/
41 /* Private variables ---------------------------------------------------------*/
42 /* Private macros ------------------------------------------------------------*/
43 
44 /* Exported types ------------------------------------------------------------*/
45 #if defined(USE_FULL_LL_DRIVER)
53 typedef struct
54 {
55  uint32_t TransferDirection;
60  uint32_t Mode;
65  uint32_t DataWidth;
70  uint32_t ClockPolarity;
75  uint32_t ClockPhase;
80  uint32_t NSS;
85  uint32_t BaudRate;
91  uint32_t BitOrder;
96  uint32_t CRCCalculation;
101  uint32_t CRCPoly;
107 
111 #endif /* USE_FULL_LL_DRIVER */
112 
113 /* Exported constants --------------------------------------------------------*/
122 #define LL_SPI_SR_RXNE SPI_SR_RXNE
123 #define LL_SPI_SR_TXE SPI_SR_TXE
124 #define LL_SPI_SR_BSY SPI_SR_BSY
125 #define LL_SPI_SR_CRCERR SPI_SR_CRCERR
126 #define LL_SPI_SR_MODF SPI_SR_MODF
127 #define LL_SPI_SR_OVR SPI_SR_OVR
128 #define LL_SPI_SR_FRE SPI_SR_FRE
137 #define LL_SPI_CR2_RXNEIE SPI_CR2_RXNEIE
138 #define LL_SPI_CR2_TXEIE SPI_CR2_TXEIE
139 #define LL_SPI_CR2_ERRIE SPI_CR2_ERRIE
147 #define LL_SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI)
148 #define LL_SPI_MODE_SLAVE 0x00000000U
156 #define LL_SPI_PROTOCOL_MOTOROLA 0x00000000U
157 #define LL_SPI_PROTOCOL_TI (SPI_CR2_FRF)
165 #define LL_SPI_PHASE_1EDGE 0x00000000U
166 #define LL_SPI_PHASE_2EDGE (SPI_CR1_CPHA)
174 #define LL_SPI_POLARITY_LOW 0x00000000U
175 #define LL_SPI_POLARITY_HIGH (SPI_CR1_CPOL)
183 #define LL_SPI_BAUDRATEPRESCALER_DIV2 0x00000000U
184 #define LL_SPI_BAUDRATEPRESCALER_DIV4 (SPI_CR1_BR_0)
185 #define LL_SPI_BAUDRATEPRESCALER_DIV8 (SPI_CR1_BR_1)
186 #define LL_SPI_BAUDRATEPRESCALER_DIV16 (SPI_CR1_BR_1 | SPI_CR1_BR_0)
187 #define LL_SPI_BAUDRATEPRESCALER_DIV32 (SPI_CR1_BR_2)
188 #define LL_SPI_BAUDRATEPRESCALER_DIV64 (SPI_CR1_BR_2 | SPI_CR1_BR_0)
189 #define LL_SPI_BAUDRATEPRESCALER_DIV128 (SPI_CR1_BR_2 | SPI_CR1_BR_1)
190 #define LL_SPI_BAUDRATEPRESCALER_DIV256 (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0)
198 #define LL_SPI_LSB_FIRST (SPI_CR1_LSBFIRST)
199 #define LL_SPI_MSB_FIRST 0x00000000U
207 #define LL_SPI_FULL_DUPLEX 0x00000000U
208 #define LL_SPI_SIMPLEX_RX (SPI_CR1_RXONLY)
209 #define LL_SPI_HALF_DUPLEX_RX (SPI_CR1_BIDIMODE)
210 #define LL_SPI_HALF_DUPLEX_TX (SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE)
218 #define LL_SPI_NSS_SOFT (SPI_CR1_SSM)
219 #define LL_SPI_NSS_HARD_INPUT 0x00000000U
220 #define LL_SPI_NSS_HARD_OUTPUT (((uint32_t)SPI_CR2_SSOE << 16U))
228 #define LL_SPI_DATAWIDTH_8BIT 0x00000000U
229 #define LL_SPI_DATAWIDTH_16BIT (SPI_CR1_DFF)
233 #if defined(USE_FULL_LL_DRIVER)
234 
238 #define LL_SPI_CRCCALCULATION_DISABLE 0x00000000U
239 #define LL_SPI_CRCCALCULATION_ENABLE (SPI_CR1_CRCEN)
243 #endif /* USE_FULL_LL_DRIVER */
244 
249 /* Exported macro ------------------------------------------------------------*/
265 #define LL_SPI_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
266 
273 #define LL_SPI_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
282 /* Exported functions --------------------------------------------------------*/
297 __STATIC_INLINE void LL_SPI_Enable(SPI_TypeDef *SPIx)
298 {
299  SET_BIT(SPIx->CR1, SPI_CR1_SPE);
300 }
301 
309 __STATIC_INLINE void LL_SPI_Disable(SPI_TypeDef *SPIx)
310 {
311  CLEAR_BIT(SPIx->CR1, SPI_CR1_SPE);
312 }
313 
320 __STATIC_INLINE uint32_t LL_SPI_IsEnabled(const SPI_TypeDef *SPIx)
321 {
322  return ((READ_BIT(SPIx->CR1, SPI_CR1_SPE) == (SPI_CR1_SPE)) ? 1UL : 0UL);
323 }
324 
336 __STATIC_INLINE void LL_SPI_SetMode(SPI_TypeDef *SPIx, uint32_t Mode)
337 {
338  MODIFY_REG(SPIx->CR1, SPI_CR1_MSTR | SPI_CR1_SSI, Mode);
339 }
340 
350 __STATIC_INLINE uint32_t LL_SPI_GetMode(const SPI_TypeDef *SPIx)
351 {
352  return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_MSTR | SPI_CR1_SSI));
353 }
354 
365 __STATIC_INLINE void LL_SPI_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard)
366 {
367  MODIFY_REG(SPIx->CR2, SPI_CR2_FRF, Standard);
368 }
369 
378 __STATIC_INLINE uint32_t LL_SPI_GetStandard(const SPI_TypeDef *SPIx)
379 {
380  return (uint32_t)(READ_BIT(SPIx->CR2, SPI_CR2_FRF));
381 }
382 
394 __STATIC_INLINE void LL_SPI_SetClockPhase(SPI_TypeDef *SPIx, uint32_t ClockPhase)
395 {
396  MODIFY_REG(SPIx->CR1, SPI_CR1_CPHA, ClockPhase);
397 }
398 
407 __STATIC_INLINE uint32_t LL_SPI_GetClockPhase(const SPI_TypeDef *SPIx)
408 {
409  return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_CPHA));
410 }
411 
423 __STATIC_INLINE void LL_SPI_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity)
424 {
425  MODIFY_REG(SPIx->CR1, SPI_CR1_CPOL, ClockPolarity);
426 }
427 
436 __STATIC_INLINE uint32_t LL_SPI_GetClockPolarity(const SPI_TypeDef *SPIx)
437 {
438  return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_CPOL));
439 }
440 
457 __STATIC_INLINE void LL_SPI_SetBaudRatePrescaler(SPI_TypeDef *SPIx, uint32_t BaudRate)
458 {
459  MODIFY_REG(SPIx->CR1, SPI_CR1_BR, BaudRate);
460 }
461 
476 __STATIC_INLINE uint32_t LL_SPI_GetBaudRatePrescaler(const SPI_TypeDef *SPIx)
477 {
478  return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_BR));
479 }
480 
491 __STATIC_INLINE void LL_SPI_SetTransferBitOrder(SPI_TypeDef *SPIx, uint32_t BitOrder)
492 {
493  MODIFY_REG(SPIx->CR1, SPI_CR1_LSBFIRST, BitOrder);
494 }
495 
504 __STATIC_INLINE uint32_t LL_SPI_GetTransferBitOrder(const SPI_TypeDef *SPIx)
505 {
506  return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_LSBFIRST));
507 }
508 
524 __STATIC_INLINE void LL_SPI_SetTransferDirection(SPI_TypeDef *SPIx, uint32_t TransferDirection)
525 {
526  MODIFY_REG(SPIx->CR1, SPI_CR1_RXONLY | SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE, TransferDirection);
527 }
528 
541 __STATIC_INLINE uint32_t LL_SPI_GetTransferDirection(const SPI_TypeDef *SPIx)
542 {
543  return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_RXONLY | SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE));
544 }
545 
555 __STATIC_INLINE void LL_SPI_SetDataWidth(SPI_TypeDef *SPIx, uint32_t DataWidth)
556 {
557  MODIFY_REG(SPIx->CR1, SPI_CR1_DFF, DataWidth);
558 }
559 
568 __STATIC_INLINE uint32_t LL_SPI_GetDataWidth(const SPI_TypeDef *SPIx)
569 {
570  return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_DFF));
571 }
572 
588 __STATIC_INLINE void LL_SPI_EnableCRC(SPI_TypeDef *SPIx)
589 {
590  SET_BIT(SPIx->CR1, SPI_CR1_CRCEN);
591 }
592 
600 __STATIC_INLINE void LL_SPI_DisableCRC(SPI_TypeDef *SPIx)
601 {
602  CLEAR_BIT(SPIx->CR1, SPI_CR1_CRCEN);
603 }
604 
612 __STATIC_INLINE uint32_t LL_SPI_IsEnabledCRC(const SPI_TypeDef *SPIx)
613 {
614  return ((READ_BIT(SPIx->CR1, SPI_CR1_CRCEN) == (SPI_CR1_CRCEN)) ? 1UL : 0UL);
615 }
616 
624 __STATIC_INLINE void LL_SPI_SetCRCNext(SPI_TypeDef *SPIx)
625 {
626  SET_BIT(SPIx->CR1, SPI_CR1_CRCNEXT);
627 }
628 
636 __STATIC_INLINE void LL_SPI_SetCRCPolynomial(SPI_TypeDef *SPIx, uint32_t CRCPoly)
637 {
638  WRITE_REG(SPIx->CRCPR, (uint16_t)CRCPoly);
639 }
640 
647 __STATIC_INLINE uint32_t LL_SPI_GetCRCPolynomial(const SPI_TypeDef *SPIx)
648 {
649  return (uint32_t)(READ_REG(SPIx->CRCPR));
650 }
651 
658 __STATIC_INLINE uint32_t LL_SPI_GetRxCRC(const SPI_TypeDef *SPIx)
659 {
660  return (uint32_t)(READ_REG(SPIx->RXCRCR));
661 }
662 
669 __STATIC_INLINE uint32_t LL_SPI_GetTxCRC(const SPI_TypeDef *SPIx)
670 {
671  return (uint32_t)(READ_REG(SPIx->TXCRCR));
672 }
673 
694 __STATIC_INLINE void LL_SPI_SetNSSMode(SPI_TypeDef *SPIx, uint32_t NSS)
695 {
696  MODIFY_REG(SPIx->CR1, SPI_CR1_SSM, NSS);
697  MODIFY_REG(SPIx->CR2, SPI_CR2_SSOE, ((uint32_t)(NSS >> 16U)));
698 }
699 
710 __STATIC_INLINE uint32_t LL_SPI_GetNSSMode(const SPI_TypeDef *SPIx)
711 {
712  uint32_t Ssm = (READ_BIT(SPIx->CR1, SPI_CR1_SSM));
713  uint32_t Ssoe = (READ_BIT(SPIx->CR2, SPI_CR2_SSOE) << 16U);
714  return (Ssm | Ssoe);
715 }
716 
731 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_RXNE(const SPI_TypeDef *SPIx)
732 {
733  return ((READ_BIT(SPIx->SR, SPI_SR_RXNE) == (SPI_SR_RXNE)) ? 1UL : 0UL);
734 }
735 
742 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_TXE(const SPI_TypeDef *SPIx)
743 {
744  return ((READ_BIT(SPIx->SR, SPI_SR_TXE) == (SPI_SR_TXE)) ? 1UL : 0UL);
745 }
746 
753 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_CRCERR(const SPI_TypeDef *SPIx)
754 {
755  return ((READ_BIT(SPIx->SR, SPI_SR_CRCERR) == (SPI_SR_CRCERR)) ? 1UL : 0UL);
756 }
757 
764 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_MODF(const SPI_TypeDef *SPIx)
765 {
766  return ((READ_BIT(SPIx->SR, SPI_SR_MODF) == (SPI_SR_MODF)) ? 1UL : 0UL);
767 }
768 
775 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_OVR(const SPI_TypeDef *SPIx)
776 {
777  return ((READ_BIT(SPIx->SR, SPI_SR_OVR) == (SPI_SR_OVR)) ? 1UL : 0UL);
778 }
779 
793 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_BSY(const SPI_TypeDef *SPIx)
794 {
795  return ((READ_BIT(SPIx->SR, SPI_SR_BSY) == (SPI_SR_BSY)) ? 1UL : 0UL);
796 }
797 
804 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_FRE(const SPI_TypeDef *SPIx)
805 {
806  return ((READ_BIT(SPIx->SR, SPI_SR_FRE) == (SPI_SR_FRE)) ? 1UL : 0UL);
807 }
808 
815 __STATIC_INLINE void LL_SPI_ClearFlag_CRCERR(SPI_TypeDef *SPIx)
816 {
817  CLEAR_BIT(SPIx->SR, SPI_SR_CRCERR);
818 }
819 
828 __STATIC_INLINE void LL_SPI_ClearFlag_MODF(SPI_TypeDef *SPIx)
829 {
830  __IO uint32_t tmpreg_sr;
831  tmpreg_sr = SPIx->SR;
832  (void) tmpreg_sr;
833  CLEAR_BIT(SPIx->CR1, SPI_CR1_SPE);
834 }
835 
844 __STATIC_INLINE void LL_SPI_ClearFlag_OVR(SPI_TypeDef *SPIx)
845 {
846  __IO uint32_t tmpreg;
847  tmpreg = SPIx->DR;
848  (void) tmpreg;
849  tmpreg = SPIx->SR;
850  (void) tmpreg;
851 }
852 
860 __STATIC_INLINE void LL_SPI_ClearFlag_FRE(SPI_TypeDef *SPIx)
861 {
862  __IO uint32_t tmpreg;
863  tmpreg = SPIx->SR;
864  (void) tmpreg;
865 }
866 
882 __STATIC_INLINE void LL_SPI_EnableIT_ERR(SPI_TypeDef *SPIx)
883 {
884  SET_BIT(SPIx->CR2, SPI_CR2_ERRIE);
885 }
886 
893 __STATIC_INLINE void LL_SPI_EnableIT_RXNE(SPI_TypeDef *SPIx)
894 {
895  SET_BIT(SPIx->CR2, SPI_CR2_RXNEIE);
896 }
897 
904 __STATIC_INLINE void LL_SPI_EnableIT_TXE(SPI_TypeDef *SPIx)
905 {
906  SET_BIT(SPIx->CR2, SPI_CR2_TXEIE);
907 }
908 
916 __STATIC_INLINE void LL_SPI_DisableIT_ERR(SPI_TypeDef *SPIx)
917 {
918  CLEAR_BIT(SPIx->CR2, SPI_CR2_ERRIE);
919 }
920 
927 __STATIC_INLINE void LL_SPI_DisableIT_RXNE(SPI_TypeDef *SPIx)
928 {
929  CLEAR_BIT(SPIx->CR2, SPI_CR2_RXNEIE);
930 }
931 
938 __STATIC_INLINE void LL_SPI_DisableIT_TXE(SPI_TypeDef *SPIx)
939 {
940  CLEAR_BIT(SPIx->CR2, SPI_CR2_TXEIE);
941 }
942 
949 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_ERR(const SPI_TypeDef *SPIx)
950 {
951  return ((READ_BIT(SPIx->CR2, SPI_CR2_ERRIE) == (SPI_CR2_ERRIE)) ? 1UL : 0UL);
952 }
953 
960 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_RXNE(const SPI_TypeDef *SPIx)
961 {
962  return ((READ_BIT(SPIx->CR2, SPI_CR2_RXNEIE) == (SPI_CR2_RXNEIE)) ? 1UL : 0UL);
963 }
964 
971 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_TXE(const SPI_TypeDef *SPIx)
972 {
973  return ((READ_BIT(SPIx->CR2, SPI_CR2_TXEIE) == (SPI_CR2_TXEIE)) ? 1UL : 0UL);
974 }
975 
990 __STATIC_INLINE void LL_SPI_EnableDMAReq_RX(SPI_TypeDef *SPIx)
991 {
992  SET_BIT(SPIx->CR2, SPI_CR2_RXDMAEN);
993 }
994 
1001 __STATIC_INLINE void LL_SPI_DisableDMAReq_RX(SPI_TypeDef *SPIx)
1002 {
1003  CLEAR_BIT(SPIx->CR2, SPI_CR2_RXDMAEN);
1004 }
1005 
1012 __STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_RX(const SPI_TypeDef *SPIx)
1013 {
1014  return ((READ_BIT(SPIx->CR2, SPI_CR2_RXDMAEN) == (SPI_CR2_RXDMAEN)) ? 1UL : 0UL);
1015 }
1016 
1023 __STATIC_INLINE void LL_SPI_EnableDMAReq_TX(SPI_TypeDef *SPIx)
1024 {
1025  SET_BIT(SPIx->CR2, SPI_CR2_TXDMAEN);
1026 }
1027 
1034 __STATIC_INLINE void LL_SPI_DisableDMAReq_TX(SPI_TypeDef *SPIx)
1035 {
1036  CLEAR_BIT(SPIx->CR2, SPI_CR2_TXDMAEN);
1037 }
1038 
1045 __STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_TX(const SPI_TypeDef *SPIx)
1046 {
1047  return ((READ_BIT(SPIx->CR2, SPI_CR2_TXDMAEN) == (SPI_CR2_TXDMAEN)) ? 1UL : 0UL);
1048 }
1049 
1056 __STATIC_INLINE uint32_t LL_SPI_DMA_GetRegAddr(const SPI_TypeDef *SPIx)
1057 {
1058  return (uint32_t) &(SPIx->DR);
1059 }
1060 
1075 __STATIC_INLINE uint8_t LL_SPI_ReceiveData8(SPI_TypeDef *SPIx)
1076 {
1077  return (*((__IO uint8_t *)&SPIx->DR));
1078 }
1079 
1086 __STATIC_INLINE uint16_t LL_SPI_ReceiveData16(SPI_TypeDef *SPIx)
1087 {
1088  return (uint16_t)(READ_REG(SPIx->DR));
1089 }
1090 
1098 __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
1099 {
1100 #if defined (__GNUC__)
1101  __IO uint8_t *spidr = ((__IO uint8_t *)&SPIx->DR);
1102  *spidr = TxData;
1103 #else
1104  *((__IO uint8_t *)&SPIx->DR) = TxData;
1105 #endif /* __GNUC__ */
1106 }
1107 
1115 __STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
1116 {
1117 #if defined (__GNUC__)
1118  __IO uint16_t *spidr = ((__IO uint16_t *)&SPIx->DR);
1119  *spidr = TxData;
1120 #else
1121  SPIx->DR = TxData;
1122 #endif /* __GNUC__ */
1123 }
1124 
1128 #if defined(USE_FULL_LL_DRIVER)
1133 ErrorStatus LL_SPI_DeInit(const SPI_TypeDef *SPIx);
1134 ErrorStatus LL_SPI_Init(SPI_TypeDef *SPIx, LL_SPI_InitTypeDef *SPI_InitStruct);
1135 void LL_SPI_StructInit(LL_SPI_InitTypeDef *SPI_InitStruct);
1136 
1140 #endif /* USE_FULL_LL_DRIVER */
1153 /* Private variables ---------------------------------------------------------*/
1154 /* Private constants ---------------------------------------------------------*/
1155 /* Private macros ------------------------------------------------------------*/
1156 
1157 /* Exported types ------------------------------------------------------------*/
1158 #if defined(USE_FULL_LL_DRIVER)
1167 typedef struct
1168 {
1169  uint32_t Mode;
1174  uint32_t Standard;
1180  uint32_t DataFormat;
1186  uint32_t MCLKOutput;
1192  uint32_t AudioFreq;
1199  uint32_t ClockPolarity;
1205 
1209 #endif /*USE_FULL_LL_DRIVER*/
1210 
1211 /* Exported constants --------------------------------------------------------*/
1220 #define LL_I2S_SR_RXNE LL_SPI_SR_RXNE
1221 #define LL_I2S_SR_TXE LL_SPI_SR_TXE
1222 #define LL_I2S_SR_BSY LL_SPI_SR_BSY
1223 #define LL_I2S_SR_UDR SPI_SR_UDR
1224 #define LL_I2S_SR_OVR LL_SPI_SR_OVR
1225 #define LL_I2S_SR_FRE LL_SPI_SR_FRE
1234 #define LL_I2S_CR2_RXNEIE LL_SPI_CR2_RXNEIE
1235 #define LL_I2S_CR2_TXEIE LL_SPI_CR2_TXEIE
1236 #define LL_I2S_CR2_ERRIE LL_SPI_CR2_ERRIE
1244 #define LL_I2S_DATAFORMAT_16B 0x00000000U
1245 #define LL_I2S_DATAFORMAT_16B_EXTENDED (SPI_I2SCFGR_CHLEN)
1246 #define LL_I2S_DATAFORMAT_24B (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_0)
1247 #define LL_I2S_DATAFORMAT_32B (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_1)
1255 #define LL_I2S_POLARITY_LOW 0x00000000U
1256 #define LL_I2S_POLARITY_HIGH (SPI_I2SCFGR_CKPOL)
1264 #define LL_I2S_STANDARD_PHILIPS 0x00000000U
1265 #define LL_I2S_STANDARD_MSB (SPI_I2SCFGR_I2SSTD_0)
1266 #define LL_I2S_STANDARD_LSB (SPI_I2SCFGR_I2SSTD_1)
1267 #define LL_I2S_STANDARD_PCM_SHORT (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1)
1268 #define LL_I2S_STANDARD_PCM_LONG (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1 | SPI_I2SCFGR_PCMSYNC)
1276 #define LL_I2S_MODE_SLAVE_TX 0x00000000U
1277 #define LL_I2S_MODE_SLAVE_RX (SPI_I2SCFGR_I2SCFG_0)
1278 #define LL_I2S_MODE_MASTER_TX (SPI_I2SCFGR_I2SCFG_1)
1279 #define LL_I2S_MODE_MASTER_RX (SPI_I2SCFGR_I2SCFG_0 | SPI_I2SCFGR_I2SCFG_1)
1287 #define LL_I2S_PRESCALER_PARITY_EVEN 0x00000000U
1288 #define LL_I2S_PRESCALER_PARITY_ODD (SPI_I2SPR_ODD >> 8U)
1293 #if defined(USE_FULL_LL_DRIVER)
1294 
1298 #define LL_I2S_MCLK_OUTPUT_DISABLE 0x00000000U
1299 #define LL_I2S_MCLK_OUTPUT_ENABLE (SPI_I2SPR_MCKOE)
1308 #define LL_I2S_AUDIOFREQ_192K 192000U
1309 #define LL_I2S_AUDIOFREQ_96K 96000U
1310 #define LL_I2S_AUDIOFREQ_48K 48000U
1311 #define LL_I2S_AUDIOFREQ_44K 44100U
1312 #define LL_I2S_AUDIOFREQ_32K 32000U
1313 #define LL_I2S_AUDIOFREQ_22K 22050U
1314 #define LL_I2S_AUDIOFREQ_16K 16000U
1315 #define LL_I2S_AUDIOFREQ_11K 11025U
1316 #define LL_I2S_AUDIOFREQ_8K 8000U
1317 #define LL_I2S_AUDIOFREQ_DEFAULT 2U
1321 #endif /* USE_FULL_LL_DRIVER */
1322 
1327 /* Exported macro ------------------------------------------------------------*/
1343 #define LL_I2S_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
1344 
1351 #define LL_I2S_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
1361 /* Exported functions --------------------------------------------------------*/
1362 
1378 __STATIC_INLINE void LL_I2S_Enable(SPI_TypeDef *SPIx)
1379 {
1380  SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD | SPI_I2SCFGR_I2SE);
1381 }
1382 
1389 __STATIC_INLINE void LL_I2S_Disable(SPI_TypeDef *SPIx)
1390 {
1391  CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD | SPI_I2SCFGR_I2SE);
1392 }
1393 
1400 __STATIC_INLINE uint32_t LL_I2S_IsEnabled(const SPI_TypeDef *SPIx)
1401 {
1402  return ((READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SE) == (SPI_I2SCFGR_I2SE)) ? 1UL : 0UL);
1403 }
1404 
1417 __STATIC_INLINE void LL_I2S_SetDataFormat(SPI_TypeDef *SPIx, uint32_t DataFormat)
1418 {
1419  MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN, DataFormat);
1420 }
1421 
1433 __STATIC_INLINE uint32_t LL_I2S_GetDataFormat(const SPI_TypeDef *SPIx)
1434 {
1435  return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN));
1436 }
1437 
1447 __STATIC_INLINE void LL_I2S_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity)
1448 {
1449  SET_BIT(SPIx->I2SCFGR, ClockPolarity);
1450 }
1451 
1460 __STATIC_INLINE uint32_t LL_I2S_GetClockPolarity(const SPI_TypeDef *SPIx)
1461 {
1462  return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_CKPOL));
1463 }
1464 
1478 __STATIC_INLINE void LL_I2S_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard)
1479 {
1480  MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC, Standard);
1481 }
1482 
1495 __STATIC_INLINE uint32_t LL_I2S_GetStandard(const SPI_TypeDef *SPIx)
1496 {
1497  return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC));
1498 }
1499 
1511 __STATIC_INLINE void LL_I2S_SetTransferMode(SPI_TypeDef *SPIx, uint32_t Mode)
1512 {
1513  MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SCFG, Mode);
1514 }
1515 
1526 __STATIC_INLINE uint32_t LL_I2S_GetTransferMode(const SPI_TypeDef *SPIx)
1527 {
1528  return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SCFG));
1529 }
1530 
1538 __STATIC_INLINE void LL_I2S_SetPrescalerLinear(SPI_TypeDef *SPIx, uint8_t PrescalerLinear)
1539 {
1540  MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_I2SDIV, PrescalerLinear);
1541 }
1542 
1549 __STATIC_INLINE uint32_t LL_I2S_GetPrescalerLinear(const SPI_TypeDef *SPIx)
1550 {
1551  return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_I2SDIV));
1552 }
1553 
1563 __STATIC_INLINE void LL_I2S_SetPrescalerParity(SPI_TypeDef *SPIx, uint32_t PrescalerParity)
1564 {
1565  MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_ODD, PrescalerParity << 8U);
1566 }
1567 
1576 __STATIC_INLINE uint32_t LL_I2S_GetPrescalerParity(const SPI_TypeDef *SPIx)
1577 {
1578  return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_ODD) >> 8U);
1579 }
1580 
1587 __STATIC_INLINE void LL_I2S_EnableMasterClock(SPI_TypeDef *SPIx)
1588 {
1589  SET_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE);
1590 }
1591 
1598 __STATIC_INLINE void LL_I2S_DisableMasterClock(SPI_TypeDef *SPIx)
1599 {
1600  CLEAR_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE);
1601 }
1602 
1609 __STATIC_INLINE uint32_t LL_I2S_IsEnabledMasterClock(const SPI_TypeDef *SPIx)
1610 {
1611  return ((READ_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE) == (SPI_I2SPR_MCKOE)) ? 1UL : 0UL);
1612 }
1613 
1614 #if defined(SPI_I2SCFGR_ASTRTEN)
1621 __STATIC_INLINE void LL_I2S_EnableAsyncStart(SPI_TypeDef *SPIx)
1622 {
1623  SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN);
1624 }
1625 
1632 __STATIC_INLINE void LL_I2S_DisableAsyncStart(SPI_TypeDef *SPIx)
1633 {
1634  CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN);
1635 }
1636 
1643 __STATIC_INLINE uint32_t LL_I2S_IsEnabledAsyncStart(const SPI_TypeDef *SPIx)
1644 {
1645  return ((READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ASTRTEN) == (SPI_I2SCFGR_ASTRTEN)) ? 1UL : 0UL);
1646 }
1647 #endif /* SPI_I2SCFGR_ASTRTEN */
1648 
1663 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_RXNE(const SPI_TypeDef *SPIx)
1664 {
1665  return LL_SPI_IsActiveFlag_RXNE(SPIx);
1666 }
1667 
1674 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_TXE(const SPI_TypeDef *SPIx)
1675 {
1676  return LL_SPI_IsActiveFlag_TXE(SPIx);
1677 }
1678 
1685 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_BSY(const SPI_TypeDef *SPIx)
1686 {
1687  return LL_SPI_IsActiveFlag_BSY(SPIx);
1688 }
1689 
1696 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_OVR(const SPI_TypeDef *SPIx)
1697 {
1698  return LL_SPI_IsActiveFlag_OVR(SPIx);
1699 }
1700 
1707 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_UDR(const SPI_TypeDef *SPIx)
1708 {
1709  return ((READ_BIT(SPIx->SR, SPI_SR_UDR) == (SPI_SR_UDR)) ? 1UL : 0UL);
1710 }
1711 
1718 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_FRE(const SPI_TypeDef *SPIx)
1719 {
1720  return LL_SPI_IsActiveFlag_FRE(SPIx);
1721 }
1722 
1732 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_CHSIDE(const SPI_TypeDef *SPIx)
1733 {
1734  return ((READ_BIT(SPIx->SR, SPI_SR_CHSIDE) == (SPI_SR_CHSIDE)) ? 1UL : 0UL);
1735 }
1736 
1743 __STATIC_INLINE void LL_I2S_ClearFlag_OVR(SPI_TypeDef *SPIx)
1744 {
1745  LL_SPI_ClearFlag_OVR(SPIx);
1746 }
1747 
1754 __STATIC_INLINE void LL_I2S_ClearFlag_UDR(SPI_TypeDef *SPIx)
1755 {
1756  __IO uint32_t tmpreg;
1757  tmpreg = SPIx->SR;
1758  (void)tmpreg;
1759 }
1760 
1767 __STATIC_INLINE void LL_I2S_ClearFlag_FRE(SPI_TypeDef *SPIx)
1768 {
1769  LL_SPI_ClearFlag_FRE(SPIx);
1770 }
1771 
1787 __STATIC_INLINE void LL_I2S_EnableIT_ERR(SPI_TypeDef *SPIx)
1788 {
1789  LL_SPI_EnableIT_ERR(SPIx);
1790 }
1791 
1798 __STATIC_INLINE void LL_I2S_EnableIT_RXNE(SPI_TypeDef *SPIx)
1799 {
1800  LL_SPI_EnableIT_RXNE(SPIx);
1801 }
1802 
1809 __STATIC_INLINE void LL_I2S_EnableIT_TXE(SPI_TypeDef *SPIx)
1810 {
1811  LL_SPI_EnableIT_TXE(SPIx);
1812 }
1813 
1821 __STATIC_INLINE void LL_I2S_DisableIT_ERR(SPI_TypeDef *SPIx)
1822 {
1823  LL_SPI_DisableIT_ERR(SPIx);
1824 }
1825 
1832 __STATIC_INLINE void LL_I2S_DisableIT_RXNE(SPI_TypeDef *SPIx)
1833 {
1834  LL_SPI_DisableIT_RXNE(SPIx);
1835 }
1836 
1843 __STATIC_INLINE void LL_I2S_DisableIT_TXE(SPI_TypeDef *SPIx)
1844 {
1845  LL_SPI_DisableIT_TXE(SPIx);
1846 }
1847 
1854 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_ERR(const SPI_TypeDef *SPIx)
1855 {
1856  return LL_SPI_IsEnabledIT_ERR(SPIx);
1857 }
1858 
1865 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_RXNE(const SPI_TypeDef *SPIx)
1866 {
1867  return LL_SPI_IsEnabledIT_RXNE(SPIx);
1868 }
1869 
1876 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_TXE(const SPI_TypeDef *SPIx)
1877 {
1878  return LL_SPI_IsEnabledIT_TXE(SPIx);
1879 }
1880 
1895 __STATIC_INLINE void LL_I2S_EnableDMAReq_RX(SPI_TypeDef *SPIx)
1896 {
1897  LL_SPI_EnableDMAReq_RX(SPIx);
1898 }
1899 
1906 __STATIC_INLINE void LL_I2S_DisableDMAReq_RX(SPI_TypeDef *SPIx)
1907 {
1909 }
1910 
1917 __STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_RX(const SPI_TypeDef *SPIx)
1918 {
1919  return LL_SPI_IsEnabledDMAReq_RX(SPIx);
1920 }
1921 
1928 __STATIC_INLINE void LL_I2S_EnableDMAReq_TX(SPI_TypeDef *SPIx)
1929 {
1930  LL_SPI_EnableDMAReq_TX(SPIx);
1931 }
1932 
1939 __STATIC_INLINE void LL_I2S_DisableDMAReq_TX(SPI_TypeDef *SPIx)
1940 {
1942 }
1943 
1950 __STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_TX(const SPI_TypeDef *SPIx)
1951 {
1952  return LL_SPI_IsEnabledDMAReq_TX(SPIx);
1953 }
1954 
1969 __STATIC_INLINE uint16_t LL_I2S_ReceiveData16(SPI_TypeDef *SPIx)
1970 {
1971  return LL_SPI_ReceiveData16(SPIx);
1972 }
1973 
1981 __STATIC_INLINE void LL_I2S_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
1982 {
1983  LL_SPI_TransmitData16(SPIx, TxData);
1984 }
1985 
1990 #if defined(USE_FULL_LL_DRIVER)
1995 ErrorStatus LL_I2S_DeInit(const SPI_TypeDef *SPIx);
1996 ErrorStatus LL_I2S_Init(SPI_TypeDef *SPIx, LL_I2S_InitTypeDef *I2S_InitStruct);
1997 void LL_I2S_StructInit(LL_I2S_InitTypeDef *I2S_InitStruct);
1998 void LL_I2S_ConfigPrescaler(SPI_TypeDef *SPIx, uint32_t PrescalerLinear, uint32_t PrescalerParity);
1999 #if defined (SPI_I2S_FULLDUPLEX_SUPPORT)
2000 ErrorStatus LL_I2S_InitFullDuplex(SPI_TypeDef *I2Sxext, LL_I2S_InitTypeDef *I2S_InitStruct);
2001 #endif /* SPI_I2S_FULLDUPLEX_SUPPORT */
2002 
2006 #endif /* USE_FULL_LL_DRIVER */
2007 
2016 #endif /* defined (SPI1) || defined (SPI2) || defined (SPI3) || defined (SPI4) || defined (SPI5) || defined(SPI6) */
2017 
2022 #ifdef __cplusplus
2023 }
2024 #endif
2025 
2026 #endif /* STM32F4xx_LL_SPI_H */
2027 
__STATIC_INLINE void LL_I2S_Disable(SPI_TypeDef *SPIx)
Disable I2S peripheral @rmtoll I2SCFGR I2SE LL_I2S_Disable.
__STATIC_INLINE void LL_I2S_SetPrescalerParity(SPI_TypeDef *SPIx, uint32_t PrescalerParity)
Set I2S parity prescaler @rmtoll I2SPR ODD LL_I2S_SetPrescalerParity.
__STATIC_INLINE uint32_t LL_I2S_GetTransferMode(const SPI_TypeDef *SPIx)
Get I2S transfer mode @rmtoll I2SCFGR I2SCFG LL_I2S_GetTransferMode.
__STATIC_INLINE uint32_t LL_I2S_IsEnabledAsyncStart(const SPI_TypeDef *SPIx)
Check if asynchronous start is enabled @rmtoll I2SCFGR ASTRTEN LL_I2S_IsEnabledAsyncStart.
__STATIC_INLINE uint32_t LL_I2S_GetPrescalerParity(const SPI_TypeDef *SPIx)
Get I2S parity prescaler @rmtoll I2SPR ODD LL_I2S_GetPrescalerParity.
__STATIC_INLINE uint32_t LL_I2S_IsEnabled(const SPI_TypeDef *SPIx)
Check if I2S peripheral is enabled @rmtoll I2SCFGR I2SE LL_I2S_IsEnabled.
__STATIC_INLINE void LL_I2S_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard)
Set I2S standard protocol @rmtoll I2SCFGR I2SSTD LL_I2S_SetStandard I2SCFGR PCMSYNC LL_I2S_SetStanda...
__STATIC_INLINE void LL_I2S_DisableAsyncStart(SPI_TypeDef *SPIx)
Disable asynchronous start @rmtoll I2SCFGR ASTRTEN LL_I2S_DisableAsyncStart.
__STATIC_INLINE uint32_t LL_I2S_GetPrescalerLinear(const SPI_TypeDef *SPIx)
Get I2S linear prescaler @rmtoll I2SPR I2SDIV LL_I2S_GetPrescalerLinear.
__STATIC_INLINE void LL_I2S_SetPrescalerLinear(SPI_TypeDef *SPIx, uint8_t PrescalerLinear)
Set I2S linear prescaler @rmtoll I2SPR I2SDIV LL_I2S_SetPrescalerLinear.
__STATIC_INLINE void LL_I2S_Enable(SPI_TypeDef *SPIx)
Select I2S mode and Enable I2S peripheral @rmtoll I2SCFGR I2SMOD LL_I2S_Enable I2SCFGR I2SE LL_I2S_E...
__STATIC_INLINE uint32_t LL_I2S_GetStandard(const SPI_TypeDef *SPIx)
Get I2S standard protocol @rmtoll I2SCFGR I2SSTD LL_I2S_GetStandard I2SCFGR PCMSYNC LL_I2S_GetStanda...
__STATIC_INLINE void LL_I2S_EnableMasterClock(SPI_TypeDef *SPIx)
Enable the master clock output (Pin MCK) @rmtoll I2SPR MCKOE LL_I2S_EnableMasterClock.
__STATIC_INLINE void LL_I2S_EnableAsyncStart(SPI_TypeDef *SPIx)
Enable asynchronous start @rmtoll I2SCFGR ASTRTEN LL_I2S_EnableAsyncStart.
__STATIC_INLINE void LL_I2S_SetDataFormat(SPI_TypeDef *SPIx, uint32_t DataFormat)
Set I2S data frame length @rmtoll I2SCFGR DATLEN LL_I2S_SetDataFormat I2SCFGR CHLEN LL_I2S_SetDataFo...
__STATIC_INLINE void LL_I2S_DisableMasterClock(SPI_TypeDef *SPIx)
Disable the master clock output (Pin MCK) @rmtoll I2SPR MCKOE LL_I2S_DisableMasterClock.
__STATIC_INLINE void LL_I2S_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity)
Set I2S clock polarity @rmtoll I2SCFGR CKPOL LL_I2S_SetClockPolarity.
__STATIC_INLINE uint32_t LL_I2S_GetClockPolarity(const SPI_TypeDef *SPIx)
Get I2S clock polarity @rmtoll I2SCFGR CKPOL LL_I2S_GetClockPolarity.
__STATIC_INLINE void LL_I2S_SetTransferMode(SPI_TypeDef *SPIx, uint32_t Mode)
Set I2S transfer mode @rmtoll I2SCFGR I2SCFG LL_I2S_SetTransferMode.
__STATIC_INLINE uint32_t LL_I2S_IsEnabledMasterClock(const SPI_TypeDef *SPIx)
Check if the master clock output (Pin MCK) is enabled @rmtoll I2SPR MCKOE LL_I2S_IsEnabledMasterClock...
__STATIC_INLINE uint32_t LL_I2S_GetDataFormat(const SPI_TypeDef *SPIx)
Get I2S data frame length @rmtoll I2SCFGR DATLEN LL_I2S_GetDataFormat I2SCFGR CHLEN LL_I2S_GetDataFo...
__STATIC_INLINE void LL_I2S_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
Write 16-Bits in data register @rmtoll DR DR LL_I2S_TransmitData16.
__STATIC_INLINE uint16_t LL_I2S_ReceiveData16(SPI_TypeDef *SPIx)
Read 16-Bits in data register @rmtoll DR DR LL_I2S_ReceiveData16.
__STATIC_INLINE void LL_I2S_DisableDMAReq_TX(SPI_TypeDef *SPIx)
Disable DMA Tx @rmtoll CR2 TXDMAEN LL_I2S_DisableDMAReq_TX.
__STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_RX(const SPI_TypeDef *SPIx)
Check if DMA Rx is enabled @rmtoll CR2 RXDMAEN LL_I2S_IsEnabledDMAReq_RX.
__STATIC_INLINE void LL_I2S_DisableDMAReq_RX(SPI_TypeDef *SPIx)
Disable DMA Rx @rmtoll CR2 RXDMAEN LL_I2S_DisableDMAReq_RX.
__STATIC_INLINE void LL_I2S_EnableDMAReq_TX(SPI_TypeDef *SPIx)
Enable DMA Tx @rmtoll CR2 TXDMAEN LL_I2S_EnableDMAReq_TX.
__STATIC_INLINE void LL_I2S_EnableDMAReq_RX(SPI_TypeDef *SPIx)
Enable DMA Rx @rmtoll CR2 RXDMAEN LL_I2S_EnableDMAReq_RX.
__STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_TX(const SPI_TypeDef *SPIx)
Check if DMA Tx is enabled @rmtoll CR2 TXDMAEN LL_I2S_IsEnabledDMAReq_TX.
__STATIC_INLINE void LL_I2S_ClearFlag_UDR(SPI_TypeDef *SPIx)
Clear underrun error flag @rmtoll SR UDR LL_I2S_ClearFlag_UDR.
__STATIC_INLINE void LL_I2S_ClearFlag_OVR(SPI_TypeDef *SPIx)
Clear overrun error flag @rmtoll SR OVR LL_I2S_ClearFlag_OVR.
__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_OVR(const SPI_TypeDef *SPIx)
Get overrun error flag @rmtoll SR OVR LL_I2S_IsActiveFlag_OVR.
__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_BSY(const SPI_TypeDef *SPIx)
Get busy flag @rmtoll SR BSY LL_I2S_IsActiveFlag_BSY.
__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_CHSIDE(const SPI_TypeDef *SPIx)
Get channel side flag.
__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_FRE(const SPI_TypeDef *SPIx)
Get frame format error flag @rmtoll SR FRE LL_I2S_IsActiveFlag_FRE.
__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_RXNE(const SPI_TypeDef *SPIx)
Check if Rx buffer is not empty @rmtoll SR RXNE LL_I2S_IsActiveFlag_RXNE.
__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_TXE(const SPI_TypeDef *SPIx)
Check if Tx buffer is empty @rmtoll SR TXE LL_I2S_IsActiveFlag_TXE.
__STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_UDR(const SPI_TypeDef *SPIx)
Get underrun error flag @rmtoll SR UDR LL_I2S_IsActiveFlag_UDR.
__STATIC_INLINE void LL_I2S_ClearFlag_FRE(SPI_TypeDef *SPIx)
Clear frame format error flag @rmtoll SR FRE LL_I2S_ClearFlag_FRE.
__STATIC_INLINE void LL_I2S_EnableIT_ERR(SPI_TypeDef *SPIx)
Enable error IT.
__STATIC_INLINE void LL_I2S_EnableIT_TXE(SPI_TypeDef *SPIx)
Enable Tx buffer empty IT @rmtoll CR2 TXEIE LL_I2S_EnableIT_TXE.
__STATIC_INLINE void LL_I2S_EnableIT_RXNE(SPI_TypeDef *SPIx)
Enable Rx buffer not empty IT @rmtoll CR2 RXNEIE LL_I2S_EnableIT_RXNE.
__STATIC_INLINE void LL_I2S_DisableIT_ERR(SPI_TypeDef *SPIx)
Disable error IT.
__STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_RXNE(const SPI_TypeDef *SPIx)
Check if RXNE IT is enabled @rmtoll CR2 RXNEIE LL_I2S_IsEnabledIT_RXNE.
__STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_TXE(const SPI_TypeDef *SPIx)
Check if TXE IT is enabled @rmtoll CR2 TXEIE LL_I2S_IsEnabledIT_TXE.
__STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_ERR(const SPI_TypeDef *SPIx)
Check if ERR IT is enabled @rmtoll CR2 ERRIE LL_I2S_IsEnabledIT_ERR.
__STATIC_INLINE void LL_I2S_DisableIT_TXE(SPI_TypeDef *SPIx)
Disable Tx buffer empty IT @rmtoll CR2 TXEIE LL_I2S_DisableIT_TXE.
__STATIC_INLINE void LL_I2S_DisableIT_RXNE(SPI_TypeDef *SPIx)
Disable Rx buffer not empty IT @rmtoll CR2 RXNEIE LL_I2S_DisableIT_RXNE.
ErrorStatus LL_I2S_InitFullDuplex(SPI_TypeDef *I2Sxext, LL_I2S_InitTypeDef *I2S_InitStruct)
Configures the full duplex mode for the I2Sx peripheral using its extension I2Sxext according to the ...
ErrorStatus LL_I2S_Init(SPI_TypeDef *SPIx, LL_I2S_InitTypeDef *I2S_InitStruct)
Initializes the SPI/I2S registers according to the specified parameters in I2S_InitStruct.
void LL_I2S_ConfigPrescaler(SPI_TypeDef *SPIx, uint32_t PrescalerLinear, uint32_t PrescalerParity)
Set linear and parity prescaler.
ErrorStatus LL_I2S_DeInit(const SPI_TypeDef *SPIx)
De-initialize the SPI/I2S registers to their default reset values.
void LL_I2S_StructInit(LL_I2S_InitTypeDef *I2S_InitStruct)
Set each LL_I2S_InitTypeDef field to default value.
I2S Init structure definition.
__STATIC_INLINE uint32_t LL_SPI_GetRxCRC(const SPI_TypeDef *SPIx)
Get Rx CRC @rmtoll RXCRCR RXCRC LL_SPI_GetRxCRC.
__STATIC_INLINE void LL_SPI_SetCRCPolynomial(SPI_TypeDef *SPIx, uint32_t CRCPoly)
Set polynomial for CRC calculation @rmtoll CRCPR CRCPOLY LL_SPI_SetCRCPolynomial.
__STATIC_INLINE void LL_SPI_EnableCRC(SPI_TypeDef *SPIx)
Enable CRC.
__STATIC_INLINE void LL_SPI_DisableCRC(SPI_TypeDef *SPIx)
Disable CRC.
__STATIC_INLINE uint32_t LL_SPI_IsEnabledCRC(const SPI_TypeDef *SPIx)
Check if CRC is enabled.
__STATIC_INLINE uint32_t LL_SPI_GetTxCRC(const SPI_TypeDef *SPIx)
Get Tx CRC @rmtoll TXCRCR TXCRC LL_SPI_GetTxCRC.
__STATIC_INLINE uint32_t LL_SPI_GetCRCPolynomial(const SPI_TypeDef *SPIx)
Get polynomial for CRC calculation @rmtoll CRCPR CRCPOLY LL_SPI_GetCRCPolynomial.
__STATIC_INLINE void LL_SPI_SetCRCNext(SPI_TypeDef *SPIx)
Set CRCNext to transfer CRC on the line.
__STATIC_INLINE void LL_SPI_Enable(SPI_TypeDef *SPIx)
Enable SPI peripheral @rmtoll CR1 SPE LL_SPI_Enable.
__STATIC_INLINE uint32_t LL_SPI_GetClockPhase(const SPI_TypeDef *SPIx)
Get clock phase @rmtoll CR1 CPHA LL_SPI_GetClockPhase.
__STATIC_INLINE void LL_SPI_SetBaudRatePrescaler(SPI_TypeDef *SPIx, uint32_t BaudRate)
Set baud rate prescaler.
__STATIC_INLINE uint32_t LL_SPI_GetTransferDirection(const SPI_TypeDef *SPIx)
Get transfer direction mode @rmtoll CR1 RXONLY LL_SPI_GetTransferDirection CR1 BIDIMODE LL_SPI_GetTr...
__STATIC_INLINE uint32_t LL_SPI_GetMode(const SPI_TypeDef *SPIx)
Get SPI operation mode (Master or Slave) @rmtoll CR1 MSTR LL_SPI_GetMode CR1 SSI LL_SPI_GetMode.
__STATIC_INLINE uint32_t LL_SPI_GetDataWidth(const SPI_TypeDef *SPIx)
Get frame data width @rmtoll CR1 DFF LL_SPI_GetDataWidth.
__STATIC_INLINE void LL_SPI_SetMode(SPI_TypeDef *SPIx, uint32_t Mode)
Set SPI operation mode to Master or Slave.
__STATIC_INLINE void LL_SPI_SetTransferDirection(SPI_TypeDef *SPIx, uint32_t TransferDirection)
Set transfer direction mode.
__STATIC_INLINE uint32_t LL_SPI_IsEnabled(const SPI_TypeDef *SPIx)
Check if SPI peripheral is enabled @rmtoll CR1 SPE LL_SPI_IsEnabled.
__STATIC_INLINE uint32_t LL_SPI_GetClockPolarity(const SPI_TypeDef *SPIx)
Get clock polarity @rmtoll CR1 CPOL LL_SPI_GetClockPolarity.
__STATIC_INLINE void LL_SPI_SetTransferBitOrder(SPI_TypeDef *SPIx, uint32_t BitOrder)
Set transfer bit order.
__STATIC_INLINE void LL_SPI_SetDataWidth(SPI_TypeDef *SPIx, uint32_t DataWidth)
Set frame data width @rmtoll CR1 DFF LL_SPI_SetDataWidth.
__STATIC_INLINE uint32_t LL_SPI_GetTransferBitOrder(const SPI_TypeDef *SPIx)
Get transfer bit order @rmtoll CR1 LSBFIRST LL_SPI_GetTransferBitOrder.
__STATIC_INLINE void LL_SPI_Disable(SPI_TypeDef *SPIx)
Disable SPI peripheral.
__STATIC_INLINE void LL_SPI_SetClockPhase(SPI_TypeDef *SPIx, uint32_t ClockPhase)
Set clock phase.
__STATIC_INLINE uint32_t LL_SPI_GetBaudRatePrescaler(const SPI_TypeDef *SPIx)
Get baud rate prescaler @rmtoll CR1 BR LL_SPI_GetBaudRatePrescaler.
__STATIC_INLINE void LL_SPI_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity)
Set clock polarity.
__STATIC_INLINE uint32_t LL_SPI_GetStandard(const SPI_TypeDef *SPIx)
Get serial protocol used @rmtoll CR2 FRF LL_SPI_GetStandard.
__STATIC_INLINE void LL_SPI_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard)
Set serial protocol used.
__STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
Write 8-Bits in the data register @rmtoll DR DR LL_SPI_TransmitData8.
__STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
Write 16-Bits in the data register @rmtoll DR DR LL_SPI_TransmitData16.
__STATIC_INLINE uint16_t LL_SPI_ReceiveData16(SPI_TypeDef *SPIx)
Read 16-Bits in the data register @rmtoll DR DR LL_SPI_ReceiveData16.
__STATIC_INLINE uint8_t LL_SPI_ReceiveData8(SPI_TypeDef *SPIx)
Read 8-Bits in the data register @rmtoll DR DR LL_SPI_ReceiveData8.
__STATIC_INLINE void LL_SPI_EnableDMAReq_RX(SPI_TypeDef *SPIx)
Enable DMA Rx @rmtoll CR2 RXDMAEN LL_SPI_EnableDMAReq_RX.
__STATIC_INLINE void LL_SPI_DisableDMAReq_RX(SPI_TypeDef *SPIx)
Disable DMA Rx @rmtoll CR2 RXDMAEN LL_SPI_DisableDMAReq_RX.
__STATIC_INLINE uint32_t LL_SPI_DMA_GetRegAddr(const SPI_TypeDef *SPIx)
Get the data register address used for DMA transfer @rmtoll DR DR LL_SPI_DMA_GetRegAddr.
__STATIC_INLINE void LL_SPI_DisableDMAReq_TX(SPI_TypeDef *SPIx)
Disable DMA Tx @rmtoll CR2 TXDMAEN LL_SPI_DisableDMAReq_TX.
__STATIC_INLINE void LL_SPI_EnableDMAReq_TX(SPI_TypeDef *SPIx)
Enable DMA Tx @rmtoll CR2 TXDMAEN LL_SPI_EnableDMAReq_TX.
__STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_TX(const SPI_TypeDef *SPIx)
Check if DMA Tx is enabled @rmtoll CR2 TXDMAEN LL_SPI_IsEnabledDMAReq_TX.
__STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_RX(const SPI_TypeDef *SPIx)
Check if DMA Rx is enabled @rmtoll CR2 RXDMAEN LL_SPI_IsEnabledDMAReq_RX.
__STATIC_INLINE void LL_SPI_ClearFlag_CRCERR(SPI_TypeDef *SPIx)
Clear CRC error flag @rmtoll SR CRCERR LL_SPI_ClearFlag_CRCERR.
__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_MODF(const SPI_TypeDef *SPIx)
Get mode fault error flag @rmtoll SR MODF LL_SPI_IsActiveFlag_MODF.
__STATIC_INLINE void LL_SPI_ClearFlag_OVR(SPI_TypeDef *SPIx)
Clear overrun error flag.
__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_CRCERR(const SPI_TypeDef *SPIx)
Get CRC error flag @rmtoll SR CRCERR LL_SPI_IsActiveFlag_CRCERR.
__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_TXE(const SPI_TypeDef *SPIx)
Check if Tx buffer is empty @rmtoll SR TXE LL_SPI_IsActiveFlag_TXE.
__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_FRE(const SPI_TypeDef *SPIx)
Get frame format error flag @rmtoll SR FRE LL_SPI_IsActiveFlag_FRE.
__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_BSY(const SPI_TypeDef *SPIx)
Get busy flag.
__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_RXNE(const SPI_TypeDef *SPIx)
Check if Rx buffer is not empty @rmtoll SR RXNE LL_SPI_IsActiveFlag_RXNE.
__STATIC_INLINE void LL_SPI_ClearFlag_MODF(SPI_TypeDef *SPIx)
Clear mode fault error flag.
__STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_OVR(const SPI_TypeDef *SPIx)
Get overrun error flag @rmtoll SR OVR LL_SPI_IsActiveFlag_OVR.
__STATIC_INLINE void LL_SPI_ClearFlag_FRE(SPI_TypeDef *SPIx)
Clear frame format error flag.
__STATIC_INLINE void LL_SPI_DisableIT_TXE(SPI_TypeDef *SPIx)
Disable Tx buffer empty interrupt @rmtoll CR2 TXEIE LL_SPI_DisableIT_TXE.
__STATIC_INLINE void LL_SPI_EnableIT_RXNE(SPI_TypeDef *SPIx)
Enable Rx buffer not empty interrupt @rmtoll CR2 RXNEIE LL_SPI_EnableIT_RXNE.
__STATIC_INLINE void LL_SPI_EnableIT_TXE(SPI_TypeDef *SPIx)
Enable Tx buffer empty interrupt @rmtoll CR2 TXEIE LL_SPI_EnableIT_TXE.
__STATIC_INLINE void LL_SPI_DisableIT_RXNE(SPI_TypeDef *SPIx)
Disable Rx buffer not empty interrupt @rmtoll CR2 RXNEIE LL_SPI_DisableIT_RXNE.
__STATIC_INLINE void LL_SPI_DisableIT_ERR(SPI_TypeDef *SPIx)
Disable error interrupt.
__STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_ERR(const SPI_TypeDef *SPIx)
Check if error interrupt is enabled @rmtoll CR2 ERRIE LL_SPI_IsEnabledIT_ERR.
__STATIC_INLINE void LL_SPI_EnableIT_ERR(SPI_TypeDef *SPIx)
Enable error interrupt.
__STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_RXNE(const SPI_TypeDef *SPIx)
Check if Rx buffer not empty interrupt is enabled @rmtoll CR2 RXNEIE LL_SPI_IsEnabledIT_RXNE.
__STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_TXE(const SPI_TypeDef *SPIx)
Check if Tx buffer empty interrupt @rmtoll CR2 TXEIE LL_SPI_IsEnabledIT_TXE.
ErrorStatus LL_SPI_DeInit(const SPI_TypeDef *SPIx)
De-initialize the SPI registers to their default reset values.
void LL_SPI_StructInit(LL_SPI_InitTypeDef *SPI_InitStruct)
Set each LL_SPI_InitTypeDef field to default value.
ErrorStatus LL_SPI_Init(SPI_TypeDef *SPIx, LL_SPI_InitTypeDef *SPI_InitStruct)
Initialize the SPI registers according to the specified parameters in SPI_InitStruct.
__STATIC_INLINE uint32_t LL_SPI_GetNSSMode(const SPI_TypeDef *SPIx)
Get NSS mode @rmtoll CR1 SSM LL_SPI_GetNSSMode @rmtoll CR2 SSOE LL_SPI_GetNSSMode.
__STATIC_INLINE void LL_SPI_SetNSSMode(SPI_TypeDef *SPIx, uint32_t NSS)
Set NSS mode.
SPI Init structures definition.