您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GPIOSetDir函数代码示例

51自学网 2021-06-01 20:54:28
  C++
这篇教程C++ GPIOSetDir函数代码示例写得很实用,希望能帮到您。

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

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

示例1: trigInputInit

/** * *brief	init trig pin as input, install interrupt handler on event 1 * IO pins on lpc11xx can be configured for hysteresis ~0.4V, we enable this to avoid * multiple interrupts when optocoupler input is fired from a potential noisy and slow input * */void trigInputInit(void){    /* init timers */    /* avoid triggerning after reset, and allow inputs to settle */    timeLast1 = 0;    timeLast2 = 0;    timeEdge1 = 0;    timeEdge2 = 0;    /* allow interrupts on GPIO 1 & 2 */    NVIC_EnableIRQ(EINT1_IRQn);    NVIC_EnableIRQ(EINT2_IRQn);    /* hard coded pins set pullups and hysteresis TODO*/    LPC_IOCON->PIO2_2  = 0x00000030;    LPC_IOCON->PIO1_10 = 0x000000B0;    GPIOSetDir( TRIG_IN_PORT_1, TRIG_IN_PIN_1, 0);    GPIOSetDir( TRIG_IN_PORT_2, TRIG_IN_PIN_2, 0);    /* attach pin to falling edge Interrupt */    GPIOSetInterrupt(TRIG_IN_PORT_1, TRIG_IN_PIN_1, 0, 0, 0);    GPIOSetInterrupt(TRIG_IN_PORT_2, TRIG_IN_PIN_2, 0, 0, 0);    /*enable interrupts*/    GPIOIntEnable( TRIG_IN_PORT_1, TRIG_IN_PIN_1);    GPIOIntEnable( TRIG_IN_PORT_2, TRIG_IN_PIN_2);}
开发者ID:opprud,项目名称:remote_2_0,代码行数:33,


示例2: rfid_init

void rfid_init(void){	/* reset SSP peripheral */	LPC_SYSCON->PRESETCTRL = 0x01;	/* Enable SSP clock */	LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 11);	// Enable SSP peripheral	LPC_IOCON->PIO0_8 = 0x01 | (0x01 << 3); /* MISO, Pulldown */	LPC_IOCON->PIO0_9 = 0x01; /* MOSI */	LPC_IOCON->SCKLOC = 0x00; /* route to PIO0_10 */	LPC_IOCON->JTAG_TCK_PIO0_10 = 0x02; /* SCK */	/* Set SSP clock to 4.5MHz */	LPC_SYSCON->SSPCLKDIV = 0x01;	LPC_SSP->CR0 = 0x0707;	LPC_SSP->CR1 = 0x0002;	LPC_SSP->CPSR = 0x02;	/* Initialize chip select line */	GPIOSetDir(PN532_CS_PORT, PN532_CS_PIN, 1);	rfid_cs(1);	/* Initialize RESET line */	GPIOSetDir(PN532_RESET_PORT, PN532_RESET_PIN, 1);	rfid_reset(0);}
开发者ID:KhMassri,项目名称:DTNWorkspace,代码行数:30,


示例3: main

