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


C++ GPIODirModeSet函数代码示例

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


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

示例1: GPIOPinTypeUARTOutput

//*****************************************************************************
//
//! Configures output pin(s) for use by the UART peripheral
//!
//! \param ui32Port is the base address of the GPIO port.
//! \param ui8Pins is the bit-packed representation of the pin(s).
//!
//! The UART output pins must be properly configured for the UART peripheral to
//! function correctly.  This function provides a typical configuration for
//! those pin(s); other configurations might work as well depending upon the
//! board setup (for example, using the on-chip pull-ups).
//!
//! The pin(s) are specified using a bit-packed byte, where each bit that is
//! set identifies the pin to be accessed, and where bit 0 of the byte
//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
//!
//! \note This function cannot be used to turn any pin into a UART pin; but only
//! configures a UART pin for proper operation.
//!
//! \return None
//
//*****************************************************************************
void
GPIOPinTypeUARTOutput(uint32_t ui32Port, uint8_t ui8Pins)
{
    //
    // Check the arguments.
    //
    ASSERT(GPIOBaseValid(ui32Port));
    ASSERT(!((ui32Port == GPIO_C_BASE) && ((ui8Pins & 0xf) > 0)));

    //
    // Make the pin(s) be peripheral controlled.
    //
    GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);

    //
    // Set the pad(s) to output enable.
    //
    IOCPadConfigSet(ui32Port, ui8Pins, IOC_OVERRIDE_OE);
}
开发者ID:JKLLBF,项目名称:firmware,代码行数:41,代码来源:gpio.c

示例2: GPIOPinTypeComparator

void
GPIOPinTypeComparator(unsigned long ulPort, unsigned char ucPins)
{
    //
    // Check the arguments.
    //
    ASSERT((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));

    //
    // Make the pin(s) be inputs.
    //
    GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_IN);

    //
    // Set the pad(s) for analog operation.
    //
    GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_ANALOG);
}
开发者ID:AldenHiggins,项目名称:ELEC424-Lab06-Scheduling-with-FreeRTOS,代码行数:20,代码来源:gpio.c

示例3: GPIOPinTypeI2C

void
GPIOPinTypeI2C(unsigned long ulPort, unsigned char ucPins)
{
    //
    // Check the arguments.
    //
    ASSERT((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));

    //
    // Make the pin(s) be peripheral controlled.
    //
    GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW);

    //
    // Set the pad(s) for open-drain operation with a weak pull-up.
    //
    GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_OD_WPU);
}
开发者ID:AldenHiggins,项目名称:ELEC424-Lab06-Scheduling-with-FreeRTOS,代码行数:20,代码来源:gpio.c

示例4: GPIOPinTypeSSI

void
GPIOPinTypeSSI(unsigned long ulPort, unsigned char ucPins)
{
    //
    // Check the arguments.
    //
    ASSERT((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));

    //
    // Make the pin(s) be peripheral controlled.
    //
    GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW);

    //
    // Set the pad(s) for standard push-pull operation.
    //
    GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
}
开发者ID:AldenHiggins,项目名称:ELEC424-Lab06-Scheduling-with-FreeRTOS,代码行数:20,代码来源:gpio.c

示例5: BrakeInit

//*****************************************************************************
//
//! Initializes the dynamic braking control routines.
//!
//! This function initializes the ADC module and the control routines,
//! preparing them to monitor currents and voltages on the motor drive.
//!
//! \return None.
//
//*****************************************************************************
void
BrakeInit(void)
{
    //
    // Configure the brake control pin as an output and make it be high to
    // disable the dynamic brake.
    //
    GPIODirModeSet(PIN_BRAKE_PORT, PIN_BRAKE_PIN, GPIO_DIR_MODE_OUT);
    GPIOPinWrite(PIN_BRAKE_PORT, PIN_BRAKE_PIN, PIN_BRAKE_PIN);

    //
    // The initial brake state is off.
    //
    g_ulBrakeState = STATE_BRAKE_OFF;

    //
    // The initial brake count is zero.
    //
    g_ulBrakeCount = 0;
}
开发者ID:VENGEL,项目名称:StellarisWare,代码行数:30,代码来源:brake.c

示例6: prvSetupHardware

void prvSetupHardware( void )
{
    /* If running on Rev A2 silicon, turn the LDO voltage up to 2.75V.  This is
    a workaround to allow the PLL to operate reliably. */
    if( DEVICE_IS_REVA2 ) {
        SysCtlLDOSet( SYSCTL_LDO_2_75V );
    }

    /* Set the clocking to run from the PLL at 50 MHz */
    SysCtlClockSet( SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ );

    /* 	Enable Port F for Ethernet LEDs
    	LED0        Bit 3   Output
    	LED1        Bit 2   Output */
    SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOF );
    GPIODirModeSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_DIR_MODE_HW );
    GPIOPadConfigSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3 ), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD );

    vParTestInitialise();
}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:20,代码来源:main.c

示例7: vSerialInit

static void vSerialInit( void )
{
	/* Enable the UART.  GPIOA has already been initialised. */
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

	/* Set GPIO A0 and A1 as peripheral function.  They are used to output the
	UART signals. */
	GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW );

	/* Configure the UART for 8-N-1 operation. */
	UARTConfigSet( UART0_BASE, mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE );

	/* We dont want to use the fifo.  This is for test purposes to generate
	as many interrupts as possible. */
	HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET;

	/* Enable both Rx and Tx interrupts. */
	HWREG( UART0_BASE + UART_O_IM ) |= ( UART_INT_TX | UART_INT_RX );
	IntEnable( INT_UART0 );
}
开发者ID:dirk-brandewie,项目名称:freertos,代码行数:20,代码来源:main.c

示例8: hardware_init

//---------------------------------------------------------------------------
// hardware_init()
//
// inits GPIO pins for toggling the LED
//---------------------------------------------------------------------------
void hardware_init(void)
{

	//Set CPU Clock to 40MHz. 400MHz PLL/2 = 200 DIV 5 = 40MHz
	SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

	GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_0);            // Configuring PD0 as ADC input (channel 1)     CH7 ADC0
	GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_1);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1);

	ADCSequenceConfigure(ADC0_BASE,	1, ADC_TRIGGER_PROCESSOR, 0);
	ADCSequenceConfigure(ADC1_BASE,	1, ADC_TRIGGER_PROCESSOR, 0);

	ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH7);
	ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_CH7);
	ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_CH7);
	ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_CH7 | ADC_CTL_IE | ADC_CTL_END);

	ADCSequenceStepConfigure(ADC1_BASE, 1, 0, ADC_CTL_CH6);
	ADCSequenceStepConfigure(ADC1_BASE, 1, 1, ADC_CTL_CH6);
	ADCSequenceStepConfigure(ADC1_BASE, 1, 2, ADC_CTL_CH6);
	ADCSequenceStepConfigure(ADC1_BASE, 1, 3, ADC_CTL_CH6 | ADC_CTL_IE | ADC_CTL_END);

	ADCSequenceEnable(ADC0_BASE, 1);
	ADCSequenceEnable(ADC1_BASE, 1);
	ADCIntClear(ADC0_BASE, 1);
	ADCIntClear(ADC1_BASE, 1);

	/* Configure Buzzer pin as output */
	 GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_4);
	 GPIODirModeSet(GPIO_PORTC_BASE,GPIO_PIN_4,GPIO_DIR_MODE_OUT);
	/* Send a high output on buzzer to turn it off(inverted logic, refer
	schematic) */
	GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_4,0x10);

}
开发者ID:dealsndime,项目名称:CS684--2016,代码行数:46,代码来源:main.c

示例9: ledInit

/*FUNCTION*-------------------------------------------------------
*
* Function Name : ledInit
* Comments      :
*END*-----------------------------------------------------------*/
int ledInit(){

    /* Enabling functional clocks for GPIO1 instance. */
    GPIO1_ModuleClkConfig();
 
    /* Selecting GPIO1[23] pin for use. */
    /*GPIOPinMuxSetup(CONTROL_CONF_GPMC_A(7), CONTROL_CONF_MUXMODE(7));*/
    GetGPIOPinName();
    /* Enabling the GPIO module. */
    GPIOModuleEnable(GPIO_INSTANCE_ADDRESS);

    /* Resetting the GPIO module. */
    GPIOModuleReset(GPIO_INSTANCE_ADDRESS);

    /* Setting the GPIO pin as an output pin. */
    GPIODirModeSet(GPIO_INSTANCE_ADDRESS,
               GPIO_INSTANCE_PIN_NUMBER,
               DIR_OUTPUT);
    
    return(0);

}
开发者ID:ErickBhrener,项目名称:embarcado-lib,代码行数:27,代码来源:gpioLED.c

示例10: Init

static void Init(void)
{
	// if already passed initialization, return
	if(isInitialized)
		return;

	// enable peripheral clock
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

	// setup multiplexer
	GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_DIR_MODE_OUT);
	GPIOPadConfigSet( GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD );
	GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, 0xFF);


	// set gpio pins to hardware used mode
	GPIOPinTypeUART(SERIALPORT_PORT_BASE, SERIALPORT_PINS);
	GPIOIntTypeSet(SERIALPORT_PORT_BASE, SERIALPORT_PINS, GPIO_DIR_MODE_HW);

	// initialization complete
	isInitialized = true;
}
开发者ID:Arseni,项目名称:Studienarbeit,代码行数:23,代码来源:comport.c

示例11: setup

