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

📄 txtext.c

📁 epson usb2.0 控制芯片 S1R72V05 固件程序。
💻 C
字号:
/*
================================================================================
* @file   TxText.c
* @brief  Process the UART string transmission
* @author 2006/03/29 Michiru Kagaya
* Copyright (C)SEIKO EPSON Corp. All Rights Reserved.
================================================================================
*/

//=================================
// 	Include files
//=================================
#include <string.h>
#include "UART_FUNC.h"
#include "UART_FuncCom.h"
#include "UART_IF.h"

//=================================
// 	  Fucntion prototype
//=================================
static short SndTextCallback( unsigned short wMsg, unsigned short wStatus, void* pTxSize );

//=================================
// 	  Variables declaration
//=================================
typedef struct tagTX_TXT_INFO {
	UART_FUNC_CALLBACK pfnRcvCmpCallback;
}TX_TXT_INFO;

static TX_TXT_INFO sTxTxtInfo;

/*
--------------------------------------------------------------------------------
*					  UART_FuncSendTextA
* @brief   Send string (Asynchronoud )
* @param   unsigned char bChannel	: Channel number of suspension
*		   unsigned char  *pString	: The address of the transmission data
*		   UART_FUNC_CALLBACK pfnCallbackProc : Completion notification callback function
* @retval  unsigned short
*			STATUS_SUCCESS			: Complete normally
*			STATUS_INVALID_PARAMETER: Parameter error
--------------------------------------------------------------------------------
*/
short UART_FuncSendTextA ( unsigned char bChannel, unsigned char *pString, UART_FUNC_CALLBACK pfnCallbackProc )
{
	unsigned short wSize;
	short wStatus;
	//=========================
	// Check parameter
	//=========================
	if( pString == NULL ){
		return STATUS_INVALID_PARAMETER;
	}

	//====================================
	// Trnasmission process(Realization:UART_FuncSendDataA )
	//====================================

	sTxTxtInfo.pfnRcvCmpCallback = pfnCallbackProc;	// Save the callback pointer
	wSize = (unsigned short)strlen( (char *)pString );
	wStatus = UART_FuncSendDataA( bChannel, wSize, pString, SndTextCallback );

	return wStatus;
}

/*
--------------------------------------------------------------------------------
*					  UART_FuncSendText
* @brief   Send string (Asynchronoud )
* @param   unsigned char bChannel	: Channel number of suspension
*		   unsigned char  *pString	: Transfer data address
* @retval  unsigned short
*			STATUS_SUCCESS			: Complete normally
*			STATUS_INVALID_PARAMETER: Parameter error
--------------------------------------------------------------------------------
*/
short UART_FuncSendText ( unsigned char bChannel, unsigned char *pString )
{
	unsigned short wSize;
	short wStatus;

	//=========================
	// Check parameter
	//=========================
	if( pString == NULL ){
		return STATUS_INVALID_PARAMETER;
	}

	//====================================
	// Trnasmission process(Realization:UART_FuncSendDataA )
	//====================================

	wSize = (unsigned short)strlen( (char *)pString );
	wStatus = UART_FuncSendData( bChannel, wSize, pString );

	return wStatus;
}


/*
--------------------------------------------------------------------------------
*					  SndTextCallback
* @brief   Receive data transmit completion callback
* @param   unsigned short wMsg
*		   unsigned short wStatus
*		   void* pTxSize
* @retval  unsigned short
*			STATUS_SUCCESS			: Complete normally
--------------------------------------------------------------------------------
*/
short SndTextCallback( unsigned short wMsg, unsigned short wStatus, void* pTxSize )
{

	//=========================
	// Check parameter
	//=========================
	if( wMsg == UART_FUNCM_SND_DATA_CMP || pTxSize == NULL ){
		// Would not run to here.
	}
	// Callback notification because the transmission was completed
	if( sTxTxtInfo.pfnRcvCmpCallback != NULL ){
		return sTxTxtInfo.pfnRcvCmpCallback( UART_FUNCM_SND_TEXT_CMP, wStatus, pTxSize );
	}
	return STATUS_SUCCESS;
}

⌨️ 快捷键说明

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