📄 upsd_uart.h
字号:
/*--------------------------------------------------------------------------
uPSD_UART.H
Header file for uPSD 3200 Serial I/O (UART) Device Driver
08/2002 Ver 0.1 - Initial Version
Copyright (c) 2002 ST Microelectronics
This example demo code is provided as is and has no warranty,
implied or otherwise. You are free to use/modify any of the provided
code at your own risk in your applications with the expressed limitation
of liability (see below) so long as your product using the code contains
at least one uPSD products (device).
LIMITATION OF LIABILITY: NEITHER STMicroelectronics NOR ITS VENDORS OR
AGENTS SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
--------------------------------------------------------------------------*/
#ifndef _UPSD_UART_H_
#define _UPSD_UART_H_
#define TBUF_SIZE 128 // Transmit buff size, DO NOT CHANGE
#define RBUF_SIZE 128 // Receiver Buff size, DO NOT CHANGE
// Routine to compute timer value for given baudrate and returns timer value
// uart_no = 0 for uart0, elase uart1 is assumed
// baudrate is the requsted baud rate
// timer_no is 0=timer1 or else timer2 assumed
unsigned int uPSD_UART_Timer (unsigned char uart_no, unsigned int baudrate, unsigned char timer_no); //calculate BAUDRATE based upon UARTx's configuation
// Routine to initialialze uart - Note see definition of bitwise serial info byte!
// User should call uPSD_UART_Timer first to set up timer and compute baud rate
// serial_info = bit definition of uart features
// timer_value = timer value for baudrate (use uPSD_UART_Timer to calcualte)
void uPSD_UART_Init(unsigned char serial_info,unsigned int timer_value); //Initilization UARTx
// loads a byte into transmit buffer for uart to send
char uPSD_UART_Putchar (char c, bit uart_ch); //write one byte through predefined UART Channel
// returns a byte from uart receive buffer
char uPSD_UART_Getchar (bit uart_ch); //read one byte through predefined UART Channel
// returns receive buffer length
unsigned char uPSD_UART_Rbuflen (bit uart_ch); //message length which hasn't read in receive buff at predefined UART channel
// returns xmit buffer length
unsigned char uPSD_UART_Tbuflen (bit uart_ch); //message length which hasn't sent in transmitter buff at predefined UART channel
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -