【HC32F460开发板测评】06 wm8731驱动TPA3116双声道数字功放

1nnocent   2021-4-21 16:09 楼主

之前申请测评的时候就想把之前做的TPA3116数字功放用上,

上次做了wm8731单独播放音乐的功能,

这次将之前做的功放用上,功放刚好是双声道的,

直接用开发板上的耳机接口输出的语音信号给到功放。

这次主要实现以下功能:

  SW2 SW3 SW4 SW5 
TPA3116的现象 左右声道音量同时增大 左右声道音量同时减小 左声道音量增大 右声道音量增大
开发板指示灯的现象 红灯亮起 绿灯亮起 黄灯亮起 蓝灯亮起

 这次的实验是用到了wm8731和按键,刚好是前两个实验的结合,

篇幅关系这里只给出主要的几个文件的代码,具体代码可以自行下载文件查看。

代码主要需要对按键值进行读取,并根据键值更改wm8731输入信号的大小,0x00-0x17个音量梯度。改完后重新初始化一下就可以更新音量大小。

关于实验功能的测试,这里使用电脑播放歌曲《完美重合》该歌曲左右声道独立播放两首歌曲,左声道播放歌曲《发如雪》右声道播放歌曲《我不配》;

按键SW4和SW5控制左或右声道的音量大小,最小可以是静音,效果可以查看下面的视频,

或者可以自己下载代码,使用耳机听,效果更加明显,视频里的听起来可能不是很明显因为是录制视频两个喇叭距离也较近所以听不出哪个喇叭声音较小或者是哪个喇叭在发声哪个静音。

视频里可能只可以听出音量大小的变化。


这里发现一个问题,板子接下载器播放音乐时会引入干扰,下载程序时也会有干扰的声音,可能是数字地和模拟地没有做好隔离,

原理图没有发现有进行合理,板子布线的时候不知道是否有进行相应的隔离处理。

hc32f460petb_template_wm8731_V2.0.rar (5.69 MB)
(下载次数: 19, 2021-4-22 12:39 上传)

以下是具体实现代码:

key.c

/******************************************************************************/
/** \file key.c
 **
 ** \brief Key functions
 **
 **   - 2021-04-15  1.0  First version for Key
 **
 ******************************************************************************/

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include "hc32_ddl.h"
#include "wm8731.h"
#include "audio.h"
#include "key.h"
#include "led.h"
#include "i2c.h"

/*******************************************************************************
 * Local type definitions ('typedef')
 ******************************************************************************/

/*******************************************************************************
 * Local pre-processor symbols/macros ('#define')
 ******************************************************************************/

/*******************************************************************************
 * Global variable definitions (declared in header file with 'extern')
 ******************************************************************************/
extern uint16_t Lin_Volume;			//0dB--0x17u
extern uint16_t Rin_Volume;			//0dB--0x17u
extern uint16_t Lout_Volume;		//0x30(-73dB) ~ 0x7F(+6dB), 0 ~ 0x2F: mute
extern uint16_t Lout_Volume;		//0x30(-73dB) ~ 0x7F(+6dB), 0 ~ 0x2F: mute
extern stc_wm8731_reg_t stcWm8731Reg;

/*******************************************************************************
 * Local function prototypes ('static')
 ******************************************************************************/

/**
 *******************************************************************************
 ** \brief  Initialize keys
 **
 ** \param  None
 **
 ** \retval None
 **
 ******************************************************************************/
void IniKey(void)
{
    stc_port_init_t stcPortInit;
    /*initiallize KEY port*/
    MEM_ZERO_STRUCT(stcPortInit);

    /* KEY0 Port/Pin initialization */
    PORT_Init(KEY2_PORT, KEY2_PIN, &stcPortInit);
    /* KEY1 Port/Pin initialization */
    PORT_Init(KEY3_PORT, KEY3_PIN, &stcPortInit);
    /* KEY2 Port/Pin initialization */
    PORT_Init(KEY4_PORT, KEY4_PIN, &stcPortInit);
    /* KEY3 Port/Pin initialization */
    PORT_Init(KEY5_PORT, KEY5_PIN, &stcPortInit);
}

/**
 *******************************************************************************
 ** \brief  keyscan
 **
 ** \param  None
 **
 ** \retval None
 **
 ******************************************************************************/
void KeyScan(void)
{
	if(KEY2 == 0)
	{
		Ddl_Delay1ms(100);
		if(Rin_Volume == 0x18u)
			Rin_Volume = 0x00u;
		else
			Rin_Volume ++;
		Lin_Volume = Rin_Volume;
		WM8731_CodecConfigRecord();
		LED0_TOGGLE();
		Ddl_Delay1ms(10);
		LED0_TOGGLE();
	}
	if(KEY3 == 0)
	{
		Ddl_Delay1ms(100);
		if(Rin_Volume == 0x00u)
			Rin_Volume = 0x17u;
		else
			Rin_Volume --;
		Lin_Volume = Rin_Volume;
		WM8731_CodecConfigRecord();
		LED1_TOGGLE();
		Ddl_Delay1ms(10);
		LED1_TOGGLE();
	}
	if(KEY4 == 0)
	{
		Ddl_Delay1ms(100);
		if(Lin_Volume == 0x18u)
			Lin_Volume = 0x00u;
		else
			Lin_Volume ++;
		WM8731_CodecConfigRecord();
		LED2_TOGGLE();
		Ddl_Delay1ms(10);
		LED2_TOGGLE();
	}
	if(KEY5 == 0)
	{
		Ddl_Delay1ms(100);
		if(Rin_Volume == 0x18u)
			Rin_Volume = 0x00u;
		else
			Rin_Volume ++;
		WM8731_CodecConfigRecord();
		LED3_TOGGLE();
		Ddl_Delay1ms(10);
		LED3_TOGGLE();
	}
}

/*******************************************************************************
 * Local variable definitions ('static')
 ******************************************************************************/

/*******************************************************************************
 * Function implementation - global ('extern') and local ('static')
 ******************************************************************************/

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/


key.h

/******************************************************************************/
/** \file key.h
 **
 ** A detailed description is available at
 ** @link key Series description @endlink
 **
 **   - 2021-4-15  1.0  First version for Key Functions description
 **     Library.
 **
 ******************************************************************************/
#ifndef __KEY_H__
#define __KEY_H__

/*******************************************************************************
 * Include files
 ******************************************************************************/
 #include "hc32_ddl.h"

/*******************************************************************************
 * Local pre-processor symbols/macros ('#define')
 ******************************************************************************/
/* KEY0 Port/Pin definition *///SW2
#define  KEY2_PORT          (PortD)
#define  KEY2_PIN           (Pin03)
#define  KEY2								PORT_GetBit(PortD,Pin03)
/* KEY2 Port/Pin definition *///SW3
#define  KEY3_PORT          PortD
#define  KEY3_PIN           Pin05
#define  KEY3								PORT_GetBit(PortD,Pin05)
/* KEY1 Port/Pin definition *///SW4
#define  KEY4_PORT          (PortD)
#define  KEY4_PIN           (Pin04)
#define  KEY4								PORT_GetBit(PortD,Pin04)
/* KEY3 Port/Pin definition *///SW5
#define  KEY5_PORT          PortD
#define  KEY5_PIN           Pin06
#define  KEY5								PORT_GetBit(PortD,Pin06)

void IniKey(void);
void KeyScan(void);
 
#endif /* __KEY_H__ */

/*******************************************************************************
 * End of file
 ******************************************************************************/




audio.c

/******************************************************************************/
/** \file audio.c
 **
 ** \brief Audio functions
 **
 **   - 2021-04-15  1.0  First version for Audio
 **
 ******************************************************************************/

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include "hc32_ddl.h"
#include "wm8731.h"
#include "audio.h"
#include "i2c.h"

/*******************************************************************************
 * Local type definitions ('typedef')
 ******************************************************************************/

/*******************************************************************************
 * Local pre-processor symbols/macros ('#define')
 ******************************************************************************/
#define RECORDER_WAVFILELEN         (15u*1024u)

/*******************************************************************************
 * Global variable definitions (declared in header file with 'extern')
 ******************************************************************************/
extern uint16_t *pu16SoundData;
extern uint16_t au16RecorderSoundI2s[RECORDER_WAVFILELEN];
uint16_t Lin_Volume = 0x17u;			//0dB--0x17u
uint16_t Rin_Volume = 0x17u;			//0dB--0x17u
uint16_t Lout_Volume = 0x5Fu;		//0x30(-73dB) ~ 0x7F(+6dB), 0 ~ 0x2F: mute
uint16_t Rout_Volume = 0x5Fu;		//0x30(-73dB) ~ 0x7F(+6dB), 0 ~ 0x2F: mute
stc_wm8731_reg_t stcWm8731Reg;

/*******************************************************************************
 * Local function prototypes ('static')
 ******************************************************************************/
 
/**
 *******************************************************************************
 ** \brief  Configuration Codec to record wav file
 **
 ** \param  None
 **
 ** \retval None
 **
 ******************************************************************************/
void WM8731_CodecConfigRecord(void)
{
    MEM_ZERO_STRUCT(stcWm8731Reg);
    /* Config codec */
    /* Reset register */
    stcWm8731Reg.RESET              = 0x00u;    // Reset WM8731
    /* Left & right line input */
    stcWm8731Reg.LLIN_f.LINVOL      = Lin_Volume;    // Left channel line input volume: 0dB--0x17u
    stcWm8731Reg.LLIN_f.LINMUTE     = 0u;       // Enable left channel line input mute
    stcWm8731Reg.LLIN_f.LRINBOTH    = 0u;       // Disable simultaneous input volume and mute load from left to right
    stcWm8731Reg.RLIN_f.RINVOL      = Rin_Volume;    // Right channel line input volume 0dB
    stcWm8731Reg.RLIN_f.RINMUTE     = 0u;       // Enable right channel line input mute
    stcWm8731Reg.RLIN_f.RINBOTH     = 0u;       // Disable simultaneous input volume and mute load from right to left
    /* Left & right headphone output */
    stcWm8731Reg.LHOUT_f.LHPVOL     = 0x5Fu;    // Set volume of left headphone to 0dB. 0x30(-73dB) ~ 0x7F(+6dB), 0 ~ 0x2F: mute
    stcWm8731Reg.LHOUT_f.LZCEN      = 0u;       // Disable left channel zero cross detect
    stcWm8731Reg.LHOUT_f.LRHPBOTH   = 0u;       // Disable simultaneous output volume and mute load from left to right
    stcWm8731Reg.RHOUT_f.RHPVOL     = 0x5Fu;    // Set volume of right headphone to 0dB. 0x30(-73dB) ~ 0x7F(+6dB), 0 ~ 0x2F: mute
    stcWm8731Reg.RHOUT_f.RZCEN      = 0u;       // Enable right channel zero cross detect
    stcWm8731Reg.RHOUT_f.RLHPBOTH   = 0u;       // Disable simultaneous output volume and mute load from right to left
    /* Analog audio path control */
#if(RECORD_MIC)
    stcWm8731Reg.AAPC_f.MICBOOST    = 1u;       // Disable boost, 0: disable 1: enable
    stcWm8731Reg.AAPC_f.MUTEMIC     = 0u;       // Enable mute to ADC
    stcWm8731Reg.AAPC_f.INSEL       = 1u;       // Line input select to ADC, 0: linein  1: mic
    stcWm8731Reg.AAPC_f.BYPASS      = 1u;       // Enbale bypass 0: disable 1:enable
    stcWm8731Reg.AAPC_f.DACSEL      = 0u;       // Select DAC
    stcWm8731Reg.AAPC_f.SIDETONE    = 0u;       // Disable side tone 0: disable 1:enable
    stcWm8731Reg.AAPC_f.SIDEATT     = 0u;       // 0: -6dB, 1: -12dB, 2: -9dB, 3: -15dB.
#else
    stcWm8731Reg.AAPC_f.MICBOOST    = 0u;       // Disable boost, 0: disable 1: enable
    stcWm8731Reg.AAPC_f.MUTEMIC     = 1u;       // Enable mute to ADC
    stcWm8731Reg.AAPC_f.INSEL       = 0u;       // Line input select to ADC, 0: linein  1: mic
    stcWm8731Reg.AAPC_f.BYPASS      = 1u;       // Enbale bypass 0: disable 1:enable
    stcWm8731Reg.AAPC_f.DACSEL      = 0u;       // Select DAC
    stcWm8731Reg.AAPC_f.SIDETONE    = 0u;       // Disable side tone 0: disable 1:enable
    stcWm8731Reg.AAPC_f.SIDEATT     = 0u;       // 0: -6dB, 1: -12dB, 2: -9dB, 3: -15dB.
#endif
    /* Digital audio path control */
    stcWm8731Reg.DAPC_f.ADCHPD      = 0u;       // Enable high pass filter
    stcWm8731Reg.DAPC_f.DEEMP       = 0u;       // De-emphasis contrl. 0: disable, 1: 32kHz, 2: 44.1kHz, 3: 48kHz
    stcWm8731Reg.DAPC_f.DACMU       = 0u;       // 0:Disable soft mute   1: Enable soft mute
    stcWm8731Reg.DAPC_f.HPOR        = 0u;       // Clear offset when high pass
    /* Power down control */
    stcWm8731Reg.PDC_f.LINEINPD     = 0u;       // Disable line input power down
    stcWm8731Reg.PDC_f.MICPD        = 0u;       // Disable microphone input power down
    stcWm8731Reg.PDC_f.ADCPD        = 0u;       // Disable ADC power down
    stcWm8731Reg.PDC_f.DACPD        = 0u;       // Disable DAC power down
    stcWm8731Reg.PDC_f.OUTPD        = 0u;       // Disable output power down
    stcWm8731Reg.PDC_f.OSCPD        = 0u;       // Disable oscillator power down
    stcWm8731Reg.PDC_f.CLKOUTPD     = 0u;       // Disable CLKOUT power down
    stcWm8731Reg.PDC_f.POWEROFF     = 0u;       // Disable power off mode
    /* Digital audio interface format */
    stcWm8731Reg.DAIF_f.FORMAT      = 2u;       // 0: MSB-First, right justified, 1: MSB-first, left justified, 2: I2S-format, 3: DSP mode
    stcWm8731Reg.DAIF_f.IWL         = 0u;       // 0: 16 bits, 1: 20 bits, 2: 24 bits, 3: 32 bits
    stcWm8731Reg.DAIF_f.LRP         = 0u;       // 1: right channel DAC data when DACLRC (WS) is high,  0: right channel DAC data when DACLRC (WS) is low
    stcWm8731Reg.DAIF_f.LRSWAP      = 0u;       // 1: swap left channel and right channel, 0: don't swap
    stcWm8731Reg.DAIF_f.MS          = 0u;       // 1: Enable master mode, 0: Enable slave mode
    stcWm8731Reg.DAIF_f.BCLKINV     = 0u;       // Don't invert BCLK
    /* Sampling control */
    stcWm8731Reg.SC_f.NORMAL_USB    = 0u;       // 0: normal mode, 1: USB mode
    stcWm8731Reg.SC_f.BOSR          = 0u;       // Nomrmal mode: 0: 256fs, 1: 384fs
                                                // USB mode: 0: 250fs, 1:272fs
    stcWm8731Reg.SC_f.SR            = 2u;       // Sample rate setting
    stcWm8731Reg.SC_f.CLKDIV2       = 0u;       // 0: core clock is MCLK, 1: core clock is MCLK divided by 2
    stcWm8731Reg.SC_f.CLKODIV2      = 0u;       // 0: output clock is core clock, 1: core clock is core clock/2
    // Active control
    stcWm8731Reg.AC_f.ACTIVE        = 1u;       // 0: inactive, 1: active

    WM8731_Init(I2C_CH, &stcWm8731Reg);

    WM8731_SetHpVolume(I2C_CH, 0x7Fu,0x7Fu);    //0x2F-MUTE ~ 0x7F Maximum
}

/**
 *******************************************************************************
 ** \brief  Configuration Codec to play wav file
 **
 ** \param  None
 **
 ** \retval None
 **
 ******************************************************************************/
void WM8731_CodecConfigPlay(void)
{
    stc_wm8731_reg_t stcWm8731Reg;
    MEM_ZERO_STRUCT(stcWm8731Reg);
    /* Config codec */
    /* Reset register */
    stcWm8731Reg.RESET              = 0x00u;    // Reset WM8731
    /* Left & right line input */
    stcWm8731Reg.LLIN_f.LINVOL      = 0x00u;    // Left channel line input volume: 0dB--0x17u
    stcWm8731Reg.LLIN_f.LINMUTE     = 1u;       // Enable left channel line input mute
    stcWm8731Reg.LLIN_f.LRINBOTH    = 0u;       // Disable simultaneous input volume and mute load from left to right
    stcWm8731Reg.RLIN_f.RINVOL      = 0x00u;    // Right channel line input volume 0dB
    stcWm8731Reg.RLIN_f.RINMUTE     = 1u;       // Enable right channel line input mute
    stcWm8731Reg.RLIN_f.RINBOTH     = 0u;       // Disable simultaneous input volume and mute load from right to left
    /* Left & right headphone output */
    stcWm8731Reg.LHOUT_f.LHPVOL     = 0x5Fu;    // Set volume of left headphone to 0dB. 0x30(-73dB) ~ 0x7F(+6dB), 0 ~ 0x2F: mute
    stcWm8731Reg.LHOUT_f.LZCEN      = 0u;       // Disable left channel zero cross detect
    stcWm8731Reg.LHOUT_f.LRHPBOTH   = 0u;       // Disable simultaneous output volume and mute load from left to right
    stcWm8731Reg.RHOUT_f.RHPVOL     = 0x5Fu;    // Set volume of right headphone to 0dB. 0x30(-73dB) ~ 0x7F(+6dB), 0 ~ 0x2F: mute
    stcWm8731Reg.RHOUT_f.RZCEN      = 0u;       // Enable right channel zero cross detect
    stcWm8731Reg.RHOUT_f.RLHPBOTH   = 0u;       // Disable simultaneous output volume and mute load from right to left
    /* Analog audio path control */
    stcWm8731Reg.AAPC_f.MICBOOST    = 0u;       // Disable boost
    stcWm8731Reg.AAPC_f.MUTEMIC     = 1u;       // Enable mute to ADC
    stcWm8731Reg.AAPC_f.INSEL       = 0u;       // Line input select to ADC
    stcWm8731Reg.AAPC_f.BYPASS      = 0u;       // Enbale bypass
    stcWm8731Reg.AAPC_f.DACSEL      = 1u;       // Select DAC
    stcWm8731Reg.AAPC_f.SIDETONE    = 0u;       // Disable side tone
    stcWm8731Reg.AAPC_f.SIDEATT     = 0u;       // 0: -6dB, 1: -12dB, 2: -9dB, 3: -15dB.
    /* Digital audio path control */
    stcWm8731Reg.DAPC_f.ADCHPD      = 0u;       // Enable high pass filter
    stcWm8731Reg.DAPC_f.DEEMP       = 3u;       // De-emphasis contrl. 0: disable, 1: 32kHz, 2: 44.1kHz, 3: 48kHz
    stcWm8731Reg.DAPC_f.DACMU       = 0u;       // 0:Disable soft mute   1: Enable soft mute
    stcWm8731Reg.DAPC_f.HPOR        = 0u;       // Clear offset when high pass
    /* Power down control */
    stcWm8731Reg.PDC_f.LINEINPD     = 0u;       // Disable line input power down
    stcWm8731Reg.PDC_f.MICPD        = 0u;       // Disable microphone input power down
    stcWm8731Reg.PDC_f.ADCPD        = 0u;       // Disable ADC power down
    stcWm8731Reg.PDC_f.DACPD        = 0u;       // Disable DAC power down
    stcWm8731Reg.PDC_f.OUTPD        = 0u;       // Disable output power down
    stcWm8731Reg.PDC_f.OSCPD        = 0u;       // Disable oscillator power down
    stcWm8731Reg.PDC_f.CLKOUTPD     = 0u;       // Disable CLKOUT power down
    stcWm8731Reg.PDC_f.POWEROFF     = 0u;       // Disable power off mode
    /* Digital audio interface format */
    stcWm8731Reg.DAIF_f.FORMAT      = 2u;       // 0: MSB-First, right justified, 1: MSB-first, left justified, 2: I2S-format, 3: DSP mode
    stcWm8731Reg.DAIF_f.IWL         = 0u;       // 0: 16 bits, 1: 20 bits, 2: 24 bits, 3: 32 bits
    stcWm8731Reg.DAIF_f.LRP         = 0u;       // 1: right channel DAC data when DACLRC (WS) is high,  0: right channel DAC data when DACLRC (WS) is low
    stcWm8731Reg.DAIF_f.LRSWAP      = 0u;       // 1: swap left channel and right channel, 0: don't swap
    stcWm8731Reg.DAIF_f.MS          = 0u;       // 1: Enable master mode, 0: Enable slave mode
    stcWm8731Reg.DAIF_f.BCLKINV     = 0u;       // Don't invert BCLK
    /* Sampling control */
    stcWm8731Reg.SC_f.NORMAL_USB    = 0u;       // 0: normal mode, 1: USB mode
    stcWm8731Reg.SC_f.BOSR          = 0u;       // Nomrmal mode: 0: 256fs, 1: 384fs
                                                // USB mode: 0: 250fs, 1:272fs
    stcWm8731Reg.SC_f.SR            = 1u;       // Sample rate setting
    stcWm8731Reg.SC_f.CLKDIV2       = 0u;       // 0: core clock is MCLK, 1: core clock is MCLK divided by 2
    stcWm8731Reg.SC_f.CLKODIV2      = 0u;       // 0: output clock is core clock, 1: core clock is core clock/2
    // Active control
    stcWm8731Reg.AC_f.ACTIVE        = 1u;       // 0: inactive, 1: active

    WM8731_Init(I2C_CH, &stcWm8731Reg);

    WM8731_SetHpVolume(I2C_CH, 0x7Fu,0x7Fu);    //0x2F-MUTE ~ 0x7F Maximum
}

/**
 *******************************************************************************
 ** \brief  Configuration Codec to play wav file
 **
 ** \param  None
 **
 ** \retval None
 **
 ******************************************************************************/
void SpeakerInit(void)
{
	stc_port_init_t stcPortIni;
#if(SPEAKER_ON)
	/* Initialize SPK_EN port for speaker */
	MEM_ZERO_STRUCT(stcPortIni);
	stcPortIni.enPinMode = Pin_Mode_Out;
	PORT_Init(SPK_EN_PORT, SPK_EN_PIN, &stcPortIni);
	SPEAKER_EN();
#endif
}

/*******************************************************************************
 * Local variable definitions ('static')
 ******************************************************************************/

/*******************************************************************************
 * Function implementation - global ('extern') and local ('static')
 ******************************************************************************/

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/

audio.h

/******************************************************************************/
/** \file audio.h
 **
 ** A detailed description is available at
 ** @link audio Series description @endlink
 **
 **   - 2021-4-15  1.0  First version for Audio Series Functions description
 **     Library.
 **
 ******************************************************************************/
#ifndef __AUDIO_H__
#define __AUDIO_H__

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include "hc32_common.h"
 
/*******************************************************************************
 * Local pre-processor symbols/macros ('#define')
 ******************************************************************************/
/* Define if need play by speaker*/
#define SPEAKER_ON                  (true)
	
/* Select Record source */
//#define RECORD_MIC                  (true)

#define SPK_EN_PORT                 (PortB)
#define SPK_EN_PIN                  (Pin00)

#define SPEAKER_EN()                (PORT_SetBits(SPK_EN_PORT, SPK_EN_PIN))
#define SPEAKER_DISEN()             (PORT_ResetBits(SPK_EN_PORT, SPK_EN_PIN))
	
//#define RECORDER_WAVFILELEN         (15u*1024u)

///*******************************************************************************
// * Local variable definitions ('static')
// ******************************************************************************/



void WM8731_CodecConfigRecord(void);
void WM8731_CodecConfigPlay(void);
void SpeakerInit(void);
 
#endif /* __AUDIO_H__ */

/*******************************************************************************
 * End of file
 ******************************************************************************/

main.c

/**
 *******************************************************************************
 * @file  main.c
 * @brief Main program template.
 @verbatim
   Change Logs:
   Date             Author          Notes
   2020-06-30       Zhangxl         First version
 @endverbatim
 *******************************************************************************
 * Copyright (C) 2016, Huada Semiconductor Co., Ltd. All rights reserved.
 *
 * This software is owned and published by:
 * Huada Semiconductor Co., Ltd. ("HDSC").
 *
 * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
 * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
 *
 * This software contains source code for use with HDSC
 * components. This software is licensed by HDSC to be adapted only
 * for use in systems utilizing HDSC components. HDSC shall not be
 * responsible for misuse or illegal use of this software for devices not
 * supported herein. HDSC is providing this software "AS IS" and will
 * not be responsible for issues arising from incorrect user implementation
 * of the software.
 *
 * Disclaimer:
 * HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
 * REGARDING THE SOFTWARE (INCLUDING ANY ACCOMPANYING WRITTEN MATERIALS),
 * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
 * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
 * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
 * WARRANTY OF NONINFRINGEMENT.
 * HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
 * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
 * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
 * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
 * SAVINGS OR PROFITS,
 * EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
 * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
 * FROM, THE SOFTWARE.
 *
 * This software may be replicated in part or whole for the licensed use,
 * with the restriction that this Disclaimer and Copyright notice must be
 * included with each copy of this software, whether used in part or whole,
 * at all times.
 *******************************************************************************
 */

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include "hc32_ddl.h"
#include "wm8731.h"
#include "audio.h"
#include "i2c.h"
#include "key.h"
#include "led.h"

/*******************************************************************************
 * Local type definitions ('typedef')
 ******************************************************************************/

/*******************************************************************************
 * Local pre-processor symbols/macros ('#define')
 ******************************************************************************/

/*******************************************************************************
 * Global variable definitions (declared in header file with 'extern')
 ******************************************************************************/

/*******************************************************************************
 * Local function prototypes ('static')
 ******************************************************************************/

/*******************************************************************************
 * Local variable definitions ('static')
 ******************************************************************************/

/*******************************************************************************
 * Function implementation - global ('extern') and local ('static')
 ******************************************************************************/

/**
 * @brief  Main function of template project
 * @param  None
 * @retval int32_t return value, if needed
 */
int32_t main(void)
{
	/* Initialize i2c for audio */
	i2cInit();
	IniKey();
	IniLedPort();

	/* WM8731 configuration for recorder */
	WM8731_CodecConfigRecord();
	
	while(1)
	{
		KeyScan();
	}
}

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/

 

本帖最后由 1nnocent 于 2021-4-23 09:38 编辑

回复评论 (2)

这个帖子是分好几天写的,写完存草稿了,最后一天发布的时候好像在论坛显示的发布时间是刚创建帖子的日期,不是发布当天的,所以好像沉底了。

所以帖子虽然是当天发的,论坛里却要翻到好几天前才能找到。

之前还有一些帖子也是这个情况,可能是个bug

点赞  2021-5-14 18:41
1nnocent 发表于 2021-5-14 18:41 这个帖子是分好几天写的,写完存草稿了,最后一天发布的时候好像在论坛显示的发布时间是刚创建帖子的日期, ...

收到,已经和内部讨论下,会以发帖时间排序,避免沉帖子,大概这周技术会调整、修复过来

点赞  2021-5-17 11:53
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复