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

C++ GPIO_SetDir函数代码示例

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

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



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


示例6: 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


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: 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


示例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


示例16: SetLineInput

void SetLineInput(void)
{
    uint8_t i;
    for(i = 0 ;i < 8;i++)
    {
        GPIO_SetDir ( KeyBoardConfig[i][0], (1<<KeyBoardConfig[i][1]), GPIO_DIRECTION_INPUT );
    }
    for(i = 0 ;i < 4;i++)
    {
        GPIO_SetDir ( KeyBoardConfig[i][0], (1<<KeyBoardConfig[i][1]), GPIO_DIRECTION_OUTPUT );
        GPIO_OutputValue ( KeyBoardConfig[i][0], (1<<KeyBoardConfig[i][1]), 0 );
    }
}
开发者ID:glocklueng,项目名称:ac_charging,代码行数:13,代码来源:Key.c


示例17: LED_Init

/*********************************************************************//**
 * @brief		Initialize LED
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void LED_Init(void)
{
	//setting two LEDs as output and turn off all
	GPIO_SetDir(PRIVILEGE_LEDPORT,(1<<PRIVILEGE_LED),1);
	GPIO_SetDir(UNPRIVILEGE_LEDPORT,(1<<UNPRIVILEGE_LED),1);
#ifdef MCB_LPC_1768
	GPIO_ClearValue(1,(1<<PRIVILEGE_LED)|(1<<UNPRIVILEGE_LED));
	GPIO_ClearValue(2,(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6));
#elif defined(IAR_LPC_1768)
	GPIO_SetValue(PRIVILEGE_LEDPORT,(1<<PRIVILEGE_LED));
	GPIO_SetValue(UNPRIVILEGE_LEDPORT,(1<<UNPRIVILEGE_LED));
#endif
}
开发者ID:m3y54m,项目名称:32bitmicro,代码行数:18,代码来源:privilege.c


示例18: CS_Init1

/*********************************************************************//**
 * @brief 		Initialize CS pin as GPIO function to drive /CS pin
 * 				due to definition of CS_PORT_NUM and CS_PORT_NUM
 * @param		None
 * @return		None
 ***********************************************************************/
void CS_Init1 (LPC_SSP_TypeDef *SSPx)
{
	if(SSPx == LPC_SSP0)
	{
		GPIO_SetDir(0, _BIT(16), 1);
		GPIO_SetValue(0, _BIT(16));
	}
	else if (SSPx == LPC_SSP1)
	{
		GPIO_SetDir(0, _BIT(6), 1);
		GPIO_SetValue(0, _BIT(6));
	}
}
开发者ID:bhavindarji,项目名称:LPC17xx-Drivers,代码行数:19,代码来源:lpc17xx_ssp.c


示例19: main

void main(void) {
	uint8_t counter = 0;
	GPIO_SetDir(LED_PORT, LED_PIN, GPIO_Output);
	GPIO_SetDir(KEY_PORT, KEY_PIN, GPIO_Input);
	GPIO_WriteOutput(LED_PORT, LED_PIN, false);
	SYSCON_StartSystick(72*200000); // 0.2s
	blinks = 0;

	while (true) {
		if (!debounced(KEY_PORT, KEY_PIN) && blinks == 0)
			blinks = counter = (counter+1)&7;
	}
}
开发者ID:modul,项目名称:anykey-sdk,代码行数:13,代码来源:main.c


示例20: jtag_init

void jtag_init(void)
{
    uint32_t i=0;

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

    puts("");
    printf("Init JTAG port pins: TDO, ");

    PinCfg.Portnum      = JTAG_TDOPORT;
    PinCfg.Pinnum       = JTAG_TDOPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TDI, ");
    PinCfg.Portnum      = JTAG_TDIPORT;
    PinCfg.Pinnum       = JTAG_TDIPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TMS, ");
    PinCfg.Portnum      = JTAG_TMSPORT;
    PinCfg.Pinnum       = JTAG_TMSPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TRST, ");
    PinCfg.Portnum      = JTAG_TRSTPORT;
    PinCfg.Pinnum       = JTAG_TRSTPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TCK - done\n");
    PinCfg.Portnum      = JTAG_TCKPORT;
    PinCfg.Pinnum       = JTAG_TCKPIN;
    PINSEL_ConfigPin(&PinCfg);

    GPIO_SetDir(JTAG_TDIPORT, JTAG_TDI, 1);
    GPIO_SetDir(JTAG_TDOPORT, JTAG_TDO, 0);
    GPIO_SetDir(JTAG_TMSPORT, JTAG_TMS, 1);
    GPIO_SetDir(JTAG_TCKPORT, JTAG_TCK, 1);
    GPIO_SetDir(JTAG_TRSTPORT, JTAG_TRST, 1);

    GPIO_ClearValue(JTAG_TDIPORT, JTAG_TDI);

    GPIO_ClearValue(JTAG_TMSPORT, JTAG_TMS);
    GPIO_ClearValue(JTAG_TCKPORT, JTAG_TCK);

    GPIO_ClearValue(JTAG_TRSTPORT, JTAG_TRST);
    GPIO_SetValue(  JTAG_TRSTPORT, JTAG_TRST);

    return;
}
开发者ID:notandy,项目名称:ddk-arm,代码行数:51,代码来源:jtag_1149.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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