Macros | Functions | Variables
psoc062s2/src/pv_audio_rec.c File Reference
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include "cybsp.h"
#include "cyhal.h"
#include "picovoice.h"
Include dependency graph for psoc062s2/src/pv_audio_rec.c:

Go to the source code of this file.

Macros

#define AUDIO_SYS_CLOCK_HZ   (24576000u)
 
#define DECIMATION_RATE   (96u)
 
#define PDM_CLK   (P10_4)
 
#define PDM_DATA   (P10_5)
 
#define PV_AUDIO_REC_AUDIO_FREQUENCY   (16000U)
 
#define PV_AUDIO_REC_CHANNEL_NUMBER   (1)
 
#define PV_AUDIO_REC_RECORD_BUFFER_SIZE   (512)
 

Functions

cy_rslt_t pdm_pcm_clock_init (void)
 
void pdm_pcm_isr_handler (void *arg, cyhal_pdm_pcm_event_t event)
 
void pv_audio_rec_deinit (void)
 
const int16_t * pv_audio_rec_get_new_buffer (void)
 
pv_status_t pv_audio_rec_init (void)
 
float pv_audio_rec_loudness_db (void)
 
pv_status_t pv_audio_rec_start (void)
 
pv_status_t pv_audio_rec_stop (void)
 

Variables

cyhal_clock_t audio_clock
 
static int32_t last_read_index = -1
 
cyhal_pdm_pcm_t pdm_pcm
 
const cyhal_pdm_pcm_cfg_t pdm_pcm_cfg
 
static int16_t ping_pong_buffer [2][PV_AUDIO_REC_RECORD_BUFFER_SIZE]
 
cyhal_clock_t pll_clock
 
struct {
   uint32_t   audio_frequency
 
   uint32_t   channel_number
 
   bool   is_recording
 
   uint32_t   record_buffer_size
 
pv_audio_rec
 
static int32_t read_index = -1
 
static int32_t write_index = 1
 

Macro Definition Documentation

◆ AUDIO_SYS_CLOCK_HZ

#define AUDIO_SYS_CLOCK_HZ   (24576000u)

Definition at line 29 of file psoc062s2/src/pv_audio_rec.c.

◆ DECIMATION_RATE

#define DECIMATION_RATE   (96u)

Definition at line 28 of file psoc062s2/src/pv_audio_rec.c.

◆ PDM_CLK

#define PDM_CLK   (P10_4)

Definition at line 31 of file psoc062s2/src/pv_audio_rec.c.

◆ PDM_DATA

#define PDM_DATA   (P10_5)

Definition at line 30 of file psoc062s2/src/pv_audio_rec.c.

◆ PV_AUDIO_REC_AUDIO_FREQUENCY

#define PV_AUDIO_REC_AUDIO_FREQUENCY   (16000U)

Definition at line 25 of file psoc062s2/src/pv_audio_rec.c.

◆ PV_AUDIO_REC_CHANNEL_NUMBER

#define PV_AUDIO_REC_CHANNEL_NUMBER   (1)

Definition at line 26 of file psoc062s2/src/pv_audio_rec.c.

◆ PV_AUDIO_REC_RECORD_BUFFER_SIZE

#define PV_AUDIO_REC_RECORD_BUFFER_SIZE   (512)

Definition at line 27 of file psoc062s2/src/pv_audio_rec.c.

Function Documentation

◆ pdm_pcm_clock_init()

cy_rslt_t pdm_pcm_clock_init ( void  )

Definition at line 61 of file psoc062s2/src/pv_audio_rec.c.

◆ pdm_pcm_isr_handler()

void pdm_pcm_isr_handler ( void *  arg,
cyhal_pdm_pcm_event_t  event 
)

Definition at line 164 of file psoc062s2/src/pv_audio_rec.c.

◆ pv_audio_rec_deinit()

void pv_audio_rec_deinit ( void  )

Definition at line 173 of file psoc062s2/src/pv_audio_rec.c.

◆ pv_audio_rec_get_new_buffer()

const int16_t* pv_audio_rec_get_new_buffer ( void  )

Definition at line 150 of file psoc062s2/src/pv_audio_rec.c.

◆ pv_audio_rec_init()

pv_status_t pv_audio_rec_init ( void  )

Definition at line 96 of file psoc062s2/src/pv_audio_rec.c.

◆ pv_audio_rec_loudness_db()

float pv_audio_rec_loudness_db ( void  )

Definition at line 133 of file psoc062s2/src/pv_audio_rec.c.

◆ pv_audio_rec_start()

pv_status_t pv_audio_rec_start ( void  )

Definition at line 118 of file psoc062s2/src/pv_audio_rec.c.

◆ pv_audio_rec_stop()

pv_status_t pv_audio_rec_stop ( void  )

Definition at line 127 of file psoc062s2/src/pv_audio_rec.c.

Variable Documentation

◆ audio_clock

cyhal_clock_t audio_clock

Definition at line 36 of file psoc062s2/src/pv_audio_rec.c.

◆ audio_frequency

uint32_t audio_frequency

Definition at line 56 of file psoc062s2/src/pv_audio_rec.c.

◆ channel_number

uint32_t channel_number

Definition at line 55 of file psoc062s2/src/pv_audio_rec.c.

◆ is_recording

bool is_recording

Definition at line 58 of file psoc062s2/src/pv_audio_rec.c.

◆ last_read_index

int32_t last_read_index = -1
static

Definition at line 50 of file psoc062s2/src/pv_audio_rec.c.

◆ pdm_pcm

cyhal_pdm_pcm_t pdm_pcm

Definition at line 35 of file psoc062s2/src/pv_audio_rec.c.

◆ pdm_pcm_cfg

const cyhal_pdm_pcm_cfg_t pdm_pcm_cfg
Initial value:
=
{
.decimation_rate = DECIMATION_RATE,
.mode = CYHAL_PDM_PCM_MODE_LEFT,
.word_length = 16,
.left_gain = 21,
.right_gain = 21,
}

Definition at line 39 of file psoc062s2/src/pv_audio_rec.c.

◆ ping_pong_buffer

int16_t ping_pong_buffer[2][PV_AUDIO_REC_RECORD_BUFFER_SIZE]
static

Definition at line 49 of file psoc062s2/src/pv_audio_rec.c.

◆ pll_clock

cyhal_clock_t pll_clock

Definition at line 37 of file psoc062s2/src/pv_audio_rec.c.

◆ pv_audio_rec

struct { ... } pv_audio_rec

◆ read_index

int32_t read_index = -1
static

Definition at line 51 of file psoc062s2/src/pv_audio_rec.c.

◆ record_buffer_size

uint32_t record_buffer_size

Definition at line 57 of file psoc062s2/src/pv_audio_rec.c.

◆ write_index

int32_t write_index = 1
static

Definition at line 52 of file psoc062s2/src/pv_audio_rec.c.

DECIMATION_RATE
#define DECIMATION_RATE
Definition: psoc062s2/src/pv_audio_rec.c:28
PV_AUDIO_REC_AUDIO_FREQUENCY
#define PV_AUDIO_REC_AUDIO_FREQUENCY
Definition: psoc062s2/src/pv_audio_rec.c:25


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