当前位置: 首页>>代码示例>>C++>>正文


C++ GPIOPinRead函数代码示例

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


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

示例1: toggle

void toggle(){

	if(GPIOPinRead(GPIO_PORTF_BASE, GREEN_LED)){
		 GPIOPinWrite(GPIO_PORTF_BASE, GREEN_LED, 0);
	 }else{
		 GPIOPinWrite(GPIO_PORTF_BASE, GREEN_LED, GREEN_LED);
	 }

}
开发者ID:m0sf3tz,项目名称:CNC_ENGRAVER,代码行数:9,代码来源:main_loop.c

示例2: getDigit

//get Digit from IR
int getDigit ()					// determine binary number from pulse delay
{
	waitTime=0;
	while(!GPIOPinRead(GPIO_PORTB_BASE,GPIO_PIN_1))
	{
	}
	if(waitTime >6)
		return 2;
	waitTime=0;
	while(GPIOPinRead(GPIO_PORTB_BASE,GPIO_PIN_1))
	{       
	}
	if(waitTime>14)
		return 1;
	else
		return 0;
    
}
开发者ID:richardszeto,项目名称:Embedded_Systems,代码行数:19,代码来源:Lab3_8962.c

示例3: Pin_Read

unsigned char Pin_Read(tPinName pin)
{
    // Check for valid pin name
    if (pin == NONE || pin == ERR)  
        return -1;

    // Return 1 or 0
    return GPIOPinRead(pins[pin].port.base, pins[pin].offset) == 0 ? 0 : 1;
}
开发者ID:cmonr,项目名称:PAL,代码行数:9,代码来源:pin.c

示例4: main

int main(void)
{
	
		//initialize the GPIO ports	
		PortFunctionInit();
	
	  // turn LED D1 on at the beginning
	  GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x02);
	
	  bool button_first_time_pressed = false;
	  bool button_pressed = false;
	
		float delay = 16000000/3/4;        // half a second delay
	
		int turn_led_on = 1;
	
    //
    // Loop forever.
    //
    while(1)
    {
			if(GPIOPinRead(GPIO_PORTJ_AHB_BASE, GPIO_PIN_1)==0x00)	//SW2 is pressed
			{
					button_first_time_pressed = true;
				  button_pressed = true;
			}
			else
			{
					button_pressed = false;
			}
			// after button is pressed for the first time
			if(button_first_time_pressed)
			{
					if(button_pressed)
					{
							GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x00);  // turn off D1
							SysCtlDelay(delay);      // half a second delay
							turn_led_on = 1 - turn_led_on;           // toggle between 0 and 1
							if (turn_led_on)
									GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x01);  // turn on D2
							else
									GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x00);  // turn off D2
					}
					else    // toggle LED D1
					{					
              GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x00);  // turn off D2
						  SysCtlDelay(delay);      // half a second delay
							turn_led_on = 1 - turn_led_on;           // toggle between 0 and 1
							if (turn_led_on)
									GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x02);  // turn on D1
							else
									GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x00);  // turn off D1
					}
			}
    }
}
开发者ID:RoboEvangelist,项目名称:TivaWare_C_Series-2.1.0.12573,代码行数:56,代码来源:switch_PinMux.c

示例5: EvalDirBtnsHandler

// ******** OS_DownSwitch_Handler ************
// Check if time since last down press >.3s, for debouncing, call buttontask appropriately
// input: none,  
// output: none, 
void EvalDirBtnsHandler(){
   IntDisable(INT_GPIOE);
   GPIOPinIntClear(GPIO_PORTE_BASE, GPIO_PIN_1);
  
  
    while(OS_MsTime() - btndown_time < 500);  // Wait for 10 ms
	    if(GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1) == 0){
		    //BUTTONTASK();	   //supposed to trigger the function that button task points to
             
            // Toggle Debug LED
            if (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_0) == 0)
                GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_PIN_0);
            else
                GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0);
	    }	
	btndown_time=OS_MsTime();
  
    IntEnable(INT_GPIOE);
}
开发者ID:AustinBlackstone,项目名称:EE345M-S2012,代码行数:23,代码来源:os.c

示例6: SelectBtnHandler

// ******** OS_SelectSwitch_Handler ************
// Check if time since last switch press >.3s, for debouncing, call buttontask appropriately
// input: none,  
// output: none, 
void SelectBtnHandler(){
    IntDisable(INT_GPIOF);
	GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1);
  
	//currentTime=OS_MsTime();
    while(OS_MsTime() - SDEBOUNCEPREV < 500);  // Wait for 10 ms
	    if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1) == 0){
            // Toggle Debug LED
            if (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_0) == 0)
                GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_PIN_0);
            else
                GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0);
                
		    BUTTONTASK();	   //supposed to trigger the function that button task points to
	    }	
	SDEBOUNCEPREV=OS_MsTime();
  
    IntEnable(INT_GPIOF);
}
开发者ID:AustinBlackstone,项目名称:EE345M-S2012,代码行数:23,代码来源:os.c

示例7: interrupt_handler

void interrupt_handler(void)
{

  GPIOIntClear(GPIO_PORTB_BASE, GPIO_INT_PIN_2);

  if(GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_2) == 0x0) {
    isr_flag = 1;

  }
}
开发者ID:phuongtg,项目名称:micro2-1,代码行数:10,代码来源:7segment.c

示例8: CheckSwitches

char CheckSwitches() {

  long  lSwt1;
  long  lSwt2;

  chSwtPrev = chSwtCur;

  lSwt1 = GPIOPinRead(SWT1Port, SWT1);
  lSwt2 = GPIOPinRead(SWT2Port, SWT2);

  chSwtCur = (lSwt1 | lSwt2) >> 6;

  if(chSwtCur != chSwtPrev) {
    fClearOled = true;
  }

  return chSwtCur;

}
开发者ID:mk3a,项目名称:Geese-Invaders,代码行数:19,代码来源:FinalVersion.c

示例9: brakeHandler

void brakeHandler(){

	GPIOIntClear(GPIO_PORTB_BASE, GPIO_INT_PIN_0);

	if(GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_0) == 0x0)
	{
		enableSys = 0;
	}

}
开发者ID:phuongtg,项目名称:micro2-1,代码行数:10,代码来源:Main+Program.c

示例10: GPIOPinRead

bool Board::getLed(int32_t led) {
	int32_t value;
	if (led == LED_RED) {
		value = GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1);
		if (value)
			return true;
	}
	if (led == LED_BLUE) {
		value = GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2);
		if (value)
			return true;
	}
	if (led == LED_GREEN) {
		value = GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_3);
		if (value)
			return true;
	}
	return false;
}
开发者ID:vortex314,项目名称:projects,代码行数:19,代码来源:Board.cpp

示例11: RD_6963

//========================
uint8  RD_6963()
{
    uint8 read_data;
    GPIOPinTypeGPIOInput(PORT_DATA6963,  WHOLE_PORT );   //DATA 至数
    GPIOPinWrite(PORT_SET6963 ,PIN_CE6963,0);
    GPIOPinWrite(PORT_SET6963,PIN_RD6963,0);
    read_data=(uint8)GPIOPinRead(PORT_DATA6963,  WHOLE_PORT );
    GPIOPinWrite(PORT_SET6963,PIN_CE6963|PIN_RD6963,PIN_CE6963|PIN_RD6963);
    return(read_data);
}
开发者ID:qiurenguo2014,项目名称:youjiesun_dg,代码行数:11,代码来源:xs6963_lm3s.c

示例12: main

//! With this setup it would seem like main() must be the first function in this file, otherwise
//! the wrong function gets called on reset.
void main(void)
{
    volatile INT32U ulLoop;
    volatile INT16U event;
    volatile INT16U push;
    //Hardware upstarts
    initHW();

    //! Start the OLED display and write a message on it
    RIT128x96x4Init(ulSSI_FREQUENCY);
    RIT128x96x4StringDraw("EMP", 					15, 42, mainFULL_SCALE);
    RIT128x96x4StringDraw("enter the code.....",	 5, 49, mainFULL_SCALE);
    RIT128x96x4StringDraw("SW2 SW3 SW4 SW5 SW6", 		15, 57, mainFULL_SCALE);
    // Entry Password see under inputs
    // Wait for the select key to be pressed
    while (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1));
    // Wait for the select key to be pressed
    while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0));
    // Wait for the select key to be pressed
    while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1));
    // Wait for the select key to be pressed
    while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_2));
    // Wait for the select key to be pressed
    while (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_3));

    // Clean the OLED display.
    RIT128x96x4Clear();
    //
    // Loop forever.
    //
    while (1)
    {

        // Statmashine function
        // This is where a statemachine could be added
        event = GetKeyEvents();
        push = select_button();
        statemashine(event , push);
        //all functions the

    }

}
开发者ID:BetteLars,项目名称:Project_EMB,代码行数:45,代码来源:main.c

示例13: interrupt_handler

void interrupt_handler(void)
{
	GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_2 | GPIO_INT_PIN_3);
	
	if(GPIOPinRead(port_F, GPIO_PIN_2) == 0x0) { 
		display_flag = 1;

	} 

}
开发者ID:phuongtg,项目名称:micro2-1,代码行数:10,代码来源:random_number.c

示例14: Timer0IntHandler

void Timer0IntHandler(void)
{
	int i;
	// Limpia el flag de interrupcion
	TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);

/*	//Escribo el comando en el YEI
	for(i=0; i<sizeof(todos_normalizados); i++){
				UARTCharPut(UART4_BASE, todos_normalizados[i]);}*/

/*	//Escribo el comando en el YEI
	for(i=0; i<sizeof(giroscopo); i++){
				UARTCharPut(UART4_BASE, giroscopo[i]);}*/

	//Escribo el comando en el YEI
	for(i=0; i<sizeof(aceleracion); i++){
				UARTCharPut(UART4_BASE, aceleracion[i]);}

/*	//Escribo el comando en el YEI
	for(i=0; i<sizeof(magnetometro); i++){
				UARTCharPut(UART4_BASE, magnetometro[i]);}*/

	//Escribo el comando en el YEI
		for(i=0; i<sizeof(orientacion); i++){
					UARTCharPut(UART4_BASE, orientacion[i]);}

	cThisChar='0';
	int contador2=0;
	int contador_end_lines=0;

					do{

			    	cThisChar=UARTCharGet(UART4_BASE);
			    	BuffYEI[contador2]=cThisChar;
			    	contador2=contador2+1;
			    		if((cThisChar == '\n'))
			    			contador_end_lines=contador_end_lines+1;

						} while(contador_end_lines != 2);

		rc = f_open(&Fil, "BuffGPS.TXT", FA_WRITE | FA_OPEN_ALWAYS);	//abre o crea un archivo
		rc = f_lseek(&Fil, Fil.fsize);
		rc = f_write(&Fil, &BuffYEI, contador2, &bw);
		rc = f_sync(&Fil);
		rc = f_close(&Fil);

		if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2))
		{
			GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0);
		}
		else
		{
			GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 4);
		}
}
开发者ID:joseomar,项目名称:Proyectos_CCS-TI,代码行数:55,代码来源:main.c

示例15: displayScore

void displayScore () {
  char scoreStr[8];
  if(score<0)score=0; //Dont wanna mock the user with negative scores
  if (score>highScore) {
    OrbitOledClear();
    drawPusheen (); //Pusheen drawn on the right
    
  //Code for displaying high score on the left (columns 0 - 7)
      OrbitOledMoveTo(92, 0);
    OrbitOledDrawString("NEW");
    OrbitOledMoveTo(88, 8);
    OrbitOledDrawString("HIGH");
    OrbitOledMoveTo(84, 16);
    OrbitOledDrawString("SCORE");
  
    OrbitOledMoveTo(84,24);
    sprintf(scoreStr, "%05d", score);
    OrbitOledDrawString (scoreStr);
    OrbitOledUpdate();
    highScore=score;
  }
  else{
  OrbitOledClear();;
  //Display the current score
  OrbitOledSetCursor (3, 2);
  OrbitOledPutString ("SCORE:");
  OrbitOledSetCursor (10, 2);
  sprintf(scoreStr, "%05d", score);
  OrbitOledPutString (scoreStr);
  }


  long lBtn1;
  lBtn1 = GPIOPinRead(BTN1Port, BTN1);
  while(lBtn1!=BTN1){
    updateLED(4);
    delay(100);
    updateLED(0);
    delay(100);
    lBtn1 = GPIOPinRead(BTN1Port, BTN1);
  } 
}
开发者ID:mk3a,项目名称:Geese-Invaders,代码行数:42,代码来源:FinalVersion.c


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