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

📄 ep2_in.c

📁 Mitsubishi M30245 SampleCode
💻 C
字号:
/*******************************************************************
 *
 *    DESCRIPTION: M30245 Mit_USB Demonstration Application
 *
 *    AUTHOR: Mitsubishi DEC-E
 *
 *    HISTORY: 0.5 5/30/02 Initial creation for NC30
 *			   1.0 6/18/02 First official release
 *			   1.1 6/27/02 Updated ISO routines
 *			   1.2 8/07/02 Updated for Rev B Starter Kit Board
 *
 *******************************************************************/

/** include files **/
#include "sfr245.h"
#include "extern.h"

// Function Prototypes
void SendInterruptData(void);

/*
 ** SendInterruptData
 *
 *  FILENAME: ep2_in.c 
 *
 *  PARAMETERS: None
 *
 *  DESCRIPTION: Sends buffer to HOST via interrupt transactions approx every
 *				 30mS. This data is loaded in to the buffer by means of Timer A1
 *				 interrupt routine. From there a flag (NewEP2Data) is set indicating
 *				 to MAIN that new data is availiable to send to HOST. This flag in
 *				 combination with In Buffer Ready triggers the call of this function and
 *				 subsequent data transmission.  
 *
 *  RETURNS: Nothing
 *
 */

void SendInterruptData(void){
unsigned char i = 0x00;

	if ( !USBFlags.Configured ){	// If device is not configured then do not load
		return;						// FIFO as this may cause errors. Just exit function.
	}

	if ( in2csr1 ){					// If previous data has not been sent (IBR != 0)
		return;						// then exit function and wait until next go round.
	}

	for ( i = 0; i < 5; i++ ){		// Load FIFO w/ data (5 bytes)
		ep2il = EP2Buffer[i];	
	}
	
	DataTransferFlags.NewEP2Data = 0;	// New data has been loaded to send

	in2csr3 = 1;						// Set IN_PKT_RDY letting the host take data

	for ( i = 1; i < 5; i++ ){			// Zero out switches...
		EP2Buffer[i] = 0x00;	
	}

}



⌨️ 快捷键说明

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