⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bt.c

📁 我个人编写的车载dvd上的程序
💻 C
字号:

#include "public.h"
#define LINUART_CR2_TIEN   (0x01 << 7)
#define LINUART_CR2_RIEN   (0x01 <<5)
#define LINUART_CR2_TEN     (0x01 << 3)
#define LINUART_CR2_REN     (0x01 << 2)

unsigned char ucBTUartCommand;

void LINUART_init()
{
        PD_BTCTR = 1;
        PCR1_BTCTR  = 1;
        PCR2_BTCTR  = 0;
        PIN_BTCTR  = 1;
         LINUART_BRR1  = 26;
         LINUART_BRR2  =  1;
         LINUART_CR2  = /*LINUART_CR2_TIEN|LINUART_CR2_RIEN|*/LINUART_CR2_REN|LINUART_CR2_TEN;
         	
}
void LINUartTx()
{
      LINUART_CR2 &= ~LINUART_CR2_TIEN;
      
}
void LINUartRx()
{
      ucBTUartCommand = LINUART_DR;
}
void BT_Transfer(unsigned char data)
{
   while((LINUART_SR&0x80)==0);LINUART_DR=data;
       //LINUART_CR2 |= LINUART_CR2_TIEN;
}
#ifdef DEBUG
void   SCI_SendStr(unsigned char *str,unsigned char data)
{
   unsigned char high,low;
      while(*str)
	{
		BT_Transfer(*str);
		str++;
	}
           high  = (data >> 4)& 0x0f;
           low  = data & 0x0f;
           if(high > 9) high = high - 10 + 'A';
           else   high  = high + '0';
           if(low > 9) low  = low - 10 + 'A';
           else   low  = low + '0';
           BT_Transfer(high);
           BT_Transfer(low);
	    BT_Transfer(0xd);
	    BT_Transfer(0xa);	
}
#endif
void BTMain()
{
         BT_Transfer('H');
         switch(ucBTUartCommand)
         	{
        /*************一下处理蓝牙数据**********/ 	
         	   case 1:
         	       break;
         	       
         	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -