usb.h

来自「DIY自己的MP3的参考价值极高的代码。含有详细的解释」· C头文件 代码 · 共 65 行

H
65
字号
/* ***********************************************************************
**
**  Copyright (C) 2002  Jesper Hansen <jesperh@telia.com> and 
**			Romuald Bialy (MIS) <romek_b@o2.pl>.
**
**
**  Yampp-7/USB - low level support library
**
**
*************************************************************************
**
**   This file is part of the yampp system.
**
**  This program is free software; you can redistribute it and/or
**  modify it under the terms of the GNU General Public License
**  as published by the Free Software Foundation; either version 2
**  of the License, or (at your option) any later version.
**
**  This program is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**  GNU General Public License for more details.
**
**  You should have received a copy of the GNU General Public License
**  along with this program; if not, write to the Free Software Foundation, 
**  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
**
*************************************************************************
**
**  Revision History
**
**  when         what  who	why
**
**  2002-09-22   1.0   MIS      initial public release
**
*********************************************************************** */


#define USB_PORT	PORTD
#define USB_DDR		DDRD
#define USB_PIN		PIND

#define USB_TXRDY	PD3
#define USB_RXRDY	PD2

#define USB_ADDR	0x8000



#ifndef USB_ASM

#define usb_rxready	bit_is_clear(USB_PIN, USB_RXRDY)
#define usb_txfree	bit_is_clear(USB_PIN, USB_TXRDY)



void usb_init(void);
u08 usb_readbyte(void);
void usb_writebyte(u08 b);

u08 usb_readblock(u08* ptr, u16 length);
u08 usb_writeblock(u08* ptr, u16 length);

#endif

⌨️ 快捷键说明

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