📄 avr_uart.h
字号:
/* $Id: AVR_UART.h,v 1.1.1.1 2000/09/24 11:39:10 pure Exp $ */#ifndef __AVR_UART_h__#define __AVR_UART_h__#include "Types.h"#include "Device.h"#include "Thread.h"#include "Semaphore.h"class AVR_UART : public Device {protected: unsigned mhz; byte ubrr, ucr, usr, urxdr, utxdr; static const int UBRR = 0x29; static const int UCR = 0x2a; static const int USR = 0x2b; static const int UDR = 0x2c; static const int RXC = 0x80; static const int TXC = 0x40; static const int UDRE = 0x20; static const int FE = 0x10; static const int OR = 0x8; static const int RXCIE = 0x80; static const int TXCIE = 0x40; static const int UDREIE = 0x20; static const int RXEN = 0x10; static const int TXEN = 0x8; static const int CHR9 = 0x4; static const int RXB8 = 0x2; static const int TXB8 = 0x1; class RXThread : public Thread { private: AVR_UART& uart; public: RXThread(AVR_UART&); ~RXThread(); Semaphore sem; virtual void action(); } rxthread; friend RXThread; Semaphore sem_tx_ack; class TXThread : public Thread { private: AVR_UART& uart; public: TXThread(AVR_UART&); ~TXThread(); Semaphore sem; virtual void action(); } txthread; friend TXThread; public: AVR_UART(unsigned _mhz); ~AVR_UART(); Device* cs(unsigned addr); void clk(); unsigned irq(); byte readb(unsigned addr); void writeb(unsigned addr, byte data);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -