diff --git a/radio/src/cli.cpp b/radio/src/cli.cpp index dfb2718ec..ce2ac8b21 100644 --- a/radio/src/cli.cpp +++ b/radio/src/cli.cpp @@ -328,12 +328,14 @@ int cliDisplay(const char ** argv) int cliDebugVars(const char ** argv) { #if defined(PCBHORUS) && !defined(SIMU) - extern unsigned int ioMutexReq, ioMutexRel; - extern unsigned int sdReadRetries; + extern uint32_t ioMutexReq, ioMutexRel; + extern uint32_t sdReadRetries; + extern uint32_t audioBufferCount; serialPrint("ioMutexReq=%d", ioMutexReq); serialPrint("ioMutexRel=%d", ioMutexRel); serialPrint("sdReadRetries=%d", sdReadRetries); + serialPrint("audioBufferCount=%d", audioBufferCount); #endif return 0; } diff --git a/radio/src/targets/horus/audio_driver.cpp b/radio/src/targets/horus/audio_driver.cpp index 2d0366569..50deff5ea 100644 --- a/radio/src/targets/horus/audio_driver.cpp +++ b/radio/src/targets/horus/audio_driver.cpp @@ -20,6 +20,8 @@ #include "../../opentx.h" +uint32_t audioBufferCount = 0; + #if !defined(SIMU) bool dacIdle = true; @@ -43,9 +45,6 @@ void dacTimerInit() AUDIO_TIMER->CR1 = TIM_CR1_CEN ; } -// Configure DAC0 (or DAC1 for REVA) -// Not sure why PB14 has not be allocated to the DAC, although it is an EXTRA function -// So maybe it is automatically done void dacInit() { dacTimerInit(); @@ -74,6 +73,7 @@ void dacInit() bool dacQueue(AudioBuffer * buffer) { if (dacIdle) { + audioBufferCount++; dacIdle = false; DMA1_Stream5->CR &= ~DMA_SxCR_EN ; // Disable DMA channel DMA1->HIFCR = DMA_HIFCR_CTCIF5 | DMA_HIFCR_CHTIF5 | DMA_HIFCR_CTEIF5 | DMA_HIFCR_CDMEIF5 | DMA_HIFCR_CFEIF5 ; // Write ones to clear bits diff --git a/radio/src/targets/horus/board_horus.h b/radio/src/targets/horus/board_horus.h index 2ae1f2fd9..5f473d46a 100644 --- a/radio/src/targets/horus/board_horus.h +++ b/radio/src/targets/horus/board_horus.h @@ -284,7 +284,7 @@ void setSampleRate(uint32_t frequency); // Fake volume driver #define setScaledVolume(...) #define setVolume(...) -#define getVolume(...) (-1) +#define getVolume(...) (-1) // Telemetry driver void telemetryPortInit(uint32_t baudrate); diff --git a/radio/src/targets/horus/diskio.cpp b/radio/src/targets/horus/diskio.cpp index 139382d2e..91441a4b9 100644 --- a/radio/src/targets/horus/diskio.cpp +++ b/radio/src/targets/horus/diskio.cpp @@ -1,23 +1,23 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2007 */ /*-----------------------------------------------------------------------*/ /* This is a stub disk I/O module that acts as front end of the existing */ @@ -36,7 +36,7 @@ /*-----------------------------------------------------------------------*/ #if !defined(BOOT) static OS_MutexID ioMutex; -unsigned int ioMutexReq = 0, ioMutexRel = 0; +uint32_t ioMutexReq = 0, ioMutexRel = 0; int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex) { *mutex = ioMutex; @@ -107,7 +107,7 @@ DSTATUS disk_status ( return(stat); } -unsigned int sdReadRetries = 0; +uint32_t sdReadRetries = 0; /*-----------------------------------------------------------------------*/ /* Read Sector(s) */ diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index 091023d03..bff7b6ab1 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -211,6 +211,8 @@ #define AUDIO_RCC_APB1Periph (RCC_APB1ENR_TIM6EN | RCC_APB1ENR_DACEN) #define AUDIO_TIMER TIM6 #define AUDIO_TIMER_DAC_IRQn TIM6_DAC_IRQn +#define AUDIO_DMA_STREAM DMA1_Stream5 +#define AUDIO_DMA_IRQn DMA1_Stream5_IRQn // I2C Bus: TPL0401A-10DCK digital pot for volume control #define I2C_RCC_AHB1Periph RCC_AHB1Periph_GPIOB diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index 282718df8..b8480adc1 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -1344,4 +1344,7 @@ void serialPrintf(const char * format, ...) { } void serialCrlf() { } void serialPutc(char c) { } uint16_t stackSize() { return 0; } + +#if defined(VOLUME_CHIP) int32_t getVolume() { return 0; } +#endif \ No newline at end of file