[X12S] AUDIO is back
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
option(DISK_CACHE "Enable SD card disk cache" YES)
|
||||
option(BLUETOOTH_CLI_PASSTHROUGH "Enable direct communicaton with Bluetooth module from CLI" NO)
|
||||
option(PWR_BUTTON_DISABLED "Disable the Power Button (for debugging with JTAG)" NO)
|
||||
option(NO_UNEXPECTED_SHUTDOWN "Disable the Unexpected Shutdown screen (for debugging with JTAG)" NO)
|
||||
|
||||
set(CPU_TYPE STM32F4)
|
||||
set(HSE_VALUE 12000000)
|
||||
@@ -25,6 +26,10 @@ if(PWR_BUTTON_DISABLED)
|
||||
add_definitions(-DPWR_BUTTON_DISABLED)
|
||||
endif()
|
||||
|
||||
if(NO_UNEXPECTED_SHUTDOWN)
|
||||
add_definitions(-DNO_UNEXPECTED_SHUTDOWN)
|
||||
endif()
|
||||
|
||||
if (PCB STREQUAL X10)
|
||||
set(FLAVOUR x10)
|
||||
add_definitions(-DPCBX10)
|
||||
|
||||
@@ -349,6 +349,29 @@ void audioSendRiffHeader()
|
||||
audioSpiWriteBuffer(RiffHeader, sizeof(RiffHeader));
|
||||
}
|
||||
|
||||
#if defined(PCBX12S)
|
||||
void audioMuteInit()
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = AUDIO_SHUTDOWN_GPIO_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(AUDIO_SHUTDOWN_GPIO, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
void audioOn()
|
||||
{
|
||||
GPIO_SetBits(AUDIO_SHUTDOWN_GPIO, AUDIO_SHUTDOWN_GPIO_PIN);
|
||||
}
|
||||
|
||||
void audioOff()
|
||||
{
|
||||
GPIO_ResetBits(AUDIO_SHUTDOWN_GPIO, AUDIO_SHUTDOWN_GPIO_PIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
void audioInit()
|
||||
{
|
||||
audioSpiInit();
|
||||
@@ -356,6 +379,12 @@ void audioInit()
|
||||
audioSoftReset();
|
||||
audioSpiSetSpeed(SPI_SPEED_8);
|
||||
|
||||
#if defined(PCBX12S)
|
||||
audioMuteInit();
|
||||
audioOn();
|
||||
// TODO X10 code missing
|
||||
#endif
|
||||
|
||||
delay_01us(10000); // 1ms
|
||||
audioSendRiffHeader();
|
||||
}
|
||||
@@ -366,8 +395,14 @@ int16_t newVolume = -1;
|
||||
|
||||
void audioSetCurrentBuffer(const AudioBuffer * buffer)
|
||||
{
|
||||
currentBuffer = (uint8_t *)buffer->data;
|
||||
currentSize = buffer->size * 2;
|
||||
if (buffer) {
|
||||
currentBuffer = (uint8_t *)buffer->data;
|
||||
currentSize = buffer->size * 2;
|
||||
}
|
||||
else {
|
||||
currentBuffer = NULL;
|
||||
currentSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void audioConsumeCurrentBuffer()
|
||||
|
||||
@@ -399,7 +399,7 @@ void pwrResetHandler(void);
|
||||
uint32_t pwrPressed(void);
|
||||
uint32_t pwrPressedDuration(void);
|
||||
#define pwroffPressed() pwrPressed()
|
||||
#if defined(SIMU)
|
||||
#if defined(SIMU) || defined(NO_UNEXPECTED_SHUTDOWN)
|
||||
#define UNEXPECTED_SHUTDOWN() (false)
|
||||
#else
|
||||
#define UNEXPECTED_SHUTDOWN() (powerupReason == DIRTY_SHUTDOWN)
|
||||
|
||||
@@ -35,13 +35,6 @@ void pwrInit()
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(PWR_GPIO, &GPIO_InitStructure);
|
||||
|
||||
#if defined(PCBX12S)
|
||||
// TODO should not be here!
|
||||
// TODO and X10 code missing
|
||||
GPIO_InitStructure.GPIO_Pin = AUDIO_SHUTDOWN_GPIO_PIN;
|
||||
GPIO_Init(AUDIO_SHUTDOWN_GPIO, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
// Init Module PWR
|
||||
GPIO_ResetBits(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN);
|
||||
GPIO_InitStructure.GPIO_Pin = INTMODULE_PWR_GPIO_PIN;
|
||||
|
||||
Reference in New Issue
Block a user