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


C++ GPIO_SetDir函数代码示例

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


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

示例1: rgb_init

/******************************************************************************
 *
 * Description:
 *    Initialize RGB driver
 *
 *****************************************************************************/
void rgb_init (void)
{
    GPIO_SetDir( 2, 0, 1 );
    GPIO_SetDir( 0, (1<<26), 1 );
    GPIO_SetDir( 2, (1<<1), 1 );

}
开发者ID:ebtaleb,项目名称:LPC1769Probe,代码行数:13,代码来源:rgb.c

示例2: SetupHardware

/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
	PINSEL_CFG_Type PinCfg;

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 2;
	PinCfg.Pinnum = 10;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 11;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 12;
	PINSEL_ConfigPin(&PinCfg);

    /* is Input */
    GPIO_SetDir(2, (1<<10), 0);
    GPIO_SetDir(2, (1<<11), 0);
    GPIO_SetDir(2, (1<<12), 0);

	/* Enable system update tick timer */
	GPIO_SetDir(LED1_GPIO_PORT_NUM,(1<<LED1_GPIO_BIT_NUM),1); // output
	GPIO_SetDir(LED2_GPIO_PORT_NUM,(1<<LED2_GPIO_BIT_NUM),1); // output

	init_timer( 0, TIMER0_INTERVAL );

	Serial_Init(115200, false);
	LEDs_Init();
	USB_Init();

	/* Create a stdio stream for the serial port for stdin and stdout */
	Serial_CreateStream(NULL);

	//USB_Init();
}
开发者ID:Martin-P,项目名称:lpc1768-control-bluetooth-dongle,代码行数:36,代码来源:BluetoothRobot.c

示例3: board_init

void board_init(void)
{
  SystemInit();
  CGU_Init();
	SysTick_Config( CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/CFG_TICKS_PER_SECOND );	/* 1 ms Timer */

	//------------- USB Bus power HOST ONLY-------------//
	scu_pinmux(0x1, 7, MD_PUP | MD_EZI, FUNC4);	// P1_7 USB0_PWR_EN, USB0 VBus function Xplorer

	scu_pinmux(0x2, 6, MD_PUP | MD_EZI, FUNC4); // P2_6 is configured as GPIO5[6] for USB1_PWR_EN
	GPIO_SetDir   (5, BIT_(6), 1);              // GPIO5[6] is output
	GPIO_SetValue (5, BIT_(6));                 // GPIO5[6] output high

	// Leds Init
	for (uint8_t i=0; i<BOARD_MAX_LEDS; i++)
	{
	  scu_pinmux(leds[i].port, leds[i].pin, MD_PUP|MD_EZI|MD_ZI, FUNC0);
	  GPIO_SetDir(leds[i].port, BIT_(leds[i].pin), 1); // output
	}

#if CFG_UART_ENABLE
	//------------- UART init -------------//
	UART_CFG_Type UARTConfigStruct;

	scu_pinmux(0x6 ,4, MD_PDN|MD_EZI, FUNC2); 	// UART0_TXD
	scu_pinmux(0x6 ,5, MD_PDN|MD_EZI, FUNC2); 	// UART0_RXD

	UART_ConfigStructInit(&UARTConfigStruct);                   // default: baud = 9600, 8 bit data, 1 stop bit, no parity
	UARTConfigStruct.Baud_rate = CFG_UART_BAUDRATE;             // Re-configure baudrate

	UART_Init((LPC_USARTn_Type*) LPC_USART0, &UARTConfigStruct); // Initialize UART port
	UART_TxCmd((LPC_USARTn_Type*) LPC_USART0, ENABLE);           // Enable UART
#endif

}
开发者ID:Blackclaws,项目名称:tinyusb,代码行数:35,代码来源:board_ngx4330.c

示例4: allPinsAsOut

static void allPinsAsOut(void)
{
	GPIO_SetDir(0, 0x0FFFFFFFF, 1);
	GPIO_SetDir(1, 0x0FFFFFFFF, 1);
	GPIO_SetDir(3, 0x0FFFFFFFF, 1);
	GPIO_SetDir(4, 0x0FFFFFFFF, 1);
}
开发者ID:qermit,项目名称:aprs-firmware,代码行数:7,代码来源:main.c

示例5: TP_Init

/*******************************************************************************
* Function Name  : TP_Init
* Description    : TSC2046 Initialization
* Input          : None
* Output         : None
* Return         : None
* Attention		 : None
*******************************************************************************/
void TP_Init(void) 
{
    SSP_CFG_Type SSP_ConfigStruct;
	/*
	 * Initialize SPI pin connect
	 * P2.23 - TP_CS - used as GPIO
	 * P2.22 - SCK
	 * P2.26 - MISO
	 * P2.27 - MOSI
	 */

	PINSEL_ConfigPin(2, 23, 0);
	PINSEL_ConfigPin(2, 22, 2);
	PINSEL_ConfigPin(2, 26, 2);
	PINSEL_ConfigPin(2, 27, 2);

    /* P0.16 CS is output */
    GPIO_SetDir(TP_CS_PORT_NUM, (1<<TP_CS_PIN_NUM), 1);
	GPIO_SetValue(TP_CS_PORT_NUM, (1<<TP_CS_PIN_NUM));  

  	PINSEL_ConfigPin(2, 11, 0);	  
	GPIO_SetDir(2, (1<<11), 0);	  /* P2.11 TP_INT is input */

	/* initialize SSP configuration structure to default */
	SSP_ConfigStructInit(&SSP_ConfigStruct);

	SSP_ConfigStruct.ClockRate = 250000;
	SSP_ConfigStruct.CPHA = SSP_CPHA_FIRST;	   //SSP_CPHA_SECOND   SSP_CPHA_FIRST
	SSP_ConfigStruct.CPOL = SSP_CPOL_HI;		  //SSP_CPOL_LO	  SSP_CPOL_HI

	/* Initialize SSP peripheral with parameter given in structure above */
	SSP_Init(LPC_SSP0, &SSP_ConfigStruct);
	/* Enable SSP peripheral */
	SSP_Cmd(LPC_SSP0, ENABLE);
}
开发者ID:orochigalois,项目名称:TestBox,代码行数:43,代码来源:TouchPanel.c

示例6: btn_init

/******************************************************************************
 *
 * Description:
 *    Initialize Buttons driver
 *
 *****************************************************************************/
void btn_init (void)
{
    // SW2
    GPIO_SetDir( 2, (1<<11), 0 );
    // SW3
    GPIO_SetDir( 2, (1<<12), 0 );
}
开发者ID:ferraith,项目名称:platform_aoaa,代码行数:13,代码来源:btn.c

示例7: Init_LCD_Pins

void Init_LCD_Pins(void)
{
    // Configure other pins used by the ILI9341 LCD
    // P0.2 = CS, P0.3 = Reset, P0.21 = DC
    PINSEL_CFG_Type LCDPin;
    LCDPin.Portnum = LCD_CS_PORT;
    LCDPin.Pinnum = LCD_CS_PIN;
    LCDPin.Funcnum = PINSEL_FUNC_0; // Use as GPIO
    LCDPin.OpenDrain = PINSEL_PINMODE_NORMAL;
    LCDPin.Pinmode = PINSEL_PINMODE_PULLUP;
    PINSEL_ConfigPin(&LCDPin);
    LCDPin.Portnum = LCD_RESET_PORT;
    LCDPin.Pinnum = LCD_RESET_PIN;
    PINSEL_ConfigPin(&LCDPin);
    LCDPin.Portnum = LCD_DC_PORT;
    LCDPin.Pinnum = LCD_DC_PIN;
    PINSEL_ConfigPin(&LCDPin);

    // Declare LCD pins as output, disable pin masking
    GPIO_SetDir(LCD_CS_PORT, (1 << LCD_CS_PIN), GPIO_DIR_OUTPUT); 	// CS
    GPIO_SetDir(LCD_RESET_PORT, (1 << LCD_RESET_PIN), GPIO_DIR_OUTPUT); 	// Reset
    GPIO_SetDir(LCD_DC_PORT, (1 << LCD_DC_PIN), GPIO_DIR_OUTPUT); 	// DC

    // Initialize CS to 1
	LCD_CS(1);
}
开发者ID:vpcola,项目名称:LPC1769_NYP,代码行数:26,代码来源:LCD.c

示例8: ads7843_init

void ads7843_init(void)
{
	SSP_CFG_Type SSP_ConfigStruct;
	
  CONFIG_TS_PENIRQ;

	scu_pinmux(0x3,3,MD_PLN_FAST,FUNC2);	// P3.3 connected to SCL/SCLK	func2=SSP0 SCK0
// 	scu_pinmux(0x9,0,MD_PLN_FAST,FUNC7);	// P9.0 connected to nCS		func2=SSP0 SSEL0
 	scu_pinmux(0x9,0,MD_PLN_FAST | MD_EZI,FUNC0);	
	GPIO_SetDir(4,1<<12,1);
	
 	scu_pinmux(0x3,6,MD_PLN_FAST | MD_EZI,FUNC5);	// P3.6 connected to SO			func2=SSP0 MISO0
	GPIO_SetDir(0,1<<6,0);
	
 	scu_pinmux(0x3,7,MD_PLN_FAST ,FUNC5);	// P3.7 connected to nSI		func2=SSP0 MOSI0
// initialize SSP configuration structure to default
	SSP_ConfigStructInit(&SSP_ConfigStruct);
	SSP_ConfigStruct.ClockRate = 100000;
	SSP_ConfigStruct.Databit = SSP_DATABIT_8;
	// Initialize SSP peripheral with parameter given in structure above
	SSP_Init(LPC_SSP0, &SSP_ConfigStruct);

	// Enable SSP peripheral
	SSP_Cmd(LPC_SSP0, ENABLE);
}
开发者ID:JingoC,项目名称:LCD_DISPLAY,代码行数:25,代码来源:ads7843.c

示例9: LED_Init

