mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
[X7D] Software volume
This commit is contained in:
parent
9a02e0b6b3
commit
9f67c0c49b
6 changed files with 9 additions and 7 deletions
|
@ -72,7 +72,9 @@ void checkSpeakerVolume()
|
|||
{
|
||||
if (currentSpeakerVolume != requiredSpeakerVolume) {
|
||||
currentSpeakerVolume = requiredSpeakerVolume;
|
||||
#if !defined(SOFTWARE_VOLUME)
|
||||
setScaledVolume(currentSpeakerVolume);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2456,7 +2456,7 @@ void opentxInit(OPENTX_INIT_ARGS)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(VOICE)
|
||||
#if defined(VOICE) && !defined(SOFTWARE_VOLUME)
|
||||
setScaledVolume(g_eeGeneral.speakerVolume+VOLUME_LEVEL_DEF);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -161,17 +161,15 @@ void audioEnd()
|
|||
PMC->PMC_PCER0 &= ~0x40000000L ; // Disable peripheral clock to DAC
|
||||
}
|
||||
|
||||
#if !defined(SOFTWARE_VOLUME)
|
||||
void setScaledVolume(uint8_t volume)
|
||||
{
|
||||
#if !defined(SOFTWARE_VOLUME)
|
||||
volumeRequired = volumeScale[min<uint8_t>(volume, VOLUME_LEVEL_MAX)];
|
||||
#ifndef AR9X
|
||||
__disable_irq() ;
|
||||
i2cCheck() ;
|
||||
__enable_irq() ;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #if !defined(SIMU)
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ elseif(PCB STREQUAL X7D)
|
|||
set(HAPTIC YES)
|
||||
set(LUA_EXPORT lua_export_taranis)
|
||||
set(FLAVOUR x7d)
|
||||
add_definitions(-DPCBX7D)
|
||||
add_definitions(-DPCBX7D -DSOFTWARE_VOLUME)
|
||||
add_definitions(-DEEPROM_VARIANT=0)
|
||||
set(GUI_DIR 128x64)
|
||||
set(BITMAPS_TARGET 9x_bitmaps)
|
||||
|
|
|
@ -454,9 +454,11 @@ void dacStop(void);
|
|||
void setSampleRate(uint32_t frequency);
|
||||
#define VOLUME_LEVEL_MAX 23
|
||||
#define VOLUME_LEVEL_DEF 12
|
||||
#if !defined(SOFTWARE_VOLUME)
|
||||
void setScaledVolume(uint8_t volume);
|
||||
void setVolume(uint8_t volume);
|
||||
int32_t getVolume(void);
|
||||
#endif
|
||||
#define audioConsumeCurrentBuffer()
|
||||
#define audioDisableIrq() __disable_irq()
|
||||
#define audioEnableIrq() __enable_irq()
|
||||
|
|
|
@ -247,7 +247,7 @@ void eepromWaitEepromStandbyState(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(BOOT)
|
||||
#if !defined(BOOT) && !defined(SOFTWARE_VOLUME)
|
||||
const uint8_t volumeScale[VOLUME_LEVEL_MAX+1] = {
|
||||
0, 1, 2, 3, 5, 9, 13, 17, 22, 27, 33, 40,
|
||||
64, 82, 96, 105, 112, 117, 120, 122, 124, 125, 126, 127
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue