• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetChar函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetChar函数的典型用法代码示例。如果您正苦于以下问题:C++ GetChar函数的具体用法?C++ GetChar怎么用?C++ GetChar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetChar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CommHandler

void CommHandler(void) //UART4 Interrupt handler implementation
{
    int c = GetChar();

    if (c >= 0)
    {
        //ConfigMode = 1;
        LEDon();
        //print("got char %02X\r\n", c);

        switch (c)
        {
            case 'b':
                print("rebooting into boot loader ...\r\n");
                Delay_ms(1000);
                bootloader();
                break;

            case 'c':
                debugCnt ^= 1;
                print("counter messages %s\r\n", debugCnt ? "on" : "off");
                break;

            case 'd':
                debugPrint ^= 1;
                print("debug messages %s\r\n", debugPrint ? "on" : "off");
                break;

            case 'g':
                Delay_ms(100);
                PutChar('x');

                for (int i = 0; i < CONFIGDATASIZE; i++)
                {
                    uint8_t data = configData[i];
                    PutChar(data);
                }

                break;

            case 'G':
                printConfig();
                break;

#if 0

            case 'H':
                if (CharAvailable() >= CONFIGDATASIZE)
                {
                    for (int i = 0; i < CONFIGDATASIZE; i++)
                    {
                        uint8_t data = GetChar();

                        if (data <= LARGEST_CONFIGDATA)
                        {
                            configData[i] = data;
                        }
                    }

                    configSave();
                }
                else
                {
                    UnGetChar(c); // try again in next loop
                }

                break;
#endif

            case 'h':
                for (int i = 0; i < CONFIGDATASIZE; i++)
                {
                    int data;

                    while ((data = GetChar()) < 0)
                        ;

                    if (data <= LARGEST_CONFIGDATA)
                    {
                        configData[i] = data;
                    }
                }

                configSave();
                break;

            case 'i':
                ConfigMode = 1;
                break;

            case 'j':
                ConfigMode = 0;
                break;

            case 'o':
                debugOrient ^= 1;
                print("Orientation messages %s\r\n", debugOrient ? "on" : "off");
                break;

            case 'p':
//.........这里部分代码省略.........
开发者ID:jacekheli,项目名称:Firmware,代码行数:101,代码来源:commhandler.c


示例2: GetLeadingChar

//------------------------------------------------------------------------------
bool FBasicTokenParser::GetToken(FBasicToken& Token, bool bNoConsts/* = false*/)
{
	// if the parser is in a bad state, then don't continue parsing (who 
	// knows what will happen!?)
	if (!IsValid())
	{
		return false;
	}

	Token.TokenName	= NAME_None;
	TCHAR c = GetLeadingChar();
	TCHAR p = PeekChar();
	if( c == 0 )
	{
		UngetChar();
		return 0;
	}
	Token.StartPos		= PrevPos;
	Token.StartLine		= PrevLine;
	if( (c>='A' && c<='Z') || (c>='a' && c<='z') || (c=='_') )
	{
		// Alphanumeric token.
		int32 Length=0;
		do
		{
			Token.Identifier[Length++] = c;
			if( Length >= NAME_SIZE )
			{
				Length = ((int32)NAME_SIZE) - 1;
				Token.Identifier[Length]=0; // need this for the error description

				FText ErrorDesc = FText::Format(LOCTEXT("IdTooLong", "Identifer ({0}...) exceeds maximum length of {1}"), FText::FromString(Token.Identifier), FText::AsNumber((int32)NAME_SIZE));
				SetError(FErrorState::ParseError, ErrorDesc);

				break;
			}
			c = GetChar();
		} while( ((c>='A')&&(c<='Z')) || ((c>='a')&&(c<='z')) || ((c>='0')&&(c<='9')) || (c=='_') );
		UngetChar();
		Token.Identifier[Length]=0;

		// Assume this is an identifier unless we find otherwise.
		Token.TokenType = FBasicToken::TOKEN_Identifier;

		// Lookup the token's global name.
		Token.TokenName = FName( Token.Identifier, FNAME_Find, true );

		// If const values are allowed, determine whether the identifier represents a constant
		if ( !bNoConsts )
		{
			// See if the identifier is part of a vector, rotation or other struct constant.
			// boolean true/false
			if( Token.Matches(TEXT("true")) )
			{
				Token.SetConstBool(true);
				return true;
			}
			else if( Token.Matches(TEXT("false")) )
			{
				Token.SetConstBool(false);
				return true;
			}
		}

		return IsValid();
	}
	// if const values are allowed, determine whether the non-identifier token represents a const
	else if ( !bNoConsts && ((c>='0' && c<='9') || ((c=='+' || c=='-') && (p>='0' && p<='9'))) )
	{
		// Integer or floating point constant.
		bool  bIsFloat = 0;
		int32 Length   = 0;
		bool  bIsHex   = 0;
		do
		{
			if( c==TEXT('.') )
			{
				bIsFloat = true;
			}
			if( c==TEXT('X') || c == TEXT('x') )
			{
				bIsHex = true;
			}

			Token.Identifier[Length++] = c;
			if( Length >= NAME_SIZE )
			{
				Length = ((int32)NAME_SIZE) - 1;
				Token.Identifier[Length]=0; // need this for the error description

				FText ErrorDesc = FText::Format(LOCTEXT("IdTooLong", "Identifer ({0}...) exceeds maximum length of {1}"), FText::FromString(Token.Identifier), FText::AsNumber((int32)NAME_SIZE));
				SetError(FErrorState::ParseError, ErrorDesc);

				break;
			}
			c = FChar::ToUpper(GetChar());
		} while ((c >= TEXT('0') && c <= TEXT('9')) || (!bIsFloat && c == TEXT('.')) || (!bIsHex && c == TEXT('X')) || (bIsHex && c >= TEXT('A') && c <= TEXT('F')));

		Token.Identifier[Length]=0;
//.........这里部分代码省略.........
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:101,代码来源:BasicTokenParser.cpp


示例3: GetChar

	const Number FloatLiteralParser::Parse()
	{
		// Assert( NotAtEnd() && InClass(CharClass::NUMBER_HEAD) )

		char c = GetChar();

		NumberBuilder numberBuilder;

		if (c == '0')
		{
			Advance();
			if (AtEnd())
			{
				return Number::ZERO();
			}

			switch (GetChar())
			{
				case '.' : return ParseFractional(numberBuilder);
				case 'e' :
				case 'E' : return ParseExponent(numberBuilder);
				case 'b' : return config_.parse_binary ? ParseBinary() : Number::ZERO();
				case 'x' : return config_.parse_hexadecimal ? ParseHexadecimal() : Number::ZERO();
			}

			if (NotInClass(CharClass::DECIMAL))
			{
				return Number::ZERO();
			}

			if (config_.parse_octal)
			{
				return ParseOctal();
			}
		}
		else if (c == '-')
		{
			numberBuilder.SetNegative();
			Advance();
			if (AtEnd() || NotInClass(CharClass::DECIMAL))
			{
				ThrowError("Decimal digit expected");
			}
		}

		// Assert( NotAtEnd() && InClass(CharClass::DECIMAL) )
		do
		{
			numberBuilder.OnIntegerDigit(GetChar() - '0');

			Advance();
			if (AtEnd())
			{
				return numberBuilder.Release();
			}
		}
		while (InClass(CharClass::DECIMAL));

		if (GetChar() == '.')
		{
			return ParseFractional(numberBuilder);
		}
		else if (GetChar() == 'e' || GetChar() == 'E')
		{
			return ParseExponent(numberBuilder);
		}

		return numberBuilder.Release();
	}
开发者ID:haroldzmli,项目名称:cuboid,代码行数:69,代码来源:NumberLiteralParser.cpp


示例4: assert

void kGUIText::DrawSectionRot(int sstart,int slen,float x,float y,float angle,kGUIColor color,float alpha)
{
	kGUIFace *face=kGUIFont::GetFace(GetFontID());
	int glyph_index;
	int font_height,font_above,font_below;
	FT_Face ftface;
	int size;
	FT_Glyph   glyph2;
	FT_Matrix  matrix;
	FT_BitmapGlyph  bit;
	float dx,dy,adv;
	float advsin,advcos;
	float fax,fay;	/* rotated font above */
	unsigned int ch;	/* current character */
	unsigned int nb;	/* number of bytes for current character */

	ftface=face->GetFace();
	size=GetFontSize();
	if(!size)
		return;
	assert(size>0,"Cannot print size 0\n");

	font_height=face->GetPixHeight(size);
	font_above = face->GetPixAscHeight(size);
	font_below = face->GetPixDescHeight(size);
	kGUI::SelectFont(face,size);

	matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L );
	matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L );
	matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L );
	matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L );

	adv=0;
	advsin=sin(angle);
	advcos=cos(angle);
	fax=sin(angle-(2*PI)*0.025f)*font_above;
	fay=-(cos(angle-(2*PI)*0.025f)*font_above);

	/* todo, handle underline */

	while(slen>0)
	{
		ch=GetChar(sstart,&nb);
		if(!ch)
			return;
		sstart+=nb;
		slen-=nb;

		/* todo, handle tabs, handle encoding  */
		glyph_index = FT_Get_Char_Index( ftface, ch );
		if(glyph_index>0)
		{
			FT_Load_Glyph(ftface,glyph_index,FT_LOAD_DEFAULT);
			FT_Get_Glyph( ftface->glyph, &glyph2 );
			FT_Glyph_Transform( glyph2, &matrix, 0 );
			FT_Glyph_To_Bitmap( &glyph2, ft_render_mode_normal,0, 1);
			
			/* draw to screen using writepixel */
			bit = (FT_BitmapGlyph)glyph2;

			dx=x+((advcos*adv)+fax);
			dy=y-((advsin*adv)+fay);
			DrawChar( (char *)bit->bitmap.buffer,
						dx + bit->left,
						dy -bit->top,
						bit->bitmap.width, bit->bitmap.rows,
						color,alpha);

			adv+=ftface->glyph->advance.x/64.0f;
			adv+=m_letterspacing;
			FT_Done_Glyph(glyph2);
		}
	}
	if(m_underline)
		kGUI::DrawLine(x+fax,y-fay,x+((advcos*adv)+fax),y-((advsin*adv)+fay),color,alpha);
}
开发者ID:CarlHuff,项目名称:kgui,代码行数:76,代码来源:kguifontf.cpp


示例5: OnValReadStart

CFSVar CJSONReader::ReadVal(const CFSAString &szKeyPath)
{
	OnValReadStart(szKeyPath);
	CFSVar Data;

	if (m_cCh=='[') {
		Data.Cast(CFSVar::VAR_ARRAY);
		GetChar(true);
		INTPTR ipPos=0;
		for (;;) {
			if (m_cCh==0) {
				throw CJSONException(FSTSTR("Unexpetcted EOF"));
			} else if (m_cCh==']') {
				GetChar(true);
				break;
			} else if (ipPos>0) {
				if (m_cCh==',') {
					GetChar(true);
				} else {
					throw CJSONException(FSTSTR("Missing ',' in array"));
				}
			}

			CFSAString szKey;
			szKey.Format("%zd", ipPos);
			CFSVar Data1=ReadVal(szKeyPath+"/"+szKey);
			if (m_iCollectData>0) {
				Data[ipPos]=Data1;
			}
			ipPos++;
		}
	} else if (m_cCh=='{') {
		Data.Cast(CFSVar::VAR_MAP);
		GetChar(true);
		INTPTR ipPos=0;
		for (;;) {
			if (m_cCh==0) {
				throw CJSONException(FSTSTR("Unexpetcted EOF"));
			} else if (m_cCh=='}') {
				GetChar(true);
				break;
			} else if (ipPos>0) {
				if (m_cCh==',') {
					GetChar(true);
				} else {
					throw CJSONException(FSTSTR("Missing ',' in map"));
				}
			}

			CFSAString szKey;
			if (m_cCh=='\"' || m_cCh=='\'') {
				szKey=ReadString();
			} else if (FSIsLetter(m_cCh)) {
				szKey=ReadText();
			} else {
				throw CJSONException(FSTSTR("Expected key"));
			}
			if (m_cCh==':') {
				GetChar(true);
			} else {
				throw CJSONException(FSTSTR("Expected ':'"));
			}
			CFSVar Data1=ReadVal(szKeyPath+"/"+szKey);
			if (m_iCollectData>0) {
				Data[szKey]=Data1;
			}
			ipPos++;
		}
	} else if (m_cCh=='\"' || m_cCh=='\'') {
		Data=ReadString();
	} else if ((m_cCh>='0' && m_cCh<='9') || FSStrChr("-+.", m_cCh)) {
		Data=ReadNumber();
	} else if (FSIsLetter(m_cCh)) {
		Data=ReadConst();
	} else if (!m_cCh) {
	} else {
		throw CJSONException(FSTSTR("Unknown value type"));
	}

	OnValReadEnd(szKeyPath, Data);
	return Data;
}
开发者ID:urdvr,项目名称:vabamorf,代码行数:82,代码来源:json.cpp


示例6: tchar

inline CField::operator tchar() const
{
	return GetChar();
}
开发者ID:pyq881120,项目名称:MDBL,代码行数:4,代码来源:Field.hpp


示例7: TK_Device2PC

 void TK_Device2PC(void)
 {
    int count=0,i=0;
	uint16_t len=0;
	uint8_t test;		
	TK_CNANNEL_CONFIG tk_channel_config;
	TK_CNANNEL_CONFIG *tkchconfig;
	len=sizeof(TK_CNANNEL_CONFIG);	
	
	
	//get magic id
	i=0;
	count=0;
 	while(1)
	{	
		if(kbhit())	
		{		
			test=GetChar();
			if(test!=MagicId[i++])
			{										
				return;
			}
			if(i==sizeof(MagicId)) break;
		}
		else
		{			
			count++;			
		}
		if(count > DELAY_TIME_OUT) return;
	} 	
	
	i=0;
	count=0;
	while(i<2)
	{
	 	if(kbhit())	
		{
			((uint8_t *)&reclen)[i]=GetChar();
			i++;
		}


	}

	i=0;
	count=0;
	while(i<reclen)
	{
		 if(kbhit())	
		{
			ReceiveBuf[i]=GetChar();
			i++;
		}

	}

	SendChars(MagicIdR,sizeof(MagicIdR));

	count=0;
	switch(ReceiveBuf[0])
	{
		case OP_AUTO_CHANNEL_CONFIG:
		/*Send : MagicidR | len(16) | "START" | progess (5 time) |len<NEXT> (16) */
			len=5+sizeof(len);
				
			memcpy(SendBuf+count,&len,sizeof(len));
			count+=sizeof(len);
			memcpy(SendBuf+count,(uint8_t *)"START",5);
			count+=5;
			len=sizeof(TK_CNANNEL_CONFIG)+5 /*Used by Progress */;
			memcpy(SendBuf+count,&len,2);
			count+=sizeof(len);
			SendChars((uint8_t *)SendBuf,count);
												
			AutoChannelConfig(ReceiveBuf[1],&final_result);
			
			tk_channel_config.channel=ReceiveBuf[1];					
			tk_channel_config.base=final_result.base;
			tk_channel_config.diff=final_result.diff;
			tk_channel_config.current=final_result.current;
			tk_channel_config.div=final_result.div;	
							
			SendChars((uint8_t *)&tk_channel_config,sizeof(TK_CNANNEL_CONFIG));

		break;
		case OP_GET_CONFIG:				
			len=TK_CH_NUM*sizeof(TK_CNANNEL_CONFIG);			
			memcpy( SendBuf+count,(uint8_t *)&len,sizeof(len));		
		   	count+=sizeof(len);
			
			for(i=0;i<TK_CH_NUM;i++)			
			{			
				tk_channel_config.channel=i;					
				tk_channel_config.base=cfg[i].base;
				tk_channel_config.diff=cfg[i].diff;
				tk_channel_config.current=cfg[i].current;
				tk_channel_config.div=cfg[i].div;		
	
				memcpy(SendBuf+count,(uint8_t *)(&tk_channel_config),sizeof(TK_CNANNEL_CONFIG));
				count+=sizeof(TK_CNANNEL_CONFIG);
//.........这里部分代码省略.........
开发者ID:bimopraks,项目名称:tinythread,代码行数:101,代码来源:nano1xx_tk2pc.c


示例8: NotInClass

			bool NotInClass(const CharClass & charClass) const { return !charClass.Contains(GetChar()); }
开发者ID:haroldzmli,项目名称:cuboid,代码行数:1,代码来源:Parser.hpp


示例9: Set_Channel_Config

/*! \brief Extract the data packet from QTouch Studio and set channel config.
 * \note  Should only be called from the command handler.
 */
void Set_Channel_Config(void)
{
	touch_ret_t touch_ret = TOUCH_SUCCESS;

#if ((DEF_TOUCH_QDEBUG_ENABLE_QM == 1)      ||\
	(DEF_TOUCH_QDEBUG_ENABLE_QTA == 1) ||\
	(DEF_TOUCH_QDEBUG_ENABLE_QTB == 1))

	sensor_id_t sensor_id;
	uint8_t type_aks_pos_hyst;

#if (DEF_TOUCH_QDEBUG_ENABLE_QM == 1)
	touch_qm_param_t touch_sensor_param;
#endif

#if ((DEF_TOUCH_QDEBUG_ENABLE_QTA == 1) || (DEF_TOUCH_QDEBUG_ENABLE_QTB == 1))
	touch_qt_param_t touch_sensor_param;
#endif

	sensor_id = GetChar();

	/* Read back and initialize the touch_sensor_param structure.
	 * This is because not all the touch_sensor_param members are
	 * updated by this API. */
	touch_ret
		= QDEBUG_GET_SENSOR_CONFIG_FUNC(sensor_id,
			&touch_sensor_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

	/* Update the necessary members of the touch_sensor_param structure
	 * and write back. */
	touch_sensor_param.detect_threshold = GetChar();
	type_aks_pos_hyst = GetChar();
	touch_sensor_param.aks_group
		= (aks_group_t)((uint8_t)((type_aks_pos_hyst & 0x38u) >> 3u));
	touch_sensor_param.detect_hysteresis
		= (hysteresis_t)((uint8_t)(type_aks_pos_hyst & 0x03u));

	touch_ret
		= QDEBUG_UPDATE_SENSOR_CONFIG_FUNC(sensor_id,
			&touch_sensor_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

#endif

#if DEF_TOUCH_QDEBUG_ENABLE_AT == 1
	sensor_id_t sensor_id;
	touch_at_param_t touch_sensor_param;

	sensor_id = GetChar();  /* Dummy. To skip sensor_id. */
	UNUSED(sensor_id);  /* Dummy. To avoid warning. */

	/* Read back and initialize the touch_sensor_param structure.
	 * This is because not all the touch_sensor_param members are
	 * updated by this API. */
	touch_ret = QDEBUG_GET_SENSOR_CONFIG_FUNC(&touch_sensor_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

	/* Update the necessary members of the touch_sensor_param structure
	 * and write back. */
	touch_sensor_param.sense = GetChar();   /* Sense level (Detect
	                                         *Threshold). */

	touch_ret = QDEBUG_UPDATE_SENSOR_CONFIG_FUNC(&touch_sensor_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

#endif
}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:83,代码来源:QDebug_at32uc3l.c


示例10: AutoChannelConfig

void AutoChannelConfig(uint8_t ch,best_cfg* final_result)
{
	uint16_t div, i;
	uint16_t current = 1;
	S_TK_CH_CFG ch_cfg = {1, 0, 0xFFFF, 0x0000};
	uint8_t sen_level, sen_state,tmp_div;
	uint16_t sen_data;	
	int8_t tmp_score;
	uint8_t tmp_cur;
	uint8_t progress=0;

	final_result->current = 1;
	final_result->div = 0;
	final_result->base = 0;
	final_result->diff = 0;

	base_rank[0].val = 0xFFFF;							
	base_rank[0].div = 0;
	base_rank[0].current = 1;
	diff_rank[0].val = 0;
	diff_rank[0].div = 0;
	diff_rank[0].current = 1;
	
			progress=20;
			SendChars((uint8_t *)&progress,sizeof(progress));

			for(div = 1; div < 12; div++) {			
				for(current = 1; current <= 15; current++) {
					ch_cfg.u8Level = current;
					ch_cfg.u8Div = div;
					TK_ConfigChannel(ch, &ch_cfg);		
					result[div][current - 1].level_off = 0;	
					result[div][current - 1].data_off = 0;					
		
					for(i = 0; i < 2; i++) {
						complete = 0;
						TK_Start(1 << ch);
						while(complete != 1);
						TK_ReadStatus(&sen_level, &sen_state, NULL);
						sen_data = TK_ReadData(ch);
						if(sen_state != 0 || sen_data == 0 || sen_data == 0xFFFF) {
							result[div][current - 1].level_off = 0;	
							result[div][current - 1].data_off = 0;
							break;
						} else {
							result[div][current - 1].level_off += sen_level;
							result[div][current - 1].data_off += (sen_data >> 1);						
						}									
					}
					result[div][current - 1].level_off >>= 1;
				}
			}
			
			
			progress=40;
			SendChars((uint8_t *)&progress,sizeof(progress));
	
		 	while(1)
			{	
				if(kbhit())												
					if(GetChar()==progress)															
						break;				
			} 	

			for(div = 1; div < 12; div++) {				
				for(current = 1; current <= 15; current++) {
					ch_cfg.u8Level = current;
					ch_cfg.u8Div = div;
					TK_ConfigChannel(ch, &ch_cfg);
		
					result[div][current - 1].level_on = 0;	
					result[div][current - 1].data_on = 0;					
					if(result[div][current - 1].level_off == 0)
						continue;
					for(i = 0; i < 2; i++) {
						complete = 0;
						TK_Start(1 << ch);
						while(complete != 1);
						TK_ReadStatus(&sen_level, &sen_state, NULL);
						sen_data = TK_ReadData(ch);
						if(sen_state != 0 || sen_data == 0 || sen_data == 0xFFFF) {
							result[div][current - 1].level_on = 0;	
							result[div][current - 1].data_on = 0;
							break;
						} else {
							result[div][current - 1].level_on += sen_level;
							result[div][current - 1].data_on += (sen_data >> 1);
						
						}									
					}
					result[div][current - 1].level_on >>= 1;
				}
			}


			// calculate sense level, timer divider, and change current score
			for(div = 1; div < 12; div++) {
				for(current = 1; current <= 15; current++) {

					result[div][current - 1].score = 0;
//.........这里部分代码省略.........
开发者ID:bimopraks,项目名称:tinythread,代码行数:101,代码来源:nano1xx_tk2pc.c


示例11: Set_Global_Config

/*! \brief Extract the data packet from QTouch Studio and set global config.
 * \note  Should only be called from the command handler.
 */
void Set_Global_Config(void)
{
	touch_ret_t touch_ret = TOUCH_SUCCESS;

#if ((DEF_TOUCH_QDEBUG_ENABLE_QM == 1)      ||\
	(DEF_TOUCH_QDEBUG_ENABLE_QTA == 1) ||\
	(DEF_TOUCH_QDEBUG_ENABLE_QTB == 1))

	touch_global_param_t global_params;

	global_params.recal_threshold = (recal_threshold_t)GetChar();
	global_params.di = GetChar();
	global_params.drift_hold_time = GetChar();
	global_params.max_on_duration = GetChar();
	global_params.neg_drift_rate = GetChar();
	global_params.pos_drift_rate = GetChar();
	global_params.pos_recal_delay = GetChar();

	/* update the global parameter value inside the uc3l library */
	touch_ret = QDEBUG_UPDATE_GLOBAL_PARAM_FUNC(&global_params);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

#endif

#if DEF_TOUCH_QDEBUG_ENABLE_AT == 1
	touch_at_param_t touch_sensor_param;
	uint8_t dummy_var;

	/* Fill touch_sensor_param structure with default values.
	 * This is because QTouch Studio does not provide sense and outsense
	 * values.  So these values should not be overwritten by the update API.
	 * */
	touch_ret = QDEBUG_GET_GLOBAL_PARAM_FUNC(&touch_sensor_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

	/* Update data from QTouch Studio. */
	touch_sensor_param.pthr = (recal_threshold_t)GetChar();
	touch_sensor_param.filter = GetChar();
	dummy_var = GetChar();  /* Skip drift_hold_time. */
	dummy_var = GetChar();  /* Skip max_on_duration. */
	touch_sensor_param.ndrift = GetChar();
	touch_sensor_param.pdrift = GetChar();

	UNUSED(dummy_var);  /* Dummy. Avoid compiler warning. */

	/* update the global parameter value inside the uc3l library */
	touch_ret = QDEBUG_UPDATE_GLOBAL_PARAM_FUNC(&touch_sensor_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

#endif
}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:63,代码来源:QDebug_at32uc3l.c


示例12: AutoFlow_FunctionRxTest

/*---------------------------------------------------------------------------------------------------------*/
void AutoFlow_FunctionRxTest()
{
    uint32_t u32i;

    printf("\n");
    printf("+-----------------------------------------------------------+\n");
    printf("|     Pin Configure                                         |\n");
    printf("+-----------------------------------------------------------+\n");
    printf("|  ______                                            _____  |\n");
    printf("| |      |                                          |     | |\n");
    printf("| |Master|--UART1_TXD(PB.5)  <==>  UART1_RXD(PB.4)--|Slave| |\n");
    printf("| |      |--UART1_nCTS(PB.7) <==> UART1_nRTS(PB.6)--|     | |\n");
    printf("| |______|                                          |_____| |\n");
    printf("|                                                           |\n");
    printf("+-----------------------------------------------------------+\n");

    printf("\n");
    printf("+-----------------------------------------------------------+\n");
    printf("|       AutoFlow Function Test (Slave)                      |\n");
    printf("+-----------------------------------------------------------+\n");
    printf("|  Description :                                            |\n");
    printf("|    The sample code needs two boards. One is Master and    |\n");
    printf("|    the other is slave. Master will send 1k bytes data     |\n");
    printf("|    to slave.Slave will check if received data is correct  |\n");
    printf("|    after getting 1k bytes data.                           |\n");
    printf("|    Press any key to start...                              |\n");
    printf("+-----------------------------------------------------------+\n");
    GetChar();

    /* Enable RTS and CTS autoflow control */
    UART_EnableFlowCtrl(UART1);

    /* Set RTS Trigger Level as 8 bytes */
    UART1->FCR &= ~UART_FCR_RTS_TRI_LEV_Msk;
    UART1->FCR |= UART_FCR_RTS_TRI_LEV_8BYTES;

    /* Set RX Trigger Level as 8 bytes */
    UART1->FCR &= ~UART_FCR_RFITL_Msk;
    UART1->FCR |= UART_FCR_RFITL_8BYTES;

    /* Set Timeout time 0x3E bit-time and time-out counter enable */
    UART_SetTimeoutCnt(UART1, 0x3E);

    /* Enable RDA\RLS\RTO Interrupt  */
    UART_EnableInt(UART1, (UART_IER_RDA_IEN_Msk | UART_IER_RLS_IEN_Msk | UART_IER_TOUT_IEN_Msk));

    printf("\n Starting to receive data...\n");

    /* Wait for receive 1k bytes data */
    while(g_i32pointer < RXBUFSIZE);

    /* Compare Data */
    for(u32i = 0; u32i < RXBUFSIZE; u32i++) {
        if(g_u8RecData[u32i] != (u32i & 0xFF)) {
            printf("Compare Data Failed\n");
            while(1);
        }
    }
    printf("\n Receive OK & Check OK\n");

    /* Disable RDA\RLS\RTO Interrupt */
    UART_DisableInt(UART1, (UART_IER_RDA_IEN_Msk | UART_IER_RLS_IEN_Msk | UART_IER_TOUT_IEN_Msk));

}
开发者ID:OpenNuvoton,项目名称:NUC029xEE,代码行数:65,代码来源:main.c


示例13: while

bool wxSimpleHtmlParser::EatWhitespace()
{
    while (!Eof() && IsWhitespace(GetChar(m_pos)))
        m_pos ++;
    return TRUE;
}
开发者ID:0xCA5A,项目名称:dd-wrt,代码行数:6,代码来源:htmlparser.cpp


示例14: skapmot

int skapmot(void) {
    struct ShortUser *shortUser;
    int mad, setPermission, changed, ch, i, fidoDomainId, highestId;
    struct FidoDomain *fidoDomain;
    BPTR lock;
    struct User user;
    struct Mote tmpConf,*searchConf,*newConf;

    memset(&tmpConf, 0, sizeof(struct Mote));
    if(argument[0] == '\0') {
        SendString("\r\n\nNamn på mötet: ");
        if(GetString(40,NULL)) {
            return 1;
        }
        strcpy(tmpConf.namn, inmat);
    } else {
        strcpy(tmpConf.namn, argument);
    }
    if(parsemot(tmpConf.namn) != -1) {
        SendString("\r\n\nFinns redan ett sådant möte!\r\n");
        return 0;
    }
    tmpConf.skapat_tid = time(NULL);;
    tmpConf.skapat_av = inloggad;
    for(;;) {
        SendString("\r\nMötesAdministratör (MAD) : ");
        if(GetString(5,NULL)) {
            return 1;
        }
        if(inmat[0]) {
            if((mad = parsenamn(inmat)) == -1) {
                SendString("\r\nFinns ingen sådan användare!");
            } else {
                tmpConf.mad = mad;
                break;
            }
        }
    }
    SendString("\n\rSorteringsvärde: ");
    tmpConf.sortpri = GetNumber(0, LONG_MAX, NULL);

    if(EditBitFlagShort("\r\nSka mötet vara slutet?", 'j', 'n', "Slutet", "Öppet",
                        &tmpConf.status, SLUTET)) {
        return 1;
    }
    if(tmpConf.status & SLUTET) {
        SendString("\r\nVilka grupper ska ha tillgång till mötet? (? för lista)\r\n");
        if(editgrupp((char *)&tmpConf.grupper)) {
            return 1;
        }
    }
    if(EditBitFlagShort("\r\nSka mötet vara skrivskyddat?", 'j', 'n',
                        "Skyddat", "Oskyddat", &tmpConf.status, SKRIVSKYDD)) {
        return 1;
    }
    if(EditBitFlagShort("\r\nSka mötet vara kommentarsskyddat?", 'j', 'n',
                        "Skyddat", "Oskyddat", &tmpConf.status, KOMSKYDD)) {
        return 1;
    }
    if(EditBitFlagShort("\r\nSka mötet vara hemligt?", 'j', 'n',
                        "Hemligt", "Ej hemligt", &tmpConf.status, HEMLIGT)) {
        return 1;
    }
    if(!(tmpConf.status & SLUTET)) {
        if(EditBitFlagShort("\r\nSka alla användare bli medlemmar automagiskt?", 'j', 'n',
                            "Ja", "Nej", &tmpConf.status, AUTOMEDLEM)) {
            return 1;
        }
        if(EditBitFlagShort("\r\nSka rättigheterna styra skrivmöjlighet?", 'j', 'n',
                            "Ja", "Nej", &tmpConf.status, SKRIVSTYRT)) {
            return 1;
        }
        if(tmpConf.status & SKRIVSTYRT) {
            SendString("\r\nVilka grupper ska ha tillgång till mötet? (? för lista)\r\n");
            if(editgrupp((char *)&tmpConf.grupper)) {
                return 1;
            }
        }
    }
    if(EditBitFlagShort("\r\nSka mötet enbart kommas åt från ARexx?", 'j', 'n',
                        "Ja", "Nej", &tmpConf.status, SUPERHEMLIGT)) {
        return 1;
    }

    SendString("\n\n\rVilken typ av möte ska det vara?\n\r");
    SendString("1: Lokalt möte\n\r");
    SendString("2: Fido-möte\n\n\r");
    SendString("Val: ");
    for(;;) {
        ch = GetChar();
        if(ch == GETCHAR_LOGOUT) {
            return 1;
        }
        if(ch == '1' || ch == '2') {
            break;
        }
    }
    if(ch == '1') {
        SendString("Lokalt möte\n\n\r");
        tmpConf.type = MOTE_ORGINAL;
//.........这里部分代码省略.........
开发者ID:punktniklas,项目名称:NiKom,代码行数:101,代码来源:NiKFuncs.c


示例15: W

void MSA::ToAlnFile(TextFile &File) const
	{
	if (getMuscleContext()->params.g_bClwStrict)
		File.PutString("CLUSTAL W (1.81) multiple sequence alignment\n");
	else
		{
		File.PutString("MUSCLE ("
		  MUSCLE_MAJOR_VERSION "." MUSCLE_MINOR_VERSION ")"
		  " multiple sequence alignment\n");
		File.PutString("\n");
		}

	int iLongestNameLength = 0;
	for (unsigned uSeqIndex = 0; uSeqIndex < GetSeqCount(); ++uSeqIndex)
		{
		const char *ptrName = GetSeqName(uSeqIndex);
		const char *ptrBlank = strchr(ptrName, ' ');
		int iLength;
		if (0 != ptrBlank)
			iLength = (int) (ptrBlank - ptrName);
		else
			iLength = (int) strlen(ptrName);
		if (iLength > iLongestNameLength)
			iLongestNameLength = iLength;
		}
	if (iLongestNameLength > MAX_NAME)
		iLongestNameLength = MAX_NAME;
	if (iLongestNameLength < MIN_NAME)
		iLongestNameLength = MIN_NAME;

	unsigned uLineCount = (GetColCount() - 1)/uCharsPerLine + 1;
	for (unsigned uLineIndex = 0; uLineIndex < uLineCount; ++uLineIndex)
		{
		File.PutString("\n");
		unsigned uStartColIndex = uLineIndex*uCharsPerLine;
		unsigned uEndColIndex = uStartColIndex + uCharsPerLine - 1;
		if (uEndColIndex >= GetColCount())
			uEndColIndex = GetColCount() - 1;
		char Name[MAX_NAME+1];
		for (unsigned uSeqIndex = 0; uSeqIndex < GetSeqCount(); ++uSeqIndex)
			{
			const char *ptrName = GetSeqName(uSeqIndex);
			const char *ptrBlank = strchr(ptrName, ' ');
			int iLength;
			if (0 != ptrBlank)
				iLength = (int) (ptrBlank - ptrName);
			else
				iLength = (int) strlen(ptrName);
			if (iLength > MAX_NAME)
				iLength = MAX_NAME;
			memset(Name, ' ', MAX_NAME);
			memcpy(Name, ptrName, iLength);
			Name[iLongestNameLength] = 0;

			File.PutFormat("%s      ", Name);
			for (unsigned uColIndex = uStartColIndex; uColIndex <= uEndColIndex;
			  ++uColIndex)
				{
				const char c = GetChar(uSeqIndex, uColIndex);
				File.PutFormat("%c", toupper(c));
				}
			File.PutString("\n");
			}

		memset(Name, ' ', MAX_NAME);
		Name[iLongestNameLength] = 0;
		File.PutFormat("%s      ", Name);
		for (unsigned uColIndex = uStartColIndex; uColIndex <= uEndColIndex;
		  ++uColIndex)
			{
			const char c = GetAlnConsensusChar(*this, uColIndex);
			File.PutChar(c);
			}
		File.PutString("\n");
		}
	}
开发者ID:ggrekhov,项目名称:ugene,代码行数:76,代码来源:aln.cpp


示例16: return

bool wxSimpleHtmlParser::IsString()
{
    return (GetChar(m_pos) == (int) '"') ;
}
开发者ID:0xCA5A,项目名称:dd-wrt,代码行数:4,代码来源:htmlparser.cpp


示例17: return

inline bool CField::operator!=(tchar cValue) const
{
	return (cValue != GetChar());
}
开发者ID:pyq881120,项目名称:MDBL,代码行数:4,代码来源:Field.hpp


示例18: GetLine

void GetLine( char * buffer, const unsigned int size, int EchoFlag )
{
	char		ch = 0 ;
	int		c;
	char*		p = buffer ;
	unsigned int	n = 0L ;
	int		i ;

	while( n < size )
	{
		c = GetChar() ;
		if( c == -1 )
		{
		    continue;
		}
		ch = c;
		//dprintf("%x ",ch);
		if( ch == KEYCODE_LF )
		{
		    #ifdef USE_LF
		    *--p = 0 ;
		    n-- ;
		    #endif // USE_LF
		    break ;
		}
		else if( ch == KEYCODE_CR )
		{
		    *p = 0 ;
#ifndef CONFIG_HISTORY_KEYIN
		    n-- ;
#else //#ifdef CONFIG_HISTORY_KEYIN
		if(n!=0)
		{
			strcpy(history_cmd[hist_save_idx], buffer);
			(hist_save_idx >= HISTORY_CMD_ELN-1) ? hist_save_idx=0 : hist_save_idx++;
			hist_see_idx=hist_save_idx;
		}

#endif
		    break ;
		}
		else if( ch == KEYCODE_BS_7F )
		{
		    if( p != buffer )
		    {
			    p-- ;
			    n-- ;
							if(EchoFlag)
							{
								PutChar(KEYCODE_BS);
								PutChar(' ');
								PutChar(KEYCODE_BS);
							}
		    }
		}
		else if( ch == KEYCODE_TAB )
		{
		    for( i=0 ; i < TAB ; i++ )
		    {
			    *p++ = ' ' ;
			    n++ ;
							if(EchoFlag) PutChar(' ');
		    }
		}
#ifdef CONFIG_HISTORY_KEYIN
		else if( ch == KEYCODE_ESC )
		{				
			if( GetChar()!= KEYCODE_BRACKET)		continue;
			
			c=GetChar();
			
			unsigned int  vk= ( KEYCODE_ESC <<24) | (KEYCODE_BRACKET<<16) | (c<<8) | 0 ;
			
			if( vk==KEYCODE_VKUP)
			{				
				(hist_see_idx==0) ? hist_see_idx= HISTORY_CMD_ELN-1 : hist_see_idx--;
			}
			else if(vk== KEYCODE_VKDOWN) 
			{
				(hist_see_idx==HISTORY_CMD_ELN-1) ? hist_see_idx= 0 : hist_see_idx++;
					
			}
			else 
				continue;

			//clear
			for(i=0;i<n;i++)
			{
				PutChar(KEYCODE_BS);
				PutChar(' ');
				PutChar(KEYCODE_BS);
			}
			strcpy(buffer, history_cmd[hist_see_idx]);
			n= strlen(buffer);
			p=buffer+n;
			dprintf("%s", buffer);
			
		}
#endif
		else
//.........这里部分代码省略.........
开发者ID:froggatt,项目名称:edimax-br-6528n,代码行数:101,代码来源:ctool.c


示例19: DecodeISO2022

public void DecodeISO2022( state_t *state, byte codingSystem )
{
  int region;
  byte charset, ch, rch;
  byte c[ ICHAR_WIDTH ];

  for( ; ; ){
    GetChar( ch );
    if( ch < SP ){
      if( ESC == ch ){
	if( FALSE == DecodeEscape( state ) )
	  break;
      } else if( HT == ch )
	DecodeAddTab( state->attr );
      else if( SO == ch )	/* LS1 for 8bit */
	state->gset[ GL ] = G1;
      else if( SI == ch )	/* LS0 for 8bit */
	state->gset[ GL ] = G0;
      else if( BS == ch )
	DecodeAddBs();
      else if( EM == ch )
	state->sset = G2;
      else
	DecodeAddControl( ch );
    } else {
      if( '~' == ch && TRUE == hz_detection ){
	switch( STR[ SIDX ] ){
	case '~':
	  if( ASCII == state->cset[ G0 ] )
	    IncStringIndex();
	  break;	/* break for '~' itself.*/
	case '{':
	  if( ASCII == state->cset[ G0 ] ){
	    IncStringIndex();
	    state->cset[ G0 ] = GB2312;
	    continue;
	  }
	  break;
	case '}':
	  if( GB2312 == state->cset[ G0 ] ){
	    IncStringIndex();
	    state->cset[ G0 ] = ASCII;
	    continue;
	  }
	  break;
	}
      }
      rch = ch;
      if( 0 != state->sset ){
	/*
	 * single shifted character
	 */
	if( EUC_TAIWAN == codingSystem && G2 == state->sset ){
	  charset = CNS_1 + ( ch - 0xa1 );
	  if( charset < CNS_1 || charset > CNS_7 ){
	    state->sset = 0;
	    continue;
	  }
	  GetChar( ch );
	} else {
	  charset = SSET;
	}
	state->sset = 0;
	ch &= 0x7f;	/* for EUC */
	if( !IsGraphicChar( charset, ch ) ){
	  if( SP == ch ){
	    DecodeAddSpace( state->attr );
	  } else {
	    DecodeAddControl( rch );
	  }
	  continue;
	}
	c[ 0 ] = ch;
	if( TRUE == iTable[ (int)charset ].multi ){
	  GetChar( ch );
	  if( !IsGraphicChar( charset, ch & 0x7f ) ){
	    DecodeAddControl( rch );
	    DecodeAddControl( ch );
	    continue;
	  }
	  c[ 1 ] = ch & 0x7f;	/* for EUC */
	}
      } else {
	if( 0x80 & ch ){
	  if( SS2 == ch ){
	    state->sset = G2;
	    continue;
	  } else if( SS3 == ch ){
	    state->sset = G3;
	    continue;
	  }
	  region = GR;
	  ch &= 0x7f;
	} else {
	  region = GL;
	}
	charset = CSET( region );
	if( !IsGraphicChar( charset, ch ) ){
	  if( SP == ch ){
	    DecodeAddSpace( state->attr );
//.........这里部分代码省略.........
开发者ID:amuramatsu,项目名称:lv-mod,代码行数:101,代码来源:iso2022.c


示例20: GetChar

void CObjectIStreamAsn::ReadAnyContent(string& value)
{
    char buf[128];
    size_t pos=0;
    const size_t maxpos=128;

    char to = GetChar(true);
    buf[pos++] = to;
    if (to == '{') {
        to = '}';
    } else if (to == '\"') {
    } else {
        to = '\0';
    }

    bool space = false;
    for (char c = m_Input.PeekChar(); ; c = m_Input.PeekChar()) {
        if (to != '\"') {
            if (to != '}' && c == '\n') {
                value.append(buf,pos);
                return;
            }
            if (isspace((unsigned char) c)) {
                if (space) {
                    m_Input.SkipChar();
                    continue;
                }
                c = ' ';
                space = true;
            } else {
                space = false;;
            }
            if (to != '}' && (c == ',' || c == '}')) {
                value.append(buf,pos);
                return;
            } else if (c == '\"' || c == '{') {
                value.append(buf,pos);
                ReadAnyContent(value);
                pos = 0;
                continue;
            }
        }
        if (c == to) {
            if (pos >= maxpos) {
                value.append(buf,pos);
                pos = 0;
            }
            buf[pos++] = c;
            value.append(buf,pos);
            m_Input.SkipChar();
            return;
        }
        if (c == '\"' || c == '{') {
            value.append(buf,pos);
            ReadAnyContent(value);
            pos = 0;
            continue;
        }
        if (pos >= maxpos) {
            value.append(buf,pos);
            pos = 0;
        }
        buf[pos++] = c;
        m_Input.SkipChar();
    }
}
开发者ID:swuecho,项目名称:igblast,代码行数:66,代码来源:objistrasn.cpp



注:本文中的GetChar函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetCharHeight函数代码示例发布时间:2022-05-30
下一篇:
C++ GetChanceAgainst函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap