Swadge ESP32-S2/S3
APIs to develop for the Magfest Swadge
Loading...
Searching...
No Matches
hdw-dac.h
Go to the documentation of this file.
1
62
63#pragma once
64
65//==============================================================================
66// Includes
67//==============================================================================
68
69#include <stdint.h>
70#include <stdbool.h>
71#include "driver/gpio.h"
72
73//==============================================================================
74// Defines
75//==============================================================================
76
78#define DAC_SAMPLE_RATE_HZ 16384
79
81#define DAC_BUF_SIZE 512
82
83//==============================================================================
84// Typedefs
85//==============================================================================
86
93typedef void (*fnDacCallback_t)(uint8_t* samples, int16_t len);
94
95//==============================================================================
96// Function Declarations
97//==============================================================================
98
99void initDac(gpio_num_t spk_gpio, gpio_num_t shdn_gpio, fnDacCallback_t cb);
100void deinitDac(void);
101void powerDownDac(void);
102void powerUpDac(void);
103void dacPoll(void);
104void dacStart(void);
105void dacStop(void);
106void setDacShutdown(bool shutdown);
void powerUpDac(void)
Power up the DAC (speaker).
Definition hdw-dac.c:189
void setDacShutdown(bool shutdown)
Set the shutdown state of the DAC.
Definition hdw-dac.c:262
void dacStop(void)
Stop the DAC.
Definition hdw-dac.c:215
void initDac(gpio_num_t spk_gpio, gpio_num_t shdn_gpio, fnDacCallback_t cb)
Initialize the DAC.
Definition hdw-dac.c:85
void dacPoll(void)
Poll the queue to see if any buffers need to be filled with audio samples.
Definition hdw-dac.c:233
void powerDownDac(void)
Power down the DAC (speaker).
Definition hdw-dac.c:181
void deinitDac(void)
Deinitialize the DAC and free memory.
Definition hdw-dac.c:156
void dacStart(void)
Start the DAC. This will cause samples to be requested from the application.
Definition hdw-dac.c:197
void(* fnDacCallback_t)(uint8_t *samples, int16_t len)
A callback which requests DAC samples from the application.
Definition hdw-dac.h:93