Output I2S audio with PIO/DMA
Requires a MAX98357A amplifier and a 2W 8ohms speaker
This commit is contained in:
@@ -9,19 +9,20 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define AUDIO_SAMPLE_RATE 32768
|
||||
#define AUDIO_SAMPLE_RATE 44100
|
||||
|
||||
#define DMG_CLOCK_FREQ 4194304.0
|
||||
#define SCREEN_REFRESH_CYCLES 70224.0
|
||||
#define VERTICAL_SYNC (DMG_CLOCK_FREQ/SCREEN_REFRESH_CYCLES)
|
||||
|
||||
#define AUDIO_SAMPLES ((unsigned)(AUDIO_SAMPLE_RATE / VERTICAL_SYNC))
|
||||
#define AUDIO_BUFFER_SIZE_BYTES (AUDIO_SAMPLES*4)
|
||||
|
||||
/**
|
||||
* Fill allocated buffer "data" with "len" number of 32-bit floating point
|
||||
* samples (native endian order) in stereo interleaved format.
|
||||
*/
|
||||
void audio_callback(void *ptr, uint8_t *data, int len);
|
||||
void audio_callback(void *ptr, int16_t *data, size_t len);
|
||||
|
||||
/**
|
||||
* Read audio register at given address "addr".
|
||||
|
||||
Reference in New Issue
Block a user