コード例 #1
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void SERVO(void)
{
	TransmitData("****Steering Servo Test****\n\r");
	EMIOS_0.CH[4].CBDR.R = 1500;      	/* 1500 Middle */
	TransmitData("Middle\n\r");
	Delaywait();
	EMIOS_0.CH[4].CBDR.R = 1750;        /* 1750 Right Max,*/
	TransmitData("Right\n\r");
	Delaywait();
	EMIOS_0.CH[4].CBDR.R = 1250;        /* 1250 Left Max*/
	TransmitData("Left\n\r");
	Delaywait();
	EMIOS_0.CH[4].CBDR.R = 1500;      	/* 1500 Middle */
}
コード例 #2
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void CAMERA2(void)
{
	TransmitData("****Line Sensor Test 2****\n\r");
		SIU.PCR[27].R = 0x0200;				/* Program the Sensor read start pin as output*/
		SIU.PCR[29].R = 0x0200;				/* Program the Sensor Clock pin as output*/
		SIU.PGPDO[0].R &= ~0x00000014;		/* All port line low */
		SIU.PGPDO[0].R |= 0x00000010;		/* Sensor read start High */
		Delay();
		SIU.PGPDO[0].R |= 0x00000004;		/* Sensor Clock High */
		Delay();
		SIU.PGPDO[0].R &= ~0x00000010;		/* Sensor read start Low */ 
		Delay();
		SIU.PGPDO[0].R &= ~0x00000004;		/* Sensor Clock Low */
		Delay();
		for (i=0;i<128;i++)
		{
			Delay();
			SIU.PGPDO[0].R |= 0x00000004;	/* Sensor Clock High */
			ADC.MCR.B.NSTART=1;     		/* Trigger normal conversions for ADC0 */
			while (ADC.MCR.B.NSTART == 1) {};
			adcdata = ADC.CDR[0].B.CDATA;
			Delay();
			SIU.PGPDO[0].R &= ~0x00000004;	/* Sensor Clock Low */
			Result[i] = (uint8_t)(adcdata >> 2);		
		}
//		Delaycamera();
		//printlistall();
//	}
	printlistall();
}
コード例 #3
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void MOTOR_LEFT(void)
{
	TransmitData("****Left Drive Motor Test****\n\r");
	SIU.PCR[16].R = 0x0200;				/* Program the drive enable pin of Left Motor as output*/
	SIU.PGPDO[0].R = 0x00008000;		/* Enable Left the motors */
	Delaywait();
	SIU.PGPDO[0].R = 0x00000000;		/* Disable Left the motors */
}
コード例 #4
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void MOTOR_RIGHT(void)
{
	TransmitData("****Right Drive Motor Test****\n\r");
	SIU.PCR[17].R = 0x0200;				/* Program the drive enable pin of Right Motor as output*/
	SIU.PGPDO[0].R = 0x00004000;		/* Enable Right the motors */
	Delaywait();
	SIU.PGPDO[0].R = 0x00000000;		/* Disable Right the motors */
}
コード例 #5
0
ファイル: protfword_demo.c プロジェクト: GeeksRoad/MyProxy
DWORD WINAPI PortTransfer_3(LPVOID lParam)
{
 SOCKINFO socks;
 TransferParam<SOCKET, SOCKET> *ConfigInfo = (TransferParam<SOCKET, SOCKET>*)lParam;
 socks.ClientSock = ConfigInfo->LocalData.Pop();
 socks.ServerSock = ConfigInfo->GlobalData;
 //进入纯数据转发状态
 return TransmitData((LPVOID)&socks);
}
コード例 #6
0
ファイル: distanceSensor.c プロジェクト: cmh6188/workspace
int isObjectDetected(void){
	
	int reDist;
	volatile int i;
#ifdef	DISTANCE_DEBUG
	char buf[7];
#endif
	//get distance : AEB	
	distance[0]=sonarGetDistance();
	
#ifdef USE_PIR_SENSOR
	for(i=1;i<3;i++){
		distance[i] = getDistance(i-1);	
	}
#endif
#ifdef	DISTANCE_DEBUG
	for(i=0;i<3;i++){
		intToChar(distance[i],7,buf);
		TransmitData(buf);
		TransmitData("-");
	}
	TransmitData("\r\n");
#endif
		
	if(distance[0]<160){
		reDist = distance[0];
	}else{
		reDist=OBJECT_NOT_DETECTED;
		
#ifdef USE_PIR_SENSOR
		if((distance[1]<65)){
			reDist = distance[1];
		}else{
			if(distance[2]<65){
				reDist = distance[2];
			}else{
				reDist=OBJECT_NOT_DETECTED;	
			}
		}
#endif		
	}
	return reDist;
}
コード例 #7
0
NS_IMETHODIMP
nsPipeFilterListener::EndRequest(nsIRequest* aRequest, nsISupports* aContext)
{
  nsresult rv;
  DEBUG_LOG(("nsPipeFilterListener::EndRequest:(%p)\n", this));

  mRequestEnded = PR_TRUE;

  if (mListener) {
    if (!mRequestStarted) {
      mRequestStarted = PR_TRUE;

      rv = mListener->OnStartRequest(aRequest,
                                     mContext ? mContext.get() : aContext);
      NS_ENSURE_SUCCESS(rv, rv);

      if (mKeepDelimiters && !mStartLine.IsEmpty()) {
        rv = TransmitData(mStartLine.get(), mStartLine.Length(),
                          mListener, aRequest, aContext);
        NS_ENSURE_SUCCESS(rv, rv);
      }
    }

    if (!mPartMatch.IsEmpty()) {
      // Transmit any partially matched line
      DEBUG_LOG(("nsPipeFilterListener::EndRequest: PARTIALLY MATCHED LINE '%s'\n", mPartMatch.get()));
      rv = TransmitData(mPartMatch.get(), mPartMatch.Length(),
                        mListener, aRequest, aContext);
      NS_ENSURE_SUCCESS(rv, rv);

      mPartMatch = "";
    }

    if (mKeepDelimiters && !mEndLine.IsEmpty()) {
      rv = TransmitData(mEndLine.get(), mEndLine.Length(),
                        mListener, aRequest, aContext);
      NS_ENSURE_SUCCESS(rv, rv);
    }
  }

  return NS_OK;
}
コード例 #8
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void LED(void)
{
	SIU.PCR[68].R = 0x0200;				/* Program the drive enable pin of LED1 (PE4) as output*/
	SIU.PCR[69].R = 0x0200;				/* Program the drive enable pin of LED2 (PE5) as output*/
	SIU.PCR[70].R = 0x0200;				/* Program the drive enable pin of LED3 (PE6) as output*/
	SIU.PCR[71].R = 0x0200;				/* Program the drive enable pin of LED4 (PE7) as output*/
	TransmitData("****Led Test****\n\r");
	TransmitData("All Led ON\n\r");
	Delayled();
	SIU.PGPDO[2].R |= 0x0f000000;		/* Disable LEDs*/
	SIU.PGPDO[2].R &= 0x07000000;		/* Enable LED1*/
	TransmitData("Led 1 ON\n\r");
	Delayled();
	SIU.PGPDO[2].R |= 0x08000000;		/* Disable LED1*/
	SIU.PGPDO[2].R &= 0x0b000000;		/* Enable LED2*/
	TransmitData("Led 2 ON\n\r");
	Delayled();
	SIU.PGPDO[2].R |= 0x04000000;		/* Disable LED2*/
	SIU.PGPDO[2].R &= 0x0d000000;		/* Enable LED3*/
	TransmitData("Led 3 ON\n\r");
	Delayled();
	SIU.PGPDO[2].R |= 0x02000000;		/* Disable LED3*/
	SIU.PGPDO[2].R &= 0x0e000000;		/* Enable LED4*/
	TransmitData("Led 4 ON\n\r");
	Delayled();
	SIU.PGPDO[2].R |= 0x01000000;		/* Disable LED4*/
}
コード例 #9
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void LEFT_MOTOR_CURRENT(void)
{
	TransmitData("****Left Motor Current****\n\r");
	SIU.PGPDO[0].R = 0x00008000;			/* Enable Right the motors */
	Delaywait();
	for (i=0;i <10;i++)
	{
		ADC.MCR.B.NSTART=1;     			/* Trigger normal conversions for ADC0 */
		while (ADC.MSR.B.NSTART == 1) {};
		curdata = ADC.CDR[1].B.CDATA;
		printserialsingned(curdata);		
	}
	SIU.PGPDO[0].R = 0x00000000;		/* Disable Right the motors */
}
コード例 #10
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void SWITCH(void)
{
	SIU.PCR[64].R = 0x0100;				/* Program the drive enable pin of S1 (PE0) as input*/
	SIU.PCR[65].R = 0x0100;				/* Program the drive enable pin of S2 (PE1) as input*/
	SIU.PCR[66].R = 0x0100;				/* Program the drive enable pin of S3 (PE2) as input*/
	SIU.PCR[67].R = 0x0100;				/* Program the drive enable pin of S4 (PE3) as input*/
	TransmitData("****Switch Test****\n\r");
	TransmitData("Press S1 Switch\n\r");
	while((SIU.PGPDI[2].R & 0x80000000) == 0x80000000); /*Wait until S1 switch is pressed*/
	TransmitData("Switch S1 Pressed \n\r");
	TransmitData("Press S2 Switch\n\r");
	while((SIU.PGPDI[2].R & 0x40000000) == 0x40000000); /*Wait until S2 switch is pressed*/
	TransmitData("Switch S2 Pressed \n\r");
	TransmitData("Press S3 Switch\n\r");
	while((SIU.PGPDI[2].R & 0x20000000) == 0x20000000); /*Wait until S3 switch is pressed*/
	TransmitData("Switch S3 Pressed \n\r");
		TransmitData("Press S4 Switch\n\r");
	while((SIU.PGPDI[2].R & 0x10000000) == 0x10000000); /*Wait until S4 switch is pressed*/
	TransmitData("Switch S4 Pressed \n\r");
}
コード例 #11
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void printlistall(void) {
   TransmitCharacter(0x0a);   
   TransmitCharacter(0x0d);  
   for(pt=0;pt<120;pt++){
      //pt++;
      //pt++;
      printserialhex(Result[pt]);
	TransmitData(" ");

      
      //printserial(list[pt]);
   }
   TransmitCharacter(0x0a);   
   TransmitCharacter(0x0d);   
}
コード例 #12
0
ファイル: protfword_demo.c プロジェクト: GeeksRoad/MyProxy
DWORD WINAPI PortTransfer_2(LPVOID lParam)
{
 TransferParam<ADDRESS, SOCKET> *ConfigInfo = (TransferParam<ADDRESS, SOCKET> *)lParam;
 SOCKET ClientSocket, ServerSocket;
 SOCKINFO socks;
 ClientSocket = ConfigInfo->LocalData.Pop();
 printf("ThreadID: %d ==> Connect to Server...", nTimes);
 //连接到目标计算机的服务
 ServerSocket = ConnectHost(ConfigInfo->GlobalData.szIP, ConfigInfo->GlobalData.wPort);
 if(ServerSocket <= 0)
 {
  printf("Error.\r\n");
  closesocket(ClientSocket);
  return 0;
 }
 printf("OK.\r\nStarting TransmitData\r\n", nTimes);
 socks.ClientSock = ClientSocket;//公网计算机的套接字
 socks.ServerSock = ServerSocket;//目标计算机服务的套接字
 //进入纯数据转发状态
 return TransmitData((LPVOID)&socks);
}
コード例 #13
0
tResult cUSSSensorBundle::ProcessData(IMediaSample* pMediaSample)
{
    RETURN_IF_POINTER_NULL(pMediaSample);
    if (pMediaSample != NULL && m_pCoderDescInput != NULL)
    {
        
        //write values with zero
        tUInt16 front_Left = 0;
        tUInt16 front_Right = 0;
        tUInt16 rear_Left = 0;
        tUInt16 rear_Right = 0;  
        tUInt32 timestampValue = 0;          
        
        //get values from media sample
        {   // focus for sample read lock
            // read-out the incoming Media Sample
            __adtf_sample_read_lock_mediadescription(m_pCoderDescInput,pMediaSample,pCoder);
        
            pCoder->Get("ui16Front_Left", (tVoid*)&front_Left);
            pCoder->Get("ui16Front_Right", (tVoid*)&front_Right);
            pCoder->Get("ui16Rear_Left", (tVoid*)&rear_Left);
            pCoder->Get("ui16Rear_Right", (tVoid*)&rear_Right);          
            pCoder->Get("ui32ArduinoTimestamp", (tVoid*)&timestampValue);    
        }     

        //create and transmit output mediasamples
        tFloat32 flFront_Left = tFloat32(front_Left);
        tFloat32 flFront_Right = tFloat32(front_Right);
        tFloat32 flRear_Left = tFloat32(rear_Left);
        tFloat32 flRear_Right= tFloat32(rear_Right); 
        
        TransmitData(pMediaSample->GetTime(),flFront_Left,flFront_Right,flRear_Left,flRear_Right,timestampValue);       
    }
        
    RETURN_NOERROR;  
}
コード例 #14
0
ファイル: main.c プロジェクト: gursimar/freescaleCup
void main (void) {
	volatile uint32_t i = 0; 			/* Dummy idle counter */
	uint8_t option;
	
	initModesAndClock(); 				/* Initialize mode entries and system clock */
	initPeriClkGen();  					/* Initialize peripheral clock generation for DSPIs */
	disableWatchdog(); 					/* Disable watchdog */
	
    initPads();             			/* Initialize pads used in example */
  	initADC();              			/* Init. ADC for normal conversions but don't start yet*/
  	initCTU();              			/* Configure desired CTU event(s) */
  	initEMIOS_0();          			/* Initialize eMIOS channels as counter, SAIC, OPWM */
  	initEMIOS_0ch3();					/* Initialize eMIOS 0 channel 3 as OPWM and channel 2 as SAIC*/ 
  	
  	initEMIOS_0ch0(); 					/* Initialize eMIOS 0 channel 0 as modulus counter*/
	initEMIOS_0ch23(); 					/* Initialize eMIOS 0 channel 23 as modulus counter*/
	initEMIOS_0ch4(); 					/* Initialize eMIOS 0 channel 0 as OPWM, ch 4 as time base */
	initEMIOS_0ch6(); 					/* Initialize eMIOS 0 channel 0 as OPWM, ch 6 as time base */
	initEMIOS_0ch7(); 					/* Initialize eMIOS 0 channel 1 as OPWM, ch 7 as time base */
	
	init_LinFLEX_0_UART();
	
	SIU.PCR[17].R = 0x0200;				/* Program the drive enable pin of Right Motor as output*/
	SIU.PCR[16].R = 0x0200;				/* Program the drive enable pin of Left Motor as output*/
	SIU.PGPDO[0].R = 0x00000000;		/* Disable the motors */
	
	/* Loop forever */
	for (;;) 
	{
	
		TransmitData("\n\r**The Freescale Cup**");
		TransmitData("\n\r*********************");
		TransmitData("\n\r1.Led\n\r");
		TransmitData("2.Switch\n\r");
		TransmitData("3.Servo\n\r");
		TransmitData("4.Motor Left\n\r");
		TransmitData("5.Motor Right\n\r");
		TransmitData("6.Camera\n\r");
		TransmitData("9.Camera 2");
		TransmitData("7.Left Motor Current\n\r");
		TransmitData("8.Right Motor Current");
		TransmitData("\n\r**********************");
		
		option = ReadData();
		
		switch(option)
		{
			case '1':
				LED();
			break;
			case '2':
				SWITCH();
			break;
			case '3':
				SERVO();
			break;
			case '4':
				MOTOR_LEFT();
			break;
			case '5':
				MOTOR_RIGHT();
			break;
			case '6':
				CAMERA();
			break;
			case '7':
				LEFT_MOTOR_CURRENT();
			break;
			case '8':
				RIGHT_MOTOR_CURRENT();
			break;
			case '9':
				CAMERA2();
			break;
			default:
			break;
		}
	}
}
コード例 #15
0
NS_IMETHODIMP
nsPipeFilterListener::Write(const char* buf, PRUint32 count,
                            nsIRequest* aRequest, nsISupports* aContext)
{
  nsresult rv;

  DEBUG_LOG(("nsPipeFilterListener::Write: (%p) %d\n", this, count));

  if (count <= 0)
    return NS_OK;

  PRInt32 consumed;
  if (mStart.matchCount <= mStart.skipCount) {
    consumed = MatchDelimiter(buf, count, mStart, mStartDelimiter, mStartLine);
    if (consumed < 0)
      return NS_ERROR_FAILURE;
    buf += consumed;
    count -= consumed;
  }

  if (!mRequestStarted && (mStart.matchCount > mStart.skipCount)) {
    mRequestStarted = PR_TRUE;
    DEBUG_LOG(("nsPipeFilterListener::Write: RequestStarted\n", count));

    if (mListener) {
      rv = mListener->OnStartRequest(aRequest,
                                     mContext ? mContext.get() : aContext);

      NS_ENSURE_SUCCESS(rv, rv);

      if (mKeepDelimiters && !mStartLine.IsEmpty()) {
        rv = TransmitData(mStartLine.get(), mStartLine.Length(),
                          mListener, aRequest, aContext);
        NS_ENSURE_SUCCESS(rv, rv);
      }
    }
  }

  DEBUG_LOG(("nsPipeFilterListener::Write: after start, count %d\n", count));

  if (count <= 0)
    return NS_OK;

  if (mEndDelimiter.IsEmpty()) {
    return TransmitData(buf, count, mListener, aRequest, aContext);
  }

  if (mEnd.matchCount > mEnd.skipCount) {
    // End delimiter match complete

    if (mTailListener) {
      DEBUG_LOG(("nsPipeFilterListener::Write: TAIL count %d\n", count));
      rv = TransmitData(buf, count, mTailListener, aRequest, aContext);
      NS_ENSURE_SUCCESS(rv, rv);
    }

    return NS_OK;
  }

  mLastMatch = PR_TRUE;
  mSavePartMatch = PR_TRUE;
  PRUint32 savedPartMatchLen = mPartMatch.Length();

  consumed = MatchDelimiter(buf, count, mEnd, mEndDelimiter, mEndLine);
  if (consumed < 0)
    return NS_ERROR_FAILURE;

  if (!mSavePartMatch && savedPartMatchLen &&
      (mOldPartMatch.Length() >= savedPartMatchLen)) {

    rv = TransmitData(mOldPartMatch.get(), savedPartMatchLen,
                      mListener, aRequest, aContext);
    NS_ENSURE_SUCCESS(rv, rv);

    mOldPartMatch = "";
  }

  PRInt32 transCount = consumed - mPartMatch.Length() - mEndLine.Length();

  if (transCount > 0) {
    rv = TransmitData(buf, transCount, mListener, aRequest, aContext);
    NS_ENSURE_SUCCESS(rv, rv);
  }

  if (mTailListener && (mEnd.matchCount > mEnd.skipCount)) {
    // End delimiter match complete
    mTailRequestStarted = PR_TRUE;
    rv = mTailListener->OnStartRequest(aRequest,
                                       mContext ? mContext.get() : aContext);
    NS_ENSURE_SUCCESS(rv, rv);

    buf   += consumed;
    count -= consumed;
    if (count > 0) {
      DEBUG_LOG(("nsPipeFilterListener::Write: TAIL START count %d\n", count));
      rv = TransmitData(buf, count, mTailListener, aRequest, aContext);
      NS_ENSURE_SUCCESS(rv, rv);
    }
  }

  return NS_OK;
}
コード例 #16
0
/** 
 Handle Asynchronous Requests. This is called from Request() to process
 asynchrounous requests. It is responsible for setting up the hardware to create
 an event that will complete the request at some point in future. Multiple 
 outstanding asynchronous requests can be handled and is implementation specific.
 
 @param 	aReqNo
 		  	Asynchronous Request number
 @param 	aStatus
 			TRequestStatus (32-bit length) object allocated on user stack. This
 			provides the request status to the client
 @param 	a1
 			parameter1 passed by user for the request
 @param 	a2
 			parameter2 passed by user for the request	
 @return	KErrNone or standard error code
 */	
