📄 gprs.txt
字号:
/***************************************************************************\
Copyright (c) 2004-2007 threewater@up-tech.com, All rights reserved.
by threewter 2004.5.12
\***************************************************************************/
/***************************************************************************\
#说明: C main 函数,ucos-ii初始化等定义
---------------------------------- Bug --------------------------------------
---------------------------------- TODO list --------------------------------------
----------------------------------修正--------------------------------------
2004-5-12 创建
\***************************************************************************/
#include "inc/macro.h"
#include <string.h>
#include <stdio.h>
#include "inc/Uart.h"
#include "inc/lcd.h"
#include "inc/reg2410.h"
#include "inc/lib.h"
#include "inc/uhal.h"
#include "inc/GPRS.h"
#include "inc/Keyboard.h"
#include "inc/isr.h"
#pragma import(__use_no_semihosting_swi) // ensure no functions that use semihosting
int InputNumber(char *);
int main(void)
{ int key;
char number[20];
ARMTargetInit(); //开发版初始化
LCD_Init();
GPRS_Init();
Key_init();
while(1)
{GPRS_KeyUartPoll();
key=GetKey();
switch(key)
{case 11: LCD_printf("Send short message-----\n");
if(!InputNumber(number))break;
GPRS_MGS(number,"Hello! Beijing UP-TECH www.up-tech.com");
LCD_printf("\n");
break;
case 12: LCD_printf("Call the number------\n");
if(!InputNumber(number))break;
GPRS_CALL(number);
LCD_printf("\n");
break;
case 13: LCD_printf("Ring off----\n");
GPRS_HOLD();
break;
case 14: LCD_printf("Pick up----\n");
GPRS_ANSWER();
break;
}
}
while(1);
return 0;
}
int InputNumber(char *num)
{int key;
int i=0;
LCD_printf("Please input the number:\n");
while(1)
{ key=GetKey();
switch(key)
{case 16: LCD_printf("Exit..Do again\n");
return 0;
break;
case 15: num[i]=0;
LCD_printf("\n");
return 1;
break;
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9: num[i++]=key+48;
if(i>18){i=0;
LCD_printf("\n");}
LCD_printf("%d",key);
break;
case 17: break;
}//end switch
}//end while
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -