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

C++ GPIOPinRead函数代码示例

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

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



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


示例16: SysCtlPeripheralEnable

//Initialize as a master
void TwoWire::begin(void)
{

  if(i2cModule == NOT_ACTIVE) {
      i2cModule = BOOST_PACK_WIRE;
  }

  SysCtlPeripheralEnable(g_uli2cPeriph[i2cModule]);

  //Configure GPIO pins for I2C operation
  GPIOPinConfigure(g_uli2cConfig[i2cModule][0]);
  GPIOPinConfigure(g_uli2cConfig[i2cModule][1]);
  GPIOPinTypeI2C(g_uli2cBase[i2cModule], g_uli2cSDAPins[i2cModule]);
  GPIOPinTypeI2CSCL(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]);
  I2CMasterInitExpClk(MASTER_BASE, F_CPU, false);//max bus speed=400kHz for gyroscope

  //force a stop condition
  if(!GPIOPinRead(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]))
      forceStop();

  //Handle any startup issues by pulsing SCL
  if(I2CMasterBusBusy(MASTER_BASE) || I2CMasterErr(MASTER_BASE)
    || !GPIOPinRead(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule])){
      uint8_t doI = 0;
        GPIOPinTypeGPIOOutput(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]);
        unsigned long mask = 0;
        do{
            for(unsigned long i = 0; i < 10 ; i++) {
                SysCtlDelay(F_CPU/100000/3);//100Hz=desired frequency, delay iteration=3 cycles
                mask = (i%2) ? g_uli2cSCLPins[i2cModule] : 0;
                GPIOPinWrite(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule], mask);
            }
            doI++;
        }while(I2CMasterBusBusy(MASTER_BASE) && doI < 100);

        GPIOPinTypeI2CSCL(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]);
        if(!GPIOPinRead(g_uli2cBase[i2cModule], g_uli2cSCLPins[i2cModule]))
            forceStop();

  }

}
开发者ID:fughilli,项目名称:NATCAR2015,代码行数:43,代码来源:Wire.cpp


示例17: SysTickIntHandler

//*****************************************************************************
//
// Called by the NVIC as a SysTick interrupt, which is used to generate the
// sample interval
//
//*****************************************************************************
void
SysTickIntHandler()
{
    //
    // Blink the blue LED to indicate data read from BMP180.
    //
    MAP_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_4,
                     ((GPIOPinRead(GPIO_PORTQ_BASE, GPIO_PIN_4)) ^
                      GPIO_PIN_4));
    BMP180DataRead(&g_sBMP180Inst, BMP180AppCallback, &g_sBMP180Inst);
}
开发者ID:nguyenvuhung,项目名称:TivaWare_C_Series-2.1.2.111,代码行数:17,代码来源:pressure_bmp180.c


示例18: GPIOPinRead

void GpioOut::toggle(void)
{
    // Read the old status of the pin
    uint32_t status = GPIOPinRead(gpio_.port, gpio_.pin);

    // Change the status of the pin
    status = (~status) & gpio_.pin;

    // Set the new status of the pin
    GPIOPinWrite(gpio_.port, gpio_.pin, status);
}
开发者ID:openwarelab,项目名称:firmware,代码行数:11,代码来源:GpioOut.cpp


示例19: buttonIsPressed

/*
Whether the selected button is pressed.
@param button which button - must be ANY_BUTTON or BUTTON_1 or BUTTON_2 on this implementation.
@return > 0 if the selected button is pressed, otherwise 0.
 */
uint8_t buttonIsPressed(uint8_t button)
{

    uint32_t buttonState = GPIOPinRead(GPIO_PORTF_BASE, ALL_BUTTONS);
    uint32_t buttonState2 = GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_4);

    if (button == ANY_BUTTON)
        return (((~buttonState) & LEFT_BUTTON) || ((~buttonState) & RIGHT_BUTTON) || ((~buttonState2) & GPIO_PIN_4));

    if (button == BUTTON_0)
        return ((~buttonState) & LEFT_BUTTON);
    if (button == BUTTON_1)
        return ((~buttonState) & RIGHT_BUTTON);

    if (button == BUTTON_2)
        return ((~buttonState2) & GPIO_PIN_4);

    // invalid buttonId, so return false
    return 0;
}
开发者ID:vtoanb,项目名称:msp430lioamaintain,代码行数:25,代码来源:hal_ek-lm4f120XL.c


示例20: Timer0IntHandler

void Timer0IntHandler(void)
{
	// Clear the timer interrupt
	TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);

	// Read the current state of the GPIO pin and
	// write back the opposite state
	if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2))
		GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, 0xFF);

}
开发者ID:JonMacLean,项目名称:CCS_Projects,代码行数:11,代码来源:main.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GPIOPinTypeGPIOInput函数代码示例发布时间:2022-05-30
下一篇:
C++ GPIOPinIntEnable函数代码示例发布时间: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