void LED_Init (void)
{
	PINSEL_CFG_Type PinCfg;

	uint8_t temp;

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 2;
	for (temp = 2; temp <= 6; temp++){
		PinCfg.Pinnum = temp;
		PINSEL_ConfigPin(&PinCfg);
	}

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 1;
	PinCfg.Pinnum = 28;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 29;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 31;
	PINSEL_ConfigPin(&PinCfg);

	// Set direction to output
	GPIO_SetDir(2, LED2_MASK, 1);
	GPIO_SetDir(1, LED1_MASK, 1);

	/* Turn off all LEDs */
	GPIO_ClearValue(2, LED2_MASK);
	GPIO_ClearValue(1, LED1_MASK);
}
开发者ID:Frehner1,项目名称:CMSIS_LPC17xx,代码行数:34,代码来源:main.c

示例10: io_init_fpga_pwrenable

/* enable FPGA EN_CORE and EN_IO */
void io_init_fpga_pwrenable(void)
{
    uint32_t i=0;

    PinCfg.Funcnum      = 0;
    PinCfg.OpenDrain    = 0;
    PinCfg.Pinmode      = 0;


    // 1V5 core voltage
    PinCfg.Pinnum       = FPGA_CORE_EN_PIN;
    PinCfg.Portnum      = FPGA_CORE_EN_PORT;
    PINSEL_ConfigPin(&PinCfg);
    GPIO_SetDir(FPGA_CORE_EN_PORT, FPGA_CORE_EN, POUT);
    fpga_pwr_enable_core_low();

    // 3V3 IO voltage
    PinCfg.Pinnum       = FPGA_IO_EN_PIN;
    PinCfg.Portnum      = FPGA_IO_EN_PORT;
    PINSEL_ConfigPin(&PinCfg);
    GPIO_SetDir(FPGA_IO_EN_PORT, FPGA_IO_EN, POUT);
    fpga_pwr_enable_io_low();

    return;
}
开发者ID:Meddington,项目名称:deja-ddk-glitch,代码行数:26,代码来源:io.c

示例11: LEDs_Init

void LEDs_Init(void)
{
    GPIO_SetDir(LED1_GPIO_PORT_NUM,(1<<LED1_GPIO_BIT_NUM),1); // output
    GPIO_SetDir(LED2_GPIO_PORT_NUM,(1<<LED2_GPIO_BIT_NUM),1); // output
    GPIO_SetDir(LED3_GPIO_PORT_NUM,(1<<LED3_GPIO_BIT_NUM),1); // output
    GPIO_SetDir(LED4_GPIO_PORT_NUM,(1<<LED4_GPIO_BIT_NUM),1); // output
}
开发者ID:openxc,项目名称:nxp-bsp,代码行数:7,代码来源:bsp_MCB1800_4300.c

示例12: led_set

/** \brief  Set the HITEX1850 module red LED to an on or off state
 *
 *  This function sets the LED to an on or off state for the board.
 *  See CTOUT2.
 *
 *  \param [in]      state  New LED state, 0 = off, !0 = on
 */
void led_set(s32_t state)
{
	/* Only red component is used, set to input to disable, or
	   output drive low to enable */
	if (state)
		GPIO_SetDir(LED_GPIO_PORT_USED, (1 << DEFAULT_COLOR_PIN_BIT), 1);
	else
		GPIO_SetDir(LED_GPIO_PORT_USED, (1 << DEFAULT_COLOR_PIN_BIT), 0);
}
开发者ID:10code,项目名称:lwip,代码行数:16,代码来源:hitex4350_board.c

示例13: buttonsInit

void buttonsInit()
{
	GPIO_SetDir(0, 0, GPIO_DIR_INPUT);
	GPIO_SetDir(0, 1, GPIO_DIR_INPUT);
	
	buttonsState.button1pressed = false;
	buttonsState.button2pressed = false;
	
	loadUtcOffsetFromFlash();
}
开发者ID:maximvarentsov,项目名称:eclock,代码行数:10,代码来源:buttons.c

示例14: led_init

void led_init(void)
{
    // 2.3 
    // 2.4 
    // 0.27 
    // 2.6
    
    GPIO_SetDir(4, (1<<22), 1);
    GPIO_SetDir(4, (1<<23), 1);
    GPIO_SetDir(4, (1<<26), 1);
    GPIO_SetDir(4, (1<<27), 1);
}
开发者ID:franklin373,项目名称:th_lpc_ucos,代码行数:12,代码来源:task7.c

示例15: vtInitLED

void vtInitLED()
{
    /* LEDs on ports 1 and 2 to output (1). */
    // Note that all LED access is through the proper LPC library calls
    GPIO_SetDir(1,partstFIO1_BITS,1);
    GPIO_SetDir(2,partstFIO2_BITS,1);

    /* Start will all LEDs off. */
    GPIO_ClearValue(1,partstFIO1_BITS);
    GPIO_ClearValue(2,partstFIO2_BITS);

}
开发者ID:ECEEmbedded,项目名称:ARMCode_vIntegration,代码行数:12,代码来源:vtUtilities.c


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