📄 fm_test.c
字号:
/*
Module Name : fm_test.c
Functions : FM_TEST
Purpose : Test DA202
Author : Otis Yu
Notes :
*/
/*--------------------------------------------------------------------------*
* Local header files *
*--------------------------------------------------------------------------*/
#include <demo/uart270.h>
#include <demo/sagiters.h>
#include <user/FM5767.h>
#include <demo/gio270.h>
/*--------------------------------------------------------------------------*
* Extern global variables *
*--------------------------------------------------------------------------*/
extern volatile unsigned short UART0IntFlag;
extern unsigned char audio_output_channel;
extern ULONG DEV_FM_khz;
/*--------------------------------------------------------------------------*
* Const, Macro, type definition *
*--------------------------------------------------------------------------*/
#define FmPlay 4
#define FmRecord 5
#define Channel_1 0x00
#define Channel_3 0x02
#define E_PASS 0
#define all 0
/*--------------------------------------------------------------------------*
* Global Variables *
*--------------------------------------------------------------------------*/
/*---------------------------------------------------------*
* Brief : API_FM_SetFreq *
* Return : *
* Description : *
*----------------------------------------------------------*/
short API_FM_SetFreq(ULONG freq)
{
short ret;
if( freq != DEV_FM_khz ) DEV_FM_Preset_Scan(freq);
ret = DEV_FM_Volumn_Control_Enable(all);
return ret;
}
/*---------------------------------------------------------*
* Brief : API_FM_BusEnable *
* Return : *
* Description : *
*----------------------------------------------------------*/
void API_FM_BusEnable( BOOL TrueEnable )
{
if( TrueEnable ) GIO_setBit(GIO30); //FM_BUSEN
else GIO_clearBit(GIO30); //FM_BUSEN
}
/*---------------------------------------------------------*
* Brief : API_FM_On *
* Return : *
* Description : *
*----------------------------------------------------------*/
short API_FM_On(void)
{
short ret;
API_FM_BusEnable( TRUE );
ret = DEV_FM_Standby_Mode_Disable();
if( ret != E_PASS ) goto end_api_fm_on;
end_api_fm_on:
DEV_FM_Volumn_Control_Disable(all);
return ret;
}
/*---------------------------------------------------------*
* Brief : API_FM_Off *
* Return : *
* Description : *
*----------------------------------------------------------*/
short API_FM_Off(void)
{
short ret;
ret = DEV_FM_Volumn_Control_Disable(all);
if( ret != E_PASS ) goto end_api_fm_off;
ret = DEV_FM_Standby_Mode_Enable();
end_api_fm_off:
return ret;
}
/*---------------------------------------------------------*
* Brief : API_POWER_Managment *
* Return : *
* Description : *
*----------------------------------------------------------*/
void POWER_Managment( int which_play_mode, unsigned char out_channel )
{
API_FM_BusEnable( TRUE );
API_FM_On();
API_AUDIO_Input_MicBiasEnable(FALSE);
API_AUDIO_PowerOn();
API_AUDIO_SetRecordMode( Channel_3, out_channel );
}
/*--------------------------------------------------------------------------*
* Brief : FM_TEST
* Return : None
* Description :
*--------------------------------------------------------------------------*/
void FM_TEST(void)
{
static char i=0;
UART_sendString( UART0, "\r\n ***************FM TEST***************" );
DEV_Audio_Init();
if(i != 1)
{
DEV_FM_Init();
i = 1;
}
POWER_Managment( FmRecord, audio_output_channel );
API_FM_SetFreq( 98800 );
API_AUDIO_Input_SetVolume( 1 );
UART_sendString( UART0, "\r\n Push Any Key(PC) Exit Test" );
while(UART0IntFlag);
UART0IntFlag = 1;
API_FM_Off();
API_FM_BusEnable( FALSE );
API_AUDIO_PowerOff();
UART_sendString( UART0, "\r\n END" );
UART_sendString( UART0, "\r\n " );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -