Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 10 months ago.
Which API to use: stm32f4xx_hal_i2s.h vs stm32f4xx_hal_i2s_ex.h?
I recently picked up a ST Nucleo F401RE for an audio project. I am trying to comprehend the I2S API for the STM32F401. There are 2 primary headers with I2S prototypes:
- https://mbed.org/users/mbed_official/code/mbed/docs/6473597d706e/stm32f4xx__hal__i2s_8h.html and
- https://mbed.org/users/mbed_official/code/mbed/docs/6473597d706e/stm32f4xx__hal__i2s__ex_8h.html
In stm32f4xx_hal_i2s.h, there are API prototypes like:
stm32f4xx_hal_i2s.h protos
... /* I/O operation functions *****************************************************/ /* Blocking mode: Polling */ HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout); HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout); ...
In stm32f4xx_hal_i2s_ex.h, there are API prototypes like:
stm32f4xx_hal_i2s_ex.h protos
... HAL_StatusTypeDef HAL_I2SEx_TransmitReceive(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size, uint32_t Timeout); ...
So, my question is: which API should I use? Does it matter which one I choose? I see a number of HAL APIs have an "_ex.h" API header. What exactly are the "extension features" APIs? When should these be used instead of the non-"_ex.h" API?
Thanks, Jonathan
1 Answer
10 years, 10 months ago.
Hi,
You can use both of them... The functions in "_i2s.h" are common for all the STM32 devices while the functions in "_i2s_ex.h" file are more specific to a family/part number. I think you should try first with "_i2s.h" functions. Your code will be also more portable between other stm32 devices. If you cannot do exactly what you want, you can use the "_i2s_ex.h" functions instead.
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00107720.pdf
Regards.