當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。