kendryte / kendryte-standalone-sdk

Standalone SDK for kendryte K210
https://kendryte.com
Apache License 2.0
440 stars 161 forks source link

issue on function i2s_init() #119

Open TEFMA opened 3 years ago

TEFMA commented 3 years ago

FEATURE REQUEST

Workarounds

Hi, I want to read multi-channel I2S data for sound source localization. And I have 8 I2S microphones, using I2S0 on K210 to read them and met some issues:

  1. I am wondering how to set the parameter "uint32_t channel_mask" correctly? Which is in function "void i2s_init(i2s_device_number_t device_num, i2s_transmit_t rxtx_mode, uint32_t channel_mask)"

    I already checked the params' brief introcduction of i2s_init(): /**

    • @brief I2s init
    • @param[in] device_num The device number
    • @param[in] rxtx_mode I2s work mode
    • @param[in] channel_mask Channel mask to which channel work
    • */ It seems that the parameter "channel_mask" will decide which channel work.

  2. There is another function when K210 read the I2S signal, that is: /**

    • @brief I2S receive channel configure
    • @param[in] device_num The device number
    • @param[in] channel_num The channel number
    • @param[in] word_length The word length
    • @param[in] word_select_size The word select size
    • @param[in] trigger_level The trigger level */ void i2s_rx_channel_config(i2s_device_number_t device_num, i2s_channel_num_t channel_num, i2s_word_length_t word_length, i2s_word_select_cycles_t word_select_size, i2s_fifo_threshold_t trigger_level, i2s_work_mode_t word_mode);

Note that this function has a parameter "i2s_channel_num_t channel_num", it also seems to be related to channel selection.

How to set the param "channel_mask" in function "i2s_init()" and the param "channel_num" in function "i2s_rx_channel_config"? many thanks!