Macros | Functions | Variables
stm32h735/stm32h735g-dk/Src/pv_audio_rec.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "pdm2pcm.h"
#include "picovoice.h"
#include "main.h"
Include dependency graph for stm32h735/stm32h735g-dk/Src/pv_audio_rec.c:

Go to the source code of this file.

Macros

#define AUDIO_IN_PCM_BUFFER_SIZE   (MIC_CAPTURE_IT_MS * 16)
 
#define PV_AUDIO_DUMP_BUFFER_SIZE   ((uint32_t)(PV_AUDIO_DUMP_DURATION_SEC * PV_AUDIO_REC_AUDIO_FREQUENCY))
 
#define PV_AUDIO_DUMP_DURATION_SEC   (3)
 
#define PV_AUDIO_REC_AUDIO_FREQUENCY   (16000U)
 
#define PV_AUDIO_REC_AUDIO_FREQUENCY   (16000U)
 
#define PV_AUDIO_REC_CHANNEL_NUMBER   (1)
 
#define PV_AUDIO_REC_RECORD_BUFFER_SIZE   (512)
 
#define PV_AUDIO_REC_VOLUME_LEVEL   (80)
 

Functions

static void MX_BDMA_Init (void)
 
static void MX_CRC_Init (void)
 
static void MX_DMA_Init (void)
 
static void MX_SAI4_Init (void)
 
const int16_t * pv_audio_rec_get_new_buffer (void)
 
pv_status_t pv_audio_rec_init (void)
 
pv_status_t pv_audio_rec_start (void)
 
pv_status_t pv_audio_rec_stop (void)
 
void pv_pcm_process (int16_t *record_pcm_buffer)
 

Variables

static int32_t buffer_index = 0
 
CRC_HandleTypeDef hcrc
 
DMA_HandleTypeDef hdma_sai4_a
 
SAI_HandleTypeDef hsai_BlockA4
 
UART_HandleTypeDef huart
 
static int32_t last_read_index = -1
 
static int16_t ping_pong_buffer [2][PV_AUDIO_REC_RECORD_BUFFER_SIZE]
 
struct {
   uint32_t   audio_frequency
 
   uint32_t   channel_number
 
   bool   is_recording
 
   uint32_t   record_buffer_size
 
   uint16_t *   record_pcm_buffer
 
pv_audio_rec
 
static int32_t read_index = 1
 
static int32_t write_index = 0
 

Macro Definition Documentation

◆ AUDIO_IN_PCM_BUFFER_SIZE

#define AUDIO_IN_PCM_BUFFER_SIZE   (MIC_CAPTURE_IT_MS * 16)

Definition at line 27 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ PV_AUDIO_DUMP_BUFFER_SIZE

#define PV_AUDIO_DUMP_BUFFER_SIZE   ((uint32_t)(PV_AUDIO_DUMP_DURATION_SEC * PV_AUDIO_REC_AUDIO_FREQUENCY))

Definition at line 44 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ PV_AUDIO_DUMP_DURATION_SEC

#define PV_AUDIO_DUMP_DURATION_SEC   (3)

Definition at line 42 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ PV_AUDIO_REC_AUDIO_FREQUENCY [1/2]

#define PV_AUDIO_REC_AUDIO_FREQUENCY   (16000U)

Definition at line 43 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ PV_AUDIO_REC_AUDIO_FREQUENCY [2/2]

#define PV_AUDIO_REC_AUDIO_FREQUENCY   (16000U)

Definition at line 43 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ PV_AUDIO_REC_CHANNEL_NUMBER

#define PV_AUDIO_REC_CHANNEL_NUMBER   (1)

Definition at line 23 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ PV_AUDIO_REC_RECORD_BUFFER_SIZE

#define PV_AUDIO_REC_RECORD_BUFFER_SIZE   (512)

Definition at line 24 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ PV_AUDIO_REC_VOLUME_LEVEL

#define PV_AUDIO_REC_VOLUME_LEVEL   (80)

Definition at line 25 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

Function Documentation

◆ MX_BDMA_Init()

static void MX_BDMA_Init ( void  )
static

Definition at line 89 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ MX_CRC_Init()

static void MX_CRC_Init ( void  )
static

Definition at line 104 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ MX_DMA_Init()

static void MX_DMA_Init ( void  )
static

Definition at line 97 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ MX_SAI4_Init()

static void MX_SAI4_Init ( void  )
static

Definition at line 54 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ pv_audio_rec_get_new_buffer()

const int16_t* pv_audio_rec_get_new_buffer ( void  )

Definition at line 142 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ pv_audio_rec_init()

pv_status_t pv_audio_rec_init ( void  )

Definition at line 120 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ pv_audio_rec_start()

pv_status_t pv_audio_rec_start ( void  )

Definition at line 131 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ pv_audio_rec_stop()

pv_status_t pv_audio_rec_stop ( void  )

Definition at line 137 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ pv_pcm_process()

void pv_pcm_process ( int16_t *  record_pcm_buffer)

Definition at line 156 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

Variable Documentation

◆ audio_frequency

uint32_t audio_frequency

Definition at line 48 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ buffer_index

int32_t buffer_index = 0
static

Definition at line 34 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ channel_number

uint32_t channel_number

Definition at line 47 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ hcrc

Definition at line 36 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ hdma_sai4_a

DMA_HandleTypeDef hdma_sai4_a

Definition at line 40 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ hsai_BlockA4

SAI_HandleTypeDef hsai_BlockA4

Definition at line 39 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ huart

Definition at line 38 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ is_recording

bool is_recording

Definition at line 51 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ last_read_index

int32_t last_read_index = -1
static

Definition at line 31 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ ping_pong_buffer

int16_t ping_pong_buffer[2][PV_AUDIO_REC_RECORD_BUFFER_SIZE]
static

Definition at line 29 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ pv_audio_rec

struct { ... } pv_audio_rec

◆ read_index

int32_t read_index = 1
static

Definition at line 32 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ record_buffer_size

uint32_t record_buffer_size

Definition at line 49 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ record_pcm_buffer

uint16_t* record_pcm_buffer

Definition at line 50 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.

◆ write_index

int32_t write_index = 0
static

Definition at line 33 of file stm32h735/stm32h735g-dk/Src/pv_audio_rec.c.



picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:15:00