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

📄 msb430-uart1.h

📁 伟大的Contiki工程, 短小精悍 的操作系统, 学习编程不可不看
💻 H
字号:
/*Copyright 2007, Freie Universitaet Berlin. All rights reserved.These sources were developed at the Freie Universit鋞 Berlin, ComputerSystems and Telematics group.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions aremet:- Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.- Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution. - Neither the name of Freie Universitaet Berlin (FUB) nor the names of itscontributors may be used to endorse or promote products derived fromthis software without specific prior written permission.This software is provided by FUB and the contributors on an "as is"basis, without any representations or warranties of any kind, expressor implied including, but not limited to, representations orwarranties of non-infringement, merchantability or fitness for aparticular purpose. In no event shall FUB or contributors be liablefor any direct, indirect, incidental, special, exemplary, orconsequential damages (including, but not limited to, procurement ofsubstitute goods or services; loss of use, data, or profits; orbusiness interruption) however caused and on any theory of liability,whether in contract, strict liability, or tort (including negligenceor otherwise) arising in any way out of the use of this software, evenif advised of the possibility of such damage.This implementation was developed by the CST group at the FUB.For documentation and questions please use the web sitehttp://scatterweb.mi.fu-berlin.de and the mailinglistscatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website).Berlin, 2007*//** * @addtogroup interfaces * @{ *//** * @defgroup uart1 UART1 * The UART module multiplexes differenct protocol on the MSB's UART1 * interface. Currently RS232 and SPI are supported. * @{ *//** * @file	ScatterWeb.Uart.h * @author	Michael Baar	<baar@inf.fu-berlin.de> *  * Header file for MSP430 UART driver. */#ifndef __UART_H__#define __UART_H__#define	UART_RX				RXBUF1#define	UART_TX				TXBUF1#define UART_RESET_RX()		do { U1IFG &= ~URXIFG1; } while(0)#define	UART_RESET_RXTX()	do { U1IFG &= ~(URXIFG1 | UTXIFG1); } while(0)#define	UART_WAIT_RX()		while( (U1IFG & URXIFG1) == 0 ) { _NOP(); }#define	UART_WAIT_TX()		while( (U1IFG & UTXIFG1) == 0 ) { _NOP(); } #define UART_WAIT_TXDONE()	while( (UTCTL1 & TXEPT) == 0 ) { _NOP(); }/** * @brief Operating state */extern volatile unsigned char uart_mode;extern volatile unsigned char uart_lockcnt;/** * @name	UART mode flags * @{ */#define	UART_MODE_RS232		(0x00u)			///< RS232 mode#define	UART_MODE_SPI		(0x01u)			///< SPI mode#define UART_MODE_DEFAULT	UART_MODE_RS232#define UART_NUM_MODES		(UART_MODE_SPI + 1)	///< Highest mode number#define UART_MODE_RESET		(0xFFu)			///< reset with current settings/** @} */#define UART_WAIT_LOCK(x)	( (uart_mode != x ) && (uart_lockcnt) )#define UART_MODE_IS(x)		( uart_mode == x )#if 0#ifdef __SCATTERWEB__	typedef void(*fp_uart_handler)(void);#else	typedef unsigned int(*fp_uart_handler)(unsigned char);#endif#endif	typedef unsigned int(*fp_uart_handler)(unsigned char);/** * \brief      Initialize the UART module * *             This function is called from the boot up code to *             initalize the UART module. */void uart_init(void);void uart_set_speed(unsigned char mode, unsigned char ubr0, unsigned char ubr1, unsigned char umctl);void uart_set_handler(unsigned char mode, fp_uart_handler fpHandler);int uart_lock(unsigned char mode);int uart_unlock(unsigned char mode);int uart_get_mode(void);#endif /* __UART_H__ *//** @} *//** @} */

⌨️ 快捷键说明

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