📄 main_beep.c
字号:
/*
***********************************************************
* Copyright (c)
* All rights reserved.
*
* 文件名称:main_beep.c
* 文件标识:程序实现体
* 摘 要:本文件是对beep功能的测试
*
* 当前版本:1.0
* 作 者:刘征
* 完成日期:2005.4.3
*
* 取代版本:
* 作 者:
* 完成日期:
***********************************************************
*/
#define GLOBAL_CLK
/*
===========================================================
* 头文件 *
===========================================================
*/
#include <stdlib.h>
#include <string.h>
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
extern void BUZZER_PWM_Test(void);
void *func_uart_test[][2]=
{
//iic
(void *)BUZZER_PWM_Test, " Beep test ",
0,0
};
/* ===================== 配置主频 ======================== */
void CLOCK_Init() // set MPLL = 400M
{
/* MPLL = (2*M*Fin)*Fin/(P*n) (n等于2的s次方)
Fin = 12,000,000
m = (MDIV+8), p = (PDIV+2), s = SDIV
MDIV PDIV SDIV */
ChangeMPllValue( 92, 1, 1 );
}
/*
***********************************************************
* 函数介绍:本函数被使用来做测试beep的功能。
* 输入参数:无
* 输出参数:无
* 返回值 :无
***********************************************************
*/
void Main(void)
{
int i;
Port_Init(); // 端口初始化
Isr_Init(); // 中断初始化
CLOCK_Init(); // set MPLL = 400M
ChangeClockDivider(14, 12); // FCLK:HCLK:PCLK = 1:4:8
cal_cpu_bus_clk();
Uart_Init(0,115200); // 串口初始化 波特率为115200
Uart_Select(0); // 选者串口0
Clk0_Disable();
Clk1_Disable();
while(1)
{
Uart_Printf("\n\n");
while(1)
{ //display menu
Uart_Printf("%2d:%s",i,func_uart_test[i][1]);
i++;
if((int)(func_uart_test[i][0])==0)
{
Uart_Printf("\n");
break;
}
if((i%4)==0)
Uart_Printf("\n");
}
Uart_Printf("\nPress Enter key to exit : ");
i = Uart_GetIntNum();
if(i==-1) break; // return.
if(i>=0 && i<7 ) // select and execute...
( (void (*)(void)) (func_uart_test[i][0]) )();
}
Uart_Printf("\n**************** Test end ****************\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -