📄 demomain.c
字号:
/*******************************************************************************
Copyright (C) Excelpoint System (Pte) Ltd. 2006
FILE: demoMain.c
DESCRIPTION: This file the entry function
*******************************************************************************/
#include <stdio.h>
#include <windows.h>
#include <winbase.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <crtdbg.h>
#include "serialcom.h"
#include "demoBlueCAP.h"
#include "HBCP.h"
#define BUF_SIZE 2000
static unsigned long baudRate = 115200;
static unsigned char theBuf[BUF_SIZE];
/********************************************************************************
* Function: main
* Description: Entry function. Receive key and read data into event handler
*
********************************************************************************/
int main(int argc, char* argv[])
{
int rx_num;
UartDrv_Configure(baudRate, (argc < 2)?"COM1":argv[1]);
if (!UartDrv_Start())
{
printf("UartDrv_Start() failed! Exiting...\n");
return 0;
}
init_demo();
Menu();
while (1)
{
// receive a key
if (kbhit())
{
char ch;
ch = getch();
HandKey(ch);
}
// Read event
UartDrv_Rx(theBuf, BUF_SIZE, &rx_num);
if (rx_num>0)
{
// rx handler
HBCP_Receive(rx_num,theBuf);
}
else
{
Sleep(10);
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -