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

📄 uart.h

📁 基本STC4052写的一个小的OS, 完成了任务调度功能,及堆栈空间切换, 及中断处理
💻 H
字号:
//---------------------------------------------------------------
//      
//       Copyright (c) 2006-2007 E-compass electronic Co.,Ltd.               
//       All Right Reserved.                                     
//                                                               
//       $Author    walnutcy
//       $Email     walnutcy@gmail.com              
//       $Version   v1.0  
//       $FileName                                       
//       $Since                                            
//       $Log                                                    
//                                                               
//       DESCRIPTION   
//
//		 History:         
//		 <author>          <time>     <version >    <desc> 
//---------------------------------------------------------------

#ifndef _UART_H
#define _UART_H

#include "..\includes.h"

#define _INTERRUPT_4_ES    1


//#define _SRL_INT_SEND_  

#define MAX_SERIAL_BUFFER_LEN (4 + 8 + 1) // start(1) + size(1) + cmd(1) + data(8) + end(1) + blank(2)
#define SERIAL_FRAME_START 0x5a
#define SERIAL_FRAME_END 0xa5


#define UART_REnable()    (REN = 1)
#define UART_RDisable()   (REN = 0)

extern BOOL gbRxFinish;

extern U8 gUartPrinterNo;

#define UART_PrinterNo() (gUartPrinterNo)
#define UARTFreePrinter() (gUartPrinterNo=0xFF)

// functions list:
#define SRL_GetRevStatus()  (gbRxFinish) // BOOL GetSrlRevStatus()

// send serial pack : cmd->command, databuf->data buffer, len-> the length of databuf
void SRL_SendPack(U8 cmd, IU8* databuf, U8 len) REENTRANT;
void SRL_RevChar(U8 rvch)	REENTRANT; 
void SRL_Init() REENTRANT;// Initialize the serial communication

// get the received command, and the data , return databuf length
U8 SRL_GetRevPack(U8* cmd, IU8* databuf) REENTRANT;
void UartPrint(U8* str)  REENTRANT ;

void UartReq (void) REENTRANT ;
void UartFree (void) REENTRANT ;

// functions end


#endif //_SERIALPROTOCOL_H

⌨️ 快捷键说明

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