TInt DExDriverLogicalChannel::DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2)
	{
	TInt r=KErrNone;
	
	KEXDEBUG(Kern::Printf("++DExDriverLogicalChannel::DoRequest"));
	
	switch(aReqNo)
		{
		// User request to transmit data to the device (uart)		
		//	
		case RExDriverChannel::ERequestTransmitData:				
			// Check if there is another Tx request pending and we received
			// another Tx request, then reject the request and return busy.
			//
			if (iTxDataStatus)
				{
				// return busy
				return KErrInUse;	
				}	

				// The status of transmit request status is stored to use while
				// notifying the completion of the request at a later point.
				//
				iTxDataStatus = aStatus;
				iTxInitialOffset = (TInt ) a1;
				
				if (iTxInitialOffset>=Pdd()->iTxChunk->iSize)
					{
					return KErrOverflow;
					}
				
				// Call TransmitData function, with offset 0
				r = TransmitData((TUint)a1,(TInt)a2);				
			break;
		// User request to receive data from the device (uart)		
		//
		case RExDriverChannel::ERequestReceiveData:						
			// Check if there is another Rx request pending and we received
			// another Rx request, then reject the request and return busy.
			//
			if (iRxDataStatus)
				{
				// return busy
				return KErrInUse;
				}

			// The status of receive request status is stored to use while
			// notifying the completion of the request at a later point.
			//
			iRxDataStatus = aStatus;
			iBytesRxed = (TUint)a2;
			iRxOffset = (TUint)a1;
			iRxInitialOffset = iRxOffset;
			
			if (iRxOffset >= Pdd()->iRxChunk->iSize)
				{
				return KErrOverflow;
				}
			// Call receive data function											
			ReceiveData((TUint)a1,iBytesRxed);
			break;
		default:
			// Unknown request and therefore not supported
			//
			r=KErrNotSupported;
		}
			
	// returns KErrNone or standard error code as returned by API used above
	//
	return r;
	}
コード例 #17
0
/** 
 Handle Synchronous Requests. This is called from Request() to process
 synchronous requests, that perform the action quickly and returns.
 Handling these requests is implementation specific. However, if it needs
 any hardware operation, then PDD function can be invoked from here.
 
 @param 	aFunction
 		  	Request number
 @param 	a1
 			parameter1 passed by user for the request
 @param 	a2
 			parameter2 passed by user for the request
 			
 @return	KErrNone or standard error code
 */	
TInt DExDriverLogicalChannel::DoControl(TInt aFunction, TAny* a1,
										TAny* /*a2*/) // a2 is not being used
	{
	KEXDEBUG(Kern::Printf("++DExDriverLogicalChannel::DoControl"));

	TInt r;

	// Switch over the request type. Typically the requests that are
	// passed here will be RExdDriver::TControl enumerated requests
	// sent by the user in user side DoControl() request
	//
	switch(aFunction)
		{
		// User request to read the channel capabilities of Uart driver
		//
		case RExDriverChannel::EControlCaps:
			
			// Call Caps() to retrieve capabilities to a1
			r = Caps((TDes8*)a1);
			
			break;
		// User request to configure the device (uart)
		//
		case RExDriverChannel::EControlSetConfig:
			// Call SetConfig function by passing the first argument
			r = SetConfig((const TDesC8*)a1);
			break;
		// User request to enable or disable the device's internal loopback mode
		//
		case RExDriverChannel::EControlSetIntLoopback:
			// Call SetIntLoopback function by passing the first argument
			r = SetIntLoopback((const TInt*)a1);
			break;
		case RExDriverChannel::ERequestTransmitData:
			// Call TransmitData function
			
			// Check if already transmit is going on this channel by some other
			// user thread. If yes then return KErrInUse.
			WaitOnTxFMutex();
			if (iTxProgress)
				{
				SignalTxFMutex();
				return KErrInUse;
				}
			
			// Mark Transmit Data progress flag as true.
			iTxProgress = ETrue;
			SignalTxFMutex();
			r = TransmitData((const TDesC8*)a1);
			break;

		case RExDriverChannel::ERequestReceiveData:
			// Call receive data function
			
			// Check if already receive data is going on this channel by some other
			// user thread. If yes then return KErrInUse.
			WaitOnRxFMutex();
			if (iRxProgress)
				{
				SignalRxFMutex();
				return KErrInUse;
				}
			
			// Mark Receive Data progress flag as true.
			iRxProgress = ETrue;
			SignalRxFMutex();
			r = ReceiveData((TDes8*)a1);
			break;
		
		default:
			// Unknown request and therefore not supported
			//
			r = KErrNotSupported;
		}
	return r;
	}
