Загрузка данных


#ifndef ZEPHYR_I2S_DEV_H_
#define ZEPHYR_I2S_DEV_H_

#if 1//def MY_CODE
#define SAMPLE_FREQUENCY    16000
#define NUM_BLOCK_COUNT 16
#else
#define SAMPLE_FREQUENCY    8000
#define NUM_BLOCK_COUNT 32
#endif
#define NUMBER_OF_CHANNELS  1
#define SAMPLE_BIT_WIDTH    16
#define BYTES_PER_SAMPLE    sizeof(int16_t)

#define ZEPHYR_AUDIO_INITIAL_BLOCKS 2
#if 1//def MY_CODE
/* Such block length provides an echo with the delay of 100 ms. */
#define SAMPLES_PER_BLOCK   ((SAMPLE_FREQUENCY / 10) * NUMBER_OF_CHANNELS)
#define ZEPHYR_AUDIO_BLOCK_COUNT ZEPHYR_AUDIO_INITIAL_BLOCKS + NUM_BLOCK_COUNT
#else
/* Such block length provides an echo with the delay of 20 ms. */
//#define SAMPLES_PER_BLOCK   ((SAMPLE_FREQUENCY / 20) * NUMBER_OF_CHANNELS)
#define SAMPLES_PER_BLOCK   ((SAMPLE_FREQUENCY / 50) * NUMBER_OF_CHANNELS)
// 34 block's per 20ms
#define ZEPHYR_AUDIO_BLOCK_COUNT ZEPHYR_AUDIO_INITIAL_BLOCKS + NUM_BLOCK_COUNT
#endif

#define ZEPHYR_AUDIO_BLOCK_SIZE  (BYTES_PER_SAMPLE * SAMPLES_PER_BLOCK)

typedef void I2S_Stream;

int zephyr_i2s_audio_init(void);
int zephyr_i2s_get_rate();
int zephyr_i2s_open_stream(I2S_Stream **stream, uint8_t *buf, uint8_t audio_in);
int zephyr_i2s_close_stream(I2S_Stream *stream);
int zephyr_i2s_start(uint8_t audio_in);
int zephyr_i2s_stop(uint8_t audio_in);

#endif /* ZEPHYR_I2S_DEV_H_ */