本文整理汇总了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 );
}
示例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();
}
示例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
}
示例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);
}
示例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);
}
示例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 );
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}