PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros
nRF5 PDM microphone

Microphone implementation for the nRF5 PDM peripheral. More...

Data Structures

struct  MicDevice
 nRF5 PDM microphone device. More...
 

Macros

#define PDM_BUFFER_SIZE_SAMPLES   (320)
 Samples per PDM DMA buffer.
 
#define PDM_BUFFER_COUNT   (2)
 Number of PDM DMA buffers.
 
#define PDM_GAIN_DEFAULT   (NRF_PDM_GAIN_DEFAULT)
 Default PDM gain.
 
#define CIRCULAR_BUF_SIZE_MS   (320)
 Preferred length of the queue between DMA and the data handler, in milliseconds.
 
#define CIRCULAR_BUF_SIZE_SAMPLES   ((MIC_SAMPLE_RATE * CIRCULAR_BUF_SIZE_MS) / 1000)
 Preferred queue length, in samples.
 
#define CIRCULAR_BUF_SIZE_BYTES   (CIRCULAR_BUF_SIZE_SAMPLES * sizeof(int16_t))
 Preferred queue size, in bytes.
 
#define CIRCULAR_BUF_MIN_SIZE_MS   (128)
 Minimum queue length, in milliseconds, accepted when the heap is too fragmented for the preferred one.
 
#define CIRCULAR_BUF_MIN_SIZE_SAMPLES   ((MIC_SAMPLE_RATE * CIRCULAR_BUF_MIN_SIZE_MS) / 1000)
 Minimum queue length, in samples.
 
#define CIRCULAR_BUF_MIN_SIZE_BYTES   (CIRCULAR_BUF_MIN_SIZE_SAMPLES * sizeof(int16_t))
 Minimum queue size, in bytes.
 
#define CIRCULAR_BUF_STEP_MS   (32)
 Queue shrink per allocation retry, in milliseconds.
 
#define CIRCULAR_BUF_STEP_SAMPLES   ((MIC_SAMPLE_RATE * CIRCULAR_BUF_STEP_MS) / 1000)
 Queue shrink per allocation retry, in samples.
 
#define CIRCULAR_BUF_STEP_BYTES   (CIRCULAR_BUF_STEP_SAMPLES * sizeof(int16_t))
 Queue shrink per allocation retry, in bytes.
 

Detailed Description

Microphone implementation for the nRF5 PDM peripheral.


Data Structure Documentation

◆ MicDevice

struct MicDevice

nRF5 PDM microphone device.

SF32LB52 PDM microphone device.

QEMU microphone device.

Data Fields
uint32_t channel_depth PDM channel depth in bits.
uint32_t channels Number of channels, 1 or 2.

Number of channels.

Pinmux clk_gpio PDM clock pin.
uint32_t clk_pin PDM clock pin.
Pinmux data_gpio PDM data pin.
uint32_t data_pin PDM data pin.
uint16_t default_volume Default volume scalar (max 128); not used by the driver.
IRQn_Type pdm_dma_irq PDM DMA interrupt.
const nrfx_pdm_t pdm_instance PDM instance.
PDM_TypeDef * pdm_instance PDM instance.
IRQn_Type pdm_irq PDM interrupt.
uint32_t sample_rate PDM sample rate in Hz.
MicDeviceState * state Driver runtime state.

Macro Definition Documentation

◆ CIRCULAR_BUF_MIN_SIZE_BYTES

#define CIRCULAR_BUF_MIN_SIZE_BYTES   (CIRCULAR_BUF_MIN_SIZE_SAMPLES * sizeof(int16_t))

Minimum queue size, in bytes.

◆ CIRCULAR_BUF_MIN_SIZE_MS

#define CIRCULAR_BUF_MIN_SIZE_MS   (128)

Minimum queue length, in milliseconds, accepted when the heap is too fragmented for the preferred one.

Transcription quality degrades noticeably below it.

◆ CIRCULAR_BUF_MIN_SIZE_SAMPLES

#define CIRCULAR_BUF_MIN_SIZE_SAMPLES   ((MIC_SAMPLE_RATE * CIRCULAR_BUF_MIN_SIZE_MS) / 1000)

Minimum queue length, in samples.

◆ CIRCULAR_BUF_SIZE_BYTES

#define CIRCULAR_BUF_SIZE_BYTES   (CIRCULAR_BUF_SIZE_SAMPLES * sizeof(int16_t))

Preferred queue size, in bytes.

◆ CIRCULAR_BUF_SIZE_MS

#define CIRCULAR_BUF_SIZE_MS   (320)

Preferred length of the queue between DMA and the data handler, in milliseconds.

◆ CIRCULAR_BUF_SIZE_SAMPLES

#define CIRCULAR_BUF_SIZE_SAMPLES   ((MIC_SAMPLE_RATE * CIRCULAR_BUF_SIZE_MS) / 1000)

Preferred queue length, in samples.

◆ CIRCULAR_BUF_STEP_BYTES

#define CIRCULAR_BUF_STEP_BYTES   (CIRCULAR_BUF_STEP_SAMPLES * sizeof(int16_t))

Queue shrink per allocation retry, in bytes.

◆ CIRCULAR_BUF_STEP_MS

#define CIRCULAR_BUF_STEP_MS   (32)

Queue shrink per allocation retry, in milliseconds.

Gives about 7 attempts between the preferred and the minimum length.

◆ CIRCULAR_BUF_STEP_SAMPLES

#define CIRCULAR_BUF_STEP_SAMPLES   ((MIC_SAMPLE_RATE * CIRCULAR_BUF_STEP_MS) / 1000)

Queue shrink per allocation retry, in samples.

◆ PDM_BUFFER_COUNT

#define PDM_BUFFER_COUNT   (2)

Number of PDM DMA buffers.

◆ PDM_BUFFER_SIZE_SAMPLES

#define PDM_BUFFER_SIZE_SAMPLES   (320)

Samples per PDM DMA buffer.

◆ PDM_GAIN_DEFAULT

#define PDM_GAIN_DEFAULT   (NRF_PDM_GAIN_DEFAULT)

Default PDM gain.