コード例 #18
0
ファイル: Capteurs_IR.c プロジェクト: 7Robot/Freescale
void acquisitionLineSensors(void)
{
	
	uint32_t Counter_value_start = EMIOS_0.CH[16].CCNTR.B.CCNTR;
	uint32_t Counter_value_tmp = 0;
	uint8_t i = 0;
	uint8_t capteur_resultat[7];
	uint8_t seuil_capteur[7];
	uint8_t k;
	
	while(i<7) // Boucle de test pour chaque Capteur
	{	
		seuil_capteur[i] = potent_entre(400,1600); // On lit sur le potent le seuil du capteur i
		// Affichage textuel en xbee
		TransmitData("\n\nOn teste le capteur :");
		TransmitCharacter(i);
		TransmitData("\nLe temps est : ");
		TransmitCharacter(seuil_capteur[i]);
		TransmitData("\nLe capteur detecte :");
		PIT_Enable_Channel(1);
		do
		{
			SIU.PGPDO[1].B.PPD0 = 0xfe000000; //3f810000;   // Pins level HIGH
		}while(PIT.CH[6].CVAL.R < 9 );
		PIT_Disable_Channel(1); // Charging the sensor for 10 us
	
		SIU.PCR[32].R = 0x0100;        // Pin set as an  INPUT
		SIU.PCR[33].R = 0x0100;        // Pin set as an  INPUT
		SIU.PCR[34].R = 0x0100;        // Pin set as an  INPUT
		SIU.PCR[35].R = 0x0100;        // Pin set as an  INPUT
		SIU.PCR[36].R = 0x0100;        // Pin set as an  INPUT
		SIU.PCR[37].R = 0x0100;        // Pin set as an  INPUT
		SIU.PCR[38].R = 0x0100;        // Pin set as an  INPUT
		
		// Réinitialisation des valeurs lues sur les capteurs
		for(k = 0; k < 7; k++)
		{
			capteur_resultat[k] = 1;
		}
		Counter_value_start = EMIOS_0.CH[16].CCNTR.B.CCNTR;
		
		while(((Counter_value_tmp - Counter_value_start) % EMIOS_0.CH[16].CADR.R) < 2000)// Temps total d'acquisition // On fait l'aquisition <1600 et on fait varier le potentiometre entre 400 et 1600
		{
			if(SIU.GPDI[32].B.PDI != 1 && EMIOS_0.CH[16].CCNTR.B.CCNTR< seuil_capteur[0])//798
			{
				capteur_resultat[0] = 0;
			}
			if(SIU.GPDI[33].B.PDI != 1 && EMIOS_0.CH[16].CCNTR.B.CCNTR< seuil_capteur[1])
			{
				capteur_resultat[1] = 0;

			}
			if(SIU.GPDI[34].B.PDI != 1 && EMIOS_0.CH[16].CCNTR.B.CCNTR< seuil_capteur[2])
			{
				capteur_resultat[2] = 0;
			}
			if(SIU.GPDI[35].B.PDI != 1 && EMIOS_0.CH[16].CCNTR.B.CCNTR< seuil_capteur[3])
			{
				capteur_resultat[3] = 0;
			}
			if(SIU.GPDI[35].B.PDI != 1 && EMIOS_0.CH[16].CCNTR.B.CCNTR< seuil_capteur[4])
			{
				capteur_resultat[4] = 0;
			}
			if(SIU.GPDI[36].B.PDI != 1 && EMIOS_0.CH[16].CCNTR.B.CCNTR< seuil_capteur[5])
			{
				capteur_resultat[5] = 0;
			}
		
			if(SIU.GPDI[37].B.PDI != 1 && EMIOS_0.CH[16].CCNTR.B.CCNTR< seuil_capteur[6])//686
			{
				capteur_resultat[6] = 0;
			}
			
			Counter_value_tmp = EMIOS_0.CH[16].CCNTR.B.CCNTR;
					
		}
	
		// Affichage du résultat du capteur courant i
		if(capteur_resultat[i])
		{
			TransmitData(" Blanc");
		}
		else
	    	TransmitData(" Noir");
	
		SIU.PCR[32].R = 0x0200;        // Pin set as an  OUTPUT  // PC[0]
		SIU.PCR[33].R = 0x0200;        // Pin set as an  OUTPUT  // PC[1]
		SIU.PCR[34].R = 0x0200;        // Pin set as an  OUTPUT  // PC[2]
		SIU.PCR[35].R = 0x0200;        // Pin set as an  OUTPUT  // PC[3]
		SIU.PCR[36].R = 0x0200;        // Pin set as an  OUTPUT  // PC[4]
		SIU.PCR[37].R = 0x0200;        // Pin set as an  OUTPUT  // PC[5]
		SIU.PCR[38].R = 0x0200;        // Pin set as an  OUTPUT  // PC[6]
	
		if(SIU.PGPDI[2].R & 0x40000000) // SI le bouton 2 est appuyé on passe au capteur suivant
		{
			i++;
			delay(1000000);
		}
	
	}
	
}