aboutsummaryrefslogtreecommitdiffstats
path: root/src/glutt-o-logique/audio.c
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-05 21:08:03 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-05 21:08:22 +0200
commit8618657695b2530f463d1e7e0fca11304d2b897e (patch)
tree1f183912e438599ef7abdc0e188c48a3da30d56d /src/glutt-o-logique/audio.c
parentba105ccbf7c350e24ee527472a99e3672983e93d (diff)
downloadglutte-o-matic-8618657695b2530f463d1e7e0fca11304d2b897e.tar.gz
glutte-o-matic-8618657695b2530f463d1e7e0fca11304d2b897e.tar.bz2
glutte-o-matic-8618657695b2530f463d1e7e0fca11304d2b897e.zip
Make object for common/Audio
Diffstat (limited to 'src/glutt-o-logique/audio.c')
-rw-r--r--src/glutt-o-logique/audio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/glutt-o-logique/audio.c b/src/glutt-o-logique/audio.c
index 87bd896..bf41169 100644
--- a/src/glutt-o-logique/audio.c
+++ b/src/glutt-o-logique/audio.c
@@ -23,10 +23,11 @@
*/
#include "GPIO/i2c.h"
+#include "Audio/audio.h"
#include "stm32f4xx_conf.h"
#include "stm32f4xx.h"
-#include "../common/src/Audio/audio.c"
+static void audio_write_register(uint8_t address, uint8_t value);
void audio_initialize_platform(int plln, int pllr, int i2sdiv, int i2sodd, int rate) {
@@ -164,7 +165,7 @@ void audio_stop() {
audio_stop_dma();
SPI3 ->CR2 &= ~SPI_CR2_TXDMAEN; // Disable I2S TX DMA request.
NVIC_DisableIRQ(DMA1_Stream7_IRQn);
- callback_function = NULL;
+ callback_function = (AudioCallbackFunction*)0;
}
void audio_provide_buffer(void *samples, int numsamples) {
@@ -189,7 +190,7 @@ bool audio_provide_buffer_without_blocking(void *samples, int numsamples) {
return true;
}
-static void audio_start_dma_and_request_buffers() {
+void audio_start_dma_and_request_buffers() {
// Configure DMA stream.
DMA1_Stream7 ->CR = (0 * DMA_SxCR_CHSEL_0 ) | // Channel 0
(1 * DMA_SxCR_PL_0 ) | // Priority 1
@@ -205,7 +206,7 @@ static void audio_start_dma_and_request_buffers() {
DMA1_Stream7 ->CR |= DMA_SxCR_EN;
// Update state.
- next_buffer_samples = NULL;
+ next_buffer_samples = (void*)0;
buffer_number ^= 1;
dma_running = true;
@@ -214,7 +215,7 @@ static void audio_start_dma_and_request_buffers() {
callback_function(callback_context, buffer_number);
}
-static void audio_stop_dma() {
+void audio_stop_dma() {
DMA1_Stream7 ->CR &= ~DMA_SxCR_EN; // Disable DMA stream.
while (DMA1_Stream7 ->CR & DMA_SxCR_EN )
; // Wait for DMA stream to stop.