int main (void){  uint8_t ledState;  //Set LED1 pin as an output  GPIOSetDir( LED1_PORT, LED1_PIN, GPIO_OUTPUT);  GPIOSetValue( LED1_PORT, LED1_PIN, LED_OFF);  //Set SW2 pin as an input  GPIOSetDir( SW2_PORT, SW2_PIN, GPIO_INPUT);  //enter forever loop  while (1)  {    //delay a specified period of time (the sample period)    delayMS(75);    //check if push-button is pressed    if (GPIOGetValue(SW2_PORT, SW2_PIN) == SW_PRESSED)    {      //toggle LED	    if (ledState == LED_ON)	      ledState = LED_OFF;	    else        ledState = LED_ON;      GPIOSetValue( LED1_PORT, LED1_PIN, ledState);      //wait until push-button is released	    while(GPIOGetValue(SW2_PORT, SW2_PIN) == SW_PRESSED)		    ;	  }  }  return 0;}
开发者ID:finklabs,项目名称:epicsamples,代码行数:34,


示例4: pn532_bus_HWInit

error_t pn532_bus_HWInit(void){  #ifdef PN532_DEBUGMODE  PN532_DEBUG("Initialising I2C%s", CFG_PRINTF_NEWLINE);  #endif  i2cInit(I2CMASTER);  // Set reset pin as output and reset device  GPIOSetDir(CFG_PN532_RSTPD_PORT, CFG_PN532_RSTPD_PIN, 1);  #ifdef PN532_DEBUGMODE  PN532_DEBUG("Resetting the PN532%s", CFG_PRINTF_NEWLINE);  #endif  LPC_GPIO->CLR[CFG_PN532_RSTPD_PORT] = (1 << CFG_PN532_RSTPD_PIN);  systickDelay(400);  LPC_GPIO->SET[CFG_PN532_RSTPD_PORT] = (1 << CFG_PN532_RSTPD_PIN);  // Wait for the PN532 to finish booting  systickDelay(100);  // Ping the I2C device first to see if it exists!  if (i2cCheckAddress(PN532_I2C_ADDRESS) == false)  {    #ifdef PN532_DEBUGMODE    PN532_DEBUG("Can't find PN532 on the I2C bus%s", CFG_PRINTF_NEWLINE);    #endif    return ERROR_I2C_DEVICENOTFOUND;  }  // Set IRQ pin to input  GPIOSetDir(CFG_PN532_I2C_IRQPORT, CFG_PN532_I2C_IRQPIN, 0);  return ERROR_NONE;}
开发者ID:kevinxusz,项目名称:LPC11U_LPC13U_CodeBase,代码行数:33,


示例5: rfid_init

void rfid_init(void){	/* reset SSP peripheral */	LPC_SYSCON->PRESETCTRL = 0x01;	/* Enable SSP clock */	LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 11);	// Enable SSP peripheral	LPC_IOCON->PIO0_8 = 0x01 | (0x01 << 3); /* MISO, Pulldown */	LPC_IOCON->PIO0_9 = 0x01; /* MOSI */	LPC_IOCON->SCKLOC = 0x00; /* route to PIO0_10 */	LPC_IOCON->JTAG_TCK_PIO0_10 = 0x02; /* SCK */	/* Set SSP clock to 4.5MHz */	LPC_SYSCON->SSPCLKDIV = 0x01;	LPC_SSP->CR0 = 0x0707;	LPC_SSP->CR1 = 0x0002;	LPC_SSP->CPSR = 0x02;	/* Initialize chip select line */	rfid_cs(1);	GPIOSetDir(PN532_CS_PORT, PN532_CS_PIN, 1);	/* Initialize RESET line */	rfid_reset(0);	GPIOSetDir(PN532_RESET_PORT, PN532_RESET_PIN, 1);	/* Create PN532 task */	xTaskCreate(rfid_task, (const signed char*) "RFID", TASK_RFID_STACK_SIZE,			NULL, TASK_RFID_PRIORITY, NULL);}
开发者ID:code-constructor,项目名称:openbeacon,代码行数:33,


示例6: GPIOInit

/******************************************************************************* Function name:		GPIOInit**** Descriptions:		Initialize GPIO, install the**						GPIO interrupt handler**** parameters:			None** Returned value:		true or false, return false if the VIC table**						is full and GPIO interrupt handler can be**						installed.** *****************************************************************************/void GPIOInit( void ){	//int i;  /* Enable AHB clock to the GPIO domain. */  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);	LPC_IOCON->R_PIO0_11  &= ~0x07;  LPC_IOCON->R_PIO0_11  |= 0x01;	LPC_IOCON->R_PIO1_0  &= ~0x07;  LPC_IOCON->R_PIO1_0  |= 0x01;	  LPC_IOCON->R_PIO1_1  &= ~0x07;  LPC_IOCON->R_PIO1_1  |= 0x01;	LPC_IOCON->R_PIO1_2  &= ~0x07;  LPC_IOCON->R_PIO1_2  |= 0x01;		LPC_IOCON->PIO0_4 = 0x100;	LPC_IOCON->PIO0_5 = 0x100;		//NodeId_Adress	LPC_GPIO[PORT2]->DIR &= ~(0xDC0); //ADDR0-4	GPIOSetDir(PORT1,10,E_IO_INPUT);		//ADDR5	GPIOSetDir(PORT1,11,E_IO_INPUT);	//ADDR6		GPIOSetDir(PORT1, 2, E_IO_INPUT);	//EINT  /* Set up NVIC when I/O pins are configured as external interrupts. */  //NVIC_EnableIRQ(EINT0_IRQn);  //NVIC_EnableIRQ(EINT1_IRQn);  //NVIC_EnableIRQ(EINT2_IRQn);  //NVIC_EnableIRQ(EINT3_IRQn);  return;}
开发者ID:dihic,项目名称:iShelfTCM,代码行数:47,


示例7: main

int main(void) {	//GPIOInit();	SysTick_Config( SystemCoreClock/1000 );	SysTick->CTRL &= (0 << 1);	//initDrive();	ADCInit( ADC_CLK );	//initReflex();	//GPIOSetDir( 3, 2, 1 );	//GPIOSetValue( 3, 2, 0);	GPIOSetDir( LED_PORT, LED_BIT, 1 );	GPIOSetValue( LED_PORT, LED_BIT, LED_OFF );	GPIOSetDir( 3, 2, 1 );	// Enter an infinite loop, just incrementing a counter	volatile static int i = 0 ;	while(1)	{		//uint16_t adcValue = ADCRead( 5 );		if(reflexRead())//adcValue > 100)		{			GPIOSetValue( LED_PORT, LED_BIT, LED_ON );		}		else		{			GPIOSetValue( LED_PORT, LED_BIT, LED_OFF );		}		//i++;	}	return 0 ;}
开发者ID:staffy,项目名称:EDwin,代码行数:29,


示例8: main

/*******************************************************************************   Main Function  main()******************************************************************************/int main (void){  SystemInit();  GPIOInit();  /* use port0_1 as input event, interrupt test. */  GPIOSetDir( PORT0, 1, 0 );  /* port0_1, single trigger, active high. */  GPIOSetInterrupt( PORT0, 1, 0, 0, 0 );  GPIOIntEnable( PORT0, 1 );  /* use port1_1 as input event, interrupt test. */  GPIOSetDir( PORT1, 1, 0 );  /* port0_1, single edge trigger, active high. */  GPIOSetInterrupt( PORT1, 1, 0, 0, 0 );  GPIOIntEnable( PORT1, 1 );  /* use port2_1 as input event, interrupt test. */  GPIOSetDir( PORT2, 1, 0 );  /* port0_1, single edge trigger, active high. */  GPIOSetInterrupt( PORT2, 1, 0, 0, 0 );  GPIOIntEnable( PORT2, 1 );  /* use port3_1 as input event, interrupt test. */  GPIOSetDir( PORT3, 1, 0 );  /* port0_1, single edge trigger, active high. */  GPIOSetInterrupt( PORT3, 1, 0, 0, 0 );  GPIOIntEnable( PORT3, 1 );  while( 1 );}
开发者ID:m3y54m,项目名称:32bitmicro,代码行数:35,


示例9: flashLight

void flashLight(int timeMS, int OnOrOff){	GPIOSetDir( LED_PORT, LED_BIT, OnOrOff );	//delay for time	delaySysTick(timeMS/10);	GPIOSetDir( LED_PORT, LED_BIT, 0 );}
开发者ID:jacobhaynes,项目名称:Digital-Design-Lab,代码行数:7,


示例10: prvSetupHardware

static void prvSetupHardware( void ){extern unsigned long _vStackTop[], _pvHeapStart[];unsigned long ulInterruptStackSize;	/* Initialize GPIO (sets up clock) */	GPIOInit();	/* Set LED port pin to output */	GPIOSetDir(LED_PORT, LED_GREEN_BIT, 1);	GPIOSetDir(LED_PORT, LED_RED_BIT, 1);	GPIOSetValue(LED_PORT, LED_GREEN_BIT, 0);	GPIOSetValue(LED_PORT, LED_RED_BIT, 0);	PumpsInit();	FlowrateInit();	PacketInit(230400);	/* The size of the stack used by main and interrupts is not defined in	the linker, but just uses whatever RAM is left.  Calculate the amount of	RAM available for the main/interrupt/system stack, and check it against	a reasonable number.  If this assert is hit then it is likely you don't	have enough stack to start the kernel, or to allow interrupts to nest.	Note - this is separate to the stacks that are used by tasks.  The stacks	that are used by tasks are automatically checked if	configCHECK_FOR_STACK_OVERFLOW is not 0 in FreeRTOSConfig.h - but the stack	used by interrupts is not.  Reducing the conifgTOTAL_HEAP_SIZE setting will	increase the stack available to main() and interrupts. */	ulInterruptStackSize = ( ( unsigned long ) _vStackTop ) - ( ( unsigned long ) _pvHeapStart );	configASSERT( ulInterruptStackSize > 350UL );	/* Fill the stack used by main() and interrupts to a known value, so its	use can be manually checked. */	memcpy( ( void * ) _pvHeapStart, ucExpectedInterruptStackValues, sizeof( ucExpectedInterruptStackValues ) );}
开发者ID:Cheng-SG,项目名称:BubbleCode,代码行数:34,


示例11: main

int main (void){  draw_lcd_t lcd;  // outputs  GPIOSetDir(OLED_SSEL_PORT, OLED_SSEL_PIN, GPIO_OUTPUT);  GPIOSetDir(OLED_DC_PORT, OLED_DC_PIN, GPIO_OUTPUT);  GPIOSetDir(OLED_RESET_PORT, OLED_RESET_PIN, GPIO_OUTPUT);  GPIOSetValue(OLED_SSEL_PORT, OLED_SSEL_PIN, 1);  GPIOSetValue(OLED_DC_PORT, OLED_DC_PIN, 1);  GPIOSetValue(OLED_RESET_PORT, OLED_RESET_PIN, 1);  SSP0Init(6000000);  printf("/nInitializing oled driver...");  oled_init(&lcd);  rainbow(&lcd);  //enter forever loop -  while (1) {  }  return 0;}
开发者ID:finklabs,项目名称:epicsamples,代码行数:26,


示例12: power_mgr_init

void power_mgr_init() {   GPIOSetDir( POWER_MGR_PORT, POWER_MGR_PIN_PLAYER, 1);   GPIOSetDir( POWER_MGR_PORT, POWER_MGR_PIN_AMP, 1);   // set default value (0 means active due relay module)   GPIOSetValue( POWER_MGR_PORT, POWER_MGR_PIN_PLAYER, 0);   GPIOSetValue( POWER_MGR_PORT, POWER_MGR_PIN_AMP, 0);}
开发者ID:hdo,项目名称:lpcx1343_cmsis2_jukebox4kids_ui,代码行数:8,


示例13: temp_init

/****************************************************************************** * * Description: *    Initialize Temp Sensor driver * * Params: *   [in] getMsTicks - callback function for retrieving number of elapsed ticks *                     in milliseconds * *****************************************************************************/void temp_init (uint32_t (*getMsTicks)(void)){#ifdef TEMP_USE_P0_2    GPIOSetDir( PORT0, 2, 0 );#else    GPIOSetDir( PORT1, 5, 0 );#endif    getTicks = getMsTicks;}
开发者ID:ecomptiago,项目名称:EmbarcadosLab2,代码行数:19,


示例14: rgb_init

/****************************************************************************** * * Description: *    Initialize RGB driver * *****************************************************************************/void rgb_init (void){    GPIOSetDir( PORT1, 9, 1 );    GPIOSetDir( PORT1, 2, 1 );    GPIOSetDir( PORT1, 10, 1 );    LPC_IOCON->PIO1_10 = LPC_IOCON->PIO1_10 & ~0x7;    LPC_IOCON->PIO1_9 = LPC_IOCON->PIO1_9 & ~0x7;    //DR:    LPC_IOCON->R_PIO1_2 = (LPC_IOCON->R_PIO1_2 & ~0x7) | 0x1;}
开发者ID:ecomptiago,项目名称:EmbarcadosLab2,代码行数:17,


示例15: touchInit

void touchInit(){  SSP0_IOConfig();   GPIOSetDir(ADS7843_CS_GPIO,ADS7843_CS_GPIOBIT,1);  //out  GPIOSetDir(ADS7843_INT_GPIO,ADS7843_INT_GPIOBIT,0); //in put  GPIOSetInterrupt(ADS7843_INT_GPIO,ADS7843_INT_GPIOBIT, 0, 0, 0); //signal fall edge   //GPIOIntEnable(ADS7843_INT_GPIO, ADS7843_INT_GPIOBIT);  GPIOSetValue(ADS7843_CS_GPIO,ADS7843_CS_GPIOBIT,1); //output hight  SSP0_Init();   //spi_clk is 1mhz  touchTimerInit();  }
开发者ID:httpftpli,项目名称:keyboard,代码行数:11,


示例16: uart2_init

/****************************************************************************** * * Description: *    Initialize the ISL29003 Device * * Params: *   [in] baudRate - the baud rate to use *   [in] chan - the channel to use. Channel A connected to RS232 port. *               Channel B connected to J53. * *****************************************************************************/void uart2_init (uint32_t baudRate, uart2_channel_t chan){    GPIOSetDir(PORT0, 9, 1);    GPIOSetDir(PORT2, 8, 1);    GPIOSetValue( PORT0, 9, 1 ); // SI-A1    GPIOSetValue( PORT2, 8, 1 ); // CS#-A0    channel = chan;    uart2_setBaudRate(baudRate);}
开发者ID:ecomptiago,项目名称:EmbarcadosLab2,代码行数:23,


示例17: encoder_init

/** * Initialize encoders on robot */void encoder_init(void) {  // enable IRQ from gpio port  // set left&right encoder pins as inputs  GPIOSetDir(PORT2, 6, GPIO_INPUT);  GPIOSetDir(PORT2, 11, GPIO_INPUT);  // initialize pins to generate interrupts (falling edge sensitive).  LPC_GPIO2->IEV &= ~(1 << 6);  // set falling edge sensitive  LPC_GPIO2->IE |= (1 << 6);  // enable interrupt from PIO2_6  LPC_GPIO2->IEV &= ~(1 << 11);  // set falling edge sensitive  LPC_GPIO2->IE |= (1 << 11);  // enable interrupt from PIO2_11  NVIC_EnableIRQ(EINT2_IRQn);}
开发者ID:finklabs,项目名称:epiclibs,代码行数:16,


示例18: reflexDigitalInit

void reflexDigitalInit(){	LPC_IOCON->R_PIO0_11 &= ~0x1F;			// - remove bits 0,1 & 2 and pull resistors	LPC_IOCON->R_PIO0_11 |= 0x01;	LPC_IOCON->R_PIO1_0 &= ~0x1F;			// - remove bits 0,1 & 2 and pull resistors	LPC_IOCON->R_PIO1_0 |= 0x01;	LPC_IOCON->R_PIO1_1 &= ~0x1F;			// - remove bits 0,1 & 2 and pull resistors	LPC_IOCON->R_PIO1_1 |= 0x01;	LPC_IOCON->R_PIO1_2 &= ~0x1F;			// - remove bits 0,1 & 2 and pull resistors	LPC_IOCON->R_PIO1_2 |= 0x01;	GPIOSetDir( REFLEX_1_PORT, REFLEX_1_BIT, 0 );	GPIOSetDir( REFLEX_2_PORT, REFLEX_2_BIT, 0 );	GPIOSetDir( REFLEX_3_PORT, REFLEX_3_BIT, 0 );	GPIOSetDir( REFLEX_4_PORT, REFLEX_4_BIT, 0 );}
开发者ID:staffy,项目名称:EDwin,代码行数:15,


示例19: initLed

void initLed(){	unsigned long timeNow;	/* update time */	timeNow = millis();	/* Set LED port p1.11 to output */	GPIOSetDir(LED_PORT, LED_PIN, 1);	/* LED off */	GPIOSetValue(LED_PORT, LED_PIN, 0);	/* set update times accordingly */	ledStatus[0].index = 0;	ledStatus[1].index = 0;	ledStatus[2].index = 0;	ledStatus[3].index = 0;	/* somehow fails during init - TODO*/	ledStatus[0].repeatPattern = 1;	ledStatus[1].repeatPattern = 1;	ledStatus[2].repeatPattern = 0;	ledStatus[3].repeatPattern = 1;	ledStatus[4].repeatPattern = 1;	ledStatus[0].nextLedUpdateTime = timeNow + ledStatus[0].timing[ledStatus[0].index].nextLedUpdateTime;	ledStatus[1].nextLedUpdateTime = timeNow + ledStatus[1].timing[ledStatus[1].index].nextLedUpdateTime;	ledStatus[2].nextLedUpdateTime = timeNow + ledStatus[2].timing[ledStatus[2].index].nextLedUpdateTime;	ledStatus[3].nextLedUpdateTime = timeNow + ledStatus[3].timing[ledStatus[3].index].nextLedUpdateTime;	ledStatus[4].nextLedUpdateTime = timeNow + ledStatus[4].timing[ledStatus[4].index].nextLedUpdateTime;}
开发者ID:opprud,项目名称:remote_2_0,代码行数:32,


示例20: chb_drvr_init

error_t chb_drvr_init(){    // config SPI for at86rf230 access    chb_spi_init();    // Set sleep and reset as output    GPIOSetDir(CFG_CHIBI_SLPTRPORT, CFG_CHIBI_SLPTRPIN, 1);    GPIOSetDir(CFG_CHIBI_RSTPORT, CFG_CHIBI_RSTPIN, 1);    // configure IOs    LPC_GPIO->SET[CFG_CHIBI_SLPTRPORT] = (1 << CFG_CHIBI_SLPTRPIN); // Set sleep high    LPC_GPIO->SET[CFG_CHIBI_RSTPORT] = (1 << CFG_CHIBI_RSTPIN);     // Set reset high    // config radio    return chb_radio_init();}
开发者ID:kevinxusz,项目名称:LPC11U_LPC13U_CodeBase,代码行数:16,


示例21: pinMode

void pinMode(uint8_t pin, uint8_t mode){	uint8_t PORT = pin/10;	pin = pin%10; 	GPIOSetDir(PORT, pin, mode);}
开发者ID:donghee,项目名称:ArmDMX,代码行数:7,


示例22: main

intmain (void){  HAL_init();  /* Set LED port pin to output */  GPIOSetDir (LED_PORT, LED_BIT, 1);  GPIOSetValue (LED_PORT, LED_BIT, 0);  /* Create the queue. */  xQueue = xQueueCreate (mainQUEUE_LENGTH, sizeof (unsigned long));  if (xQueue != NULL)    {      /* Start the two tasks as described in the accompanying application         note. */      xTaskCreate (prvQueueReceiveTask, (signed char *) "Rx",		   configMINIMAL_STACK_SIZE, NULL,		   mainQUEUE_RECEIVE_TASK_PRIORITY, NULL);      xTaskCreate (prvQueueSendTask, (signed char *) "TX",		   configMINIMAL_STACK_SIZE, NULL,		   mainQUEUE_SEND_TASK_PRIORITY, NULL);      /* Start the tasks running. */      vTaskStartScheduler ();    }  /* If all is well we will never reach here as the scheduler will now be     running.  If we do reach here then it is likely that there was insufficient     heap available for the idle task to be created. */  for (;;);}
开发者ID:finklabs,项目名称:epicsamples,代码行数:32,


示例23: PMU_Init

/******************************************************************************* Function name:		PMU_Init**** Descriptions:		Initialize PMU and setup wakeup source.**						For Sleep and deepsleep, any of the I/O pins can be **						used as the wakeup source.**						For Deep Powerdown, only pin P1.4 can be used as **						wakeup source from deep powerdown. **** parameters:			None** Returned value:		None** *****************************************************************************/void PMU_Init( void ){  uint32_t i;  /* Enable all clocks, even those turned off at power up. */  LPC_SYSCON->PDRUNCFG &= ~(WDT_OSC_PD|SYS_OSC_PD|ADC_PD);  for ( i = 0; i < NUM_OF_WAKESOURCE; i++ )  {	NVIC_EnableIRQ((IRQn_Type)(WAKEUP0_IRQn+i));  }  /* use port0_1 as wakeup source, i/o pin */  LPC_IOCON->PIO0_1 &= ~0x07;	  LPC_IOCON->PIO0_1 |= 0x20;	  GPIOSetDir( PORT0, 1, 0 );	/* Input P0.1 */  /* Only edge trigger. activation polarity on P0.1 is FALLING EDGE. */  LPC_SYSCON->STARTAPRP0 = 0x00000000;  /* Clear all wakeup source */   LPC_SYSCON->STARTRSRP0CLR = 0xFFFFFFFF;  LPC_SYSCON->STARTRSRP1CLR = 0xFFFFFFFF;  /* Enable Port 0.1 as wakeup source. */  LPC_SYSCON->STARTERP0 = 0x1<<1;  return;}
开发者ID:m3y54m,项目名称:32bitmicro,代码行数:38,


示例24: main

intmain (void){  volatile int i;  /* Basic chip initialization is taken care of in SystemInit() called   * from the startup code. SystemInit() and chip settings are defined   * in the CMSIS system_<part family>.c file.   */  /* NVIC is installed inside UARTInit file. */  UARTInit (115200, 0);  /* Initialize GPIO (sets up clock) */  GPIOInit ();  /* Set LED port pin to output */  GPIOSetDir (LED_PORT, LED_BIT, 1);  while (1)    {				/* Loop forever */      if (UARTCount != 0)	{	  LPC_UART->IER = IER_THRE | IER_RLS;	/* Disable RBR */	  UARTSend ((uint8_t *) UARTBuffer, UARTCount);	  UARTCount = 0;	  LPC_UART->IER = IER_THRE | IER_RLS | IER_RBR;	/* Re-enable RBR */	  debug_printf ("Hello World!/n");	  GPIOSetValue (LED_PORT, LED_BIT, LED_ON);	  for (i = 0; i < 10000; i++);	  GPIOSetValue (LED_PORT, LED_BIT, LED_OFF);	}    }}
开发者ID:bomma,项目名称:openbeacon,代码行数:35,


示例25: prvSetupHardware

static void prvSetupHardware( void ){	SystemCoreClockUpdate();    // enable clock to RAM1	LPC_SYSCON->SYSAHBCLKCTRL |= (1<<26);	// init GPIO	GPIOInit();	// init I2C	I2CInit(I2CMASTER);	//init ADC	ADCInit(ADC_CLK);	// init SPI ports	SSP_IOConfig( 0 );	SSP_Init( 0 );	SSP_IOConfig( 1 );	SSP_Init( 1 );	// init keyboard	CAP_KEY_Init();	// init MOSFET pin	LPC_IOCON->PIO1_25=0x90;	GPIOSetDir(PIN_MOSFET,1);}
开发者ID:ipTronix,项目名称:SmartTool,代码行数:31,


示例26: pinMode

void pinMode(int pin,pinModeState state){	if(pin < 100) return;	//(20~99:reserved)	if(pin < 200)			//maryPinAssign(100~119?)	{		pin = pin - 100;		if(state == OUTPUT)	//OUTPUT		{			GPIOSetDir(xpresso_pinAssign[pin * 2],xpresso_pinAssign[pin * 2 + 1], 1);		}else		//INPUT		{			GPIOSetDir(xpresso_pinAssign[pin * 2],xpresso_pinAssign[pin * 2 + 1], 0);		}	}	return; }
开发者ID:Penta-,项目名称:eXodusino,代码行数:17,


示例27: main

int main (void) {  uint32_t interval; SystemCoreClockUpdate();  /* Config CLKOUT, mostly used for debugging. */  CLKOUT_Setup( CLKOUTCLK_SRC_MAIN_CLK );  LPC_IOCON->PIO0_1 &= ~0x07;	  LPC_IOCON->PIO0_1 |= 0x01;		/* CLK OUT */  /* Enable AHB clock to the GPIO domain. */  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);  /* TEST_TIMER_NUM is either 0 or 1 for 16-bit timer 0 or 1. */  interval = SystemCoreClock/1000 - 1;  if ( interval > 0xFFFF )  {	interval = 0xFFFF;  }  init_timer16(TEST_TIMER_NUM, interval);  enable_timer16(TEST_TIMER_NUM);  /* Set port 2_0 to output */   GPIOSetDir( 2, 0, 1 );  while (1)                                /* Loop forever */  {#if TEST_TIMER_NUM	/* I/O configuration and LED setting pending. */	if ( (timer16_1_counter > 0) && (timer16_1_counter <= 200) )	{	  GPIOSetValue( 2, 0, 0 );	}	if ( (timer16_1_counter > 200) && (timer16_1_counter <= 400) )	{	  GPIOSetValue( 2, 0, 1 );	}	else if ( timer16_1_counter > 400 )	{	  timer16_1_counter = 0;	}#else	/* I/O configuration and LED setting pending. */	if ( (timer16_0_counter > 0) && (timer16_0_counter <= 200) )	{	  GPIOSetValue( 2, 0, 0 );	}	if ( (timer16_0_counter > 200) && (timer16_0_counter <= 400) )	{	  GPIOSetValue( 2, 0, 1 );	}	else if ( timer16_0_counter > 400 )	{	  timer16_0_counter = 0;	}#endif  }}
开发者ID:DragonWar,项目名称:RSL,代码行数:58,



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


C++ GPIOSetValue函数代码示例
C++ GPIOPinTypeUART函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。