void setup(){

	SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
	SysCtlPWMClockSet(SYSCTL_PWMDIV_64);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

	ROM_GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
	ROM_GPIOPinConfigure(GPIO_PF1_M1PWM5);
	ROM_GPIOPinConfigure(GPIO_PF2_M1PWM6);
	ROM_GPIOPinConfigure(GPIO_PF3_M1PWM7);

	HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
	HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01;
	HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0;

	GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_4|GPIO_PIN_0, GPIO_DIR_MODE_IN);
	GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4|GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);



}
开发者ID:dipteshkanojia,项目名称:CS684-2016,代码行数:23,代码来源:main.c

示例12: configWakeGpio

void configWakeGpio()
{
	/* Enabling the GPIO module. */
	GPIOModuleEnable(GPIO_WAKE_INSTANCE);
	
	/* Perform a module reset of the GPIO module. */
    //GPIOModuleReset(GPIO_WAKE_INSTANCE);
	
	/* Set the specified pin as an Input pin. */
    GPIODirModeSet(GPIO_WAKE_INSTANCE,
                   GPIO_WAKE_PIN_NUM,
                   GPIO_DIR_INPUT);
				   
	GPIOIntTypeSet(GPIO_WAKE_INSTANCE,
					GPIO_WAKE_PIN_NUM,
					GPIO_INT_TYPE_BOTH_EDGE);
					
	HWREG(GPIO_WAKE_INSTANCE + 0x34) = 0x40000000;
	HWREG(GPIO_WAKE_INSTANCE + 0x38) = 0x40000000;
	
	HWREG(GPIO_WAKE_INSTANCE + 0x44) = 0x40000000;
	
}
开发者ID:OS-Project,项目名称:Divers,代码行数:23,代码来源:demoGpio.c

示例13: main

int main(void)
{
    /* unsigned int count = 0; */

    /* Configuring the functional clock for GPIO0 instance. */
    GPIO0ModuleClkConfig();

    /* Doing a pin multiplexing and selecting GPIO0[7] for use. */    
    GPIO0Pin7PinMuxSetup();

    /* Enabling the GPIO module. */
    GPIOModuleEnable(SOC_GPIO_0_REGS);

    /* Resetting the GPIO module. */
    GPIOModuleReset(SOC_GPIO_0_REGS);

    /* Configuring GPIO0[7] pin as an output pin. */ 
    GPIODirModeSet(SOC_GPIO_0_REGS,
                   GPIO_INSTANCE_PIN_NUMBER,
                   GPIO_DIR_OUTPUT);
    while(1)
    {
        /* Driving GPIO0[7] pin to logic HIGH. */    
        GPIOPinWrite(SOC_GPIO_0_REGS,
                     GPIO_INSTANCE_PIN_NUMBER,
                     GPIO_PIN_HIGH);

        Delay(0xFFFFF);

        /* Driving GPIO0[7] pin to logic LOW. */
        GPIOPinWrite(SOC_GPIO_0_REGS,
                     GPIO_INSTANCE_PIN_NUMBER,
                     GPIO_PIN_LOW);
        
        Delay(0xFFFFF);
    }
}
开发者ID:OS-Project,项目名称:Divers,代码行数:37,代码来源:gpioLCDBacklight.c

示例14: PinMuxConfig

//*****************************************************************************
void PinMuxConfig(void)
{
    //
    // Enable Peripheral Clocks 
    //
    PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
    PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);

    //
    // Configure PIN_55 for UART0 UART0_TX
    //
    PinTypeUART(PIN_55, PIN_MODE_3);

    //
    // Configure PIN_57 for UART0 UART0_RX
    //
    PinTypeUART(PIN_57, PIN_MODE_3);

    //
    // Configure PIN_08 for GPIO Input
    //
    PinTypeGPIO(PIN_08, PIN_MODE_0, false);
    GPIODirModeSet(GPIOA2_BASE, 0x2, GPIO_DIR_MODE_IN);
}
开发者ID:Eterneco,项目名称:iot_postbox,代码行数:25,代码来源:pin_mux_config.c

示例15: vSerialInit

void vSerialInit( void )
{
	/* Create the queue used to communicate between the UART ISR and the Comms
	Rx task. */
	xCommsQueue = xQueueCreate( commsRX_QUEUE_LEN, sizeof( portCHAR ) );

	/* Enable the UART.  GPIOA has already been initialised. */
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

	/* Set GPIO A0 and A1 as peripheral function.  They are used to output the
	UART signals. */
	GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW );

	/* Configure the UART for 8-N-1 operation. */
	UARTConfigSet( UART0_BASE, commsBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE );

	/* We dont want to use the fifo.  This is for test purposes to generate
	as many interrupts as possible. */
	HWREG( UART0_BASE + UART_O_LCR_H ) &= ~commsFIFO_SET;

	/* Enable both Rx and Tx interrupts. */
	HWREG( UART0_BASE + UART_O_IM ) |= ( UART_INT_TX | UART_INT_RX );
	IntEnable( INT_UART0 );
}
开发者ID:Paolo-Maffei,项目名称:nxstack,代码行数:24,代码来源:commstest.c


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