Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 6 | ||
|---|---|---|---|
| Line 327... | Line 327... | ||
| 327 | } |
327 | } |
| 328 | 328 | ||
| 329 | /* I2S standard */ |
329 | /* I2S standard */ |
| 330 | if (hi2s->Init.Standard <= I2S_STANDARD_LSB) |
330 | if (hi2s->Init.Standard <= I2S_STANDARD_LSB) |
| 331 | { |
331 | { |
| 332 | /* In I2S standard packet lenght is multiplied by 2 */ |
332 | /* In I2S standard packet length is multiplied by 2 */ |
| 333 | packetlength = packetlength * 2U; |
333 | packetlength = packetlength * 2U; |
| 334 | } |
334 | } |
| 335 | 335 | ||
| 336 | /* Get the source clock value: based on System Clock value */ |
336 | /* Get the source clock value: based on System Clock value */ |
| 337 | i2sclk = HAL_RCC_GetSysClockFreq(); |
337 | i2sclk = HAL_RCC_GetSysClockFreq(); |
| Line 732... | Line 732... | ||
| 732 | * @param pData a 16-bit pointer to data buffer. |
732 | * @param pData a 16-bit pointer to data buffer. |
| 733 | * @param Size number of data sample to be sent: |
733 | * @param Size number of data sample to be sent: |
| 734 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
734 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
| 735 | * configuration phase, the Size parameter means the number of 16-bit data length |
735 | * configuration phase, the Size parameter means the number of 16-bit data length |
| 736 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
736 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
| 737 | * the Size parameter means the number of 16-bit data length. |
737 | * the Size parameter means the number of 24-bit or 32-bit data length. |
| 738 | * @param Timeout Timeout duration |
738 | * @param Timeout Timeout duration |
| 739 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
739 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
| 740 | * between Master and Slave(example: audio streaming). |
740 | * between Master and Slave(example: audio streaming). |
| 741 | * @retval HAL status |
741 | * @retval HAL status |
| 742 | */ |
742 | */ |
| Line 849... | Line 849... | ||
| 849 | * @param pData a 16-bit pointer to data buffer. |
849 | * @param pData a 16-bit pointer to data buffer. |
| 850 | * @param Size number of data sample to be sent: |
850 | * @param Size number of data sample to be sent: |
| 851 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
851 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
| 852 | * configuration phase, the Size parameter means the number of 16-bit data length |
852 | * configuration phase, the Size parameter means the number of 16-bit data length |
| 853 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
853 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
| 854 | * the Size parameter means the number of 16-bit data length. |
854 | * the Size parameter means the number of 24-bit or 32-bit data length. |
| 855 | * @param Timeout Timeout duration |
855 | * @param Timeout Timeout duration |
| 856 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
856 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
| 857 | * between Master and Slave(example: audio streaming). |
857 | * between Master and Slave(example: audio streaming). |
| 858 | * @note In I2S Master Receiver mode, just after enabling the peripheral the clock will be generate |
858 | * @note In I2S Master Receiver mode, just after enabling the peripheral the clock will be generate |
| 859 | * in continuous way and as the I2S is not disabled at the end of the I2S transaction. |
859 | * in continuous way and as the I2S is not disabled at the end of the I2S transaction. |
| Line 950... | Line 950... | ||
| 950 | * @param pData a 16-bit pointer to data buffer. |
950 | * @param pData a 16-bit pointer to data buffer. |
| 951 | * @param Size number of data sample to be sent: |
951 | * @param Size number of data sample to be sent: |
| 952 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
952 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
| 953 | * configuration phase, the Size parameter means the number of 16-bit data length |
953 | * configuration phase, the Size parameter means the number of 16-bit data length |
| 954 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
954 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
| 955 | * the Size parameter means the number of 16-bit data length. |
955 | * the Size parameter means the number of 24-bit or 32-bit data length. |
| 956 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
956 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
| 957 | * between Master and Slave(example: audio streaming). |
957 | * between Master and Slave(example: audio streaming). |
| 958 | * @retval HAL status |
958 | * @retval HAL status |
| 959 | */ |
959 | */ |
| 960 | HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) |
960 | HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) |
| Line 1014... | Line 1014... | ||
| 1014 | * @param pData a 16-bit pointer to the Receive data buffer. |
1014 | * @param pData a 16-bit pointer to the Receive data buffer. |
| 1015 | * @param Size number of data sample to be sent: |
1015 | * @param Size number of data sample to be sent: |
| 1016 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
1016 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
| 1017 | * configuration phase, the Size parameter means the number of 16-bit data length |
1017 | * configuration phase, the Size parameter means the number of 16-bit data length |
| 1018 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
1018 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
| 1019 | * the Size parameter means the number of 16-bit data length. |
1019 | * the Size parameter means the number of 24-bit or 32-bit data length. |
| 1020 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
1020 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
| 1021 | * between Master and Slave(example: audio streaming). |
1021 | * between Master and Slave(example: audio streaming). |
| 1022 | * @note It is recommended to use DMA for the I2S receiver to avoid de-synchronization |
1022 | * @note It is recommended to use DMA for the I2S receiver to avoid de-synchronization |
| 1023 | * between Master and Slave otherwise the I2S interrupt should be optimized. |
1023 | * between Master and Slave otherwise the I2S interrupt should be optimized. |
| 1024 | * @retval HAL status |
1024 | * @retval HAL status |
| Line 1080... | Line 1080... | ||
| 1080 | * @param pData a 16-bit pointer to the Transmit data buffer. |
1080 | * @param pData a 16-bit pointer to the Transmit data buffer. |
| 1081 | * @param Size number of data sample to be sent: |
1081 | * @param Size number of data sample to be sent: |
| 1082 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
1082 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
| 1083 | * configuration phase, the Size parameter means the number of 16-bit data length |
1083 | * configuration phase, the Size parameter means the number of 16-bit data length |
| 1084 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
1084 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
| 1085 | * the Size parameter means the number of 16-bit data length. |
1085 | * the Size parameter means the number of 24-bit or 32-bit data length. |
| 1086 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
1086 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
| 1087 | * between Master and Slave(example: audio streaming). |
1087 | * between Master and Slave(example: audio streaming). |
| 1088 | * @retval HAL status |
1088 | * @retval HAL status |
| 1089 | */ |
1089 | */ |
| 1090 | HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) |
1090 | HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) |
| Line 1171... | Line 1171... | ||
| 1171 | * @param pData a 16-bit pointer to the Receive data buffer. |
1171 | * @param pData a 16-bit pointer to the Receive data buffer. |
| 1172 | * @param Size number of data sample to be sent: |
1172 | * @param Size number of data sample to be sent: |
| 1173 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
1173 | * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S |
| 1174 | * configuration phase, the Size parameter means the number of 16-bit data length |
1174 | * configuration phase, the Size parameter means the number of 16-bit data length |
| 1175 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
1175 | * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected |
| 1176 | * the Size parameter means the number of 16-bit data length. |
1176 | * the Size parameter means the number of 24-bit or 32-bit data length. |
| 1177 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
1177 | * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization |
| 1178 | * between Master and Slave(example: audio streaming). |
1178 | * between Master and Slave(example: audio streaming). |
| 1179 | * @retval HAL status |
1179 | * @retval HAL status |
| 1180 | */ |
1180 | */ |
| 1181 | HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) |
1181 | HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) |