void getSerialData(void){
	if( serial_get_qstate() > 0 ){
		printf("serialReceiveCommand\r\n" );
		unsigned char ReceivedData = getchar();
		if(ReceivedData == 'u'){
			printf("%d\r\n", Value);
			Value++;
		}else if(ReceivedData == 'd'){
			printf("%d\r\n", Value);
			Value--;
		}else if(ReceivedData == 10 || ReceivedData == 13 ){
			printf("%s\r\n", "end");abcd
			isFinish = 1;
		}
	}
}
Beispiel #2
0
int checkSerialRead(void){
	int ret = 0;
	if( serial_get_qstate() > 0 ){
		unsigned char ReceivedData = getchar();
		if( ReceivedData == 10 || ReceivedData == 13 ){
			if( buffCnt > 0 ){
				buffCnt = 0;
				isRead = 1;
				ret = 1;
			}
		}else if( ReceivedData > 0 ){
			readBuffer[buffCnt++] = ReceivedData;
			if( buffCnt >= SERIAL_BUFFER_SIZE-1 ){
				buffCnt = 0;
				isRead = 1;
				ret = 1;
			}
		}
		LOG_INFO( "readBuffer %s\n", &readBuffer[0] );
	}
	return ret;
}