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

C++ GPIODirModeSet函数代码示例

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

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



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


示例16: SCCBTick

void SCCBTick(void){
	static unsigned char quarter=0;
 	if(SCCBMaster.state==SCCB_READ){
		switch(quarter){
			case 0:

				break;
			case 1:
				GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sclGpio,0);
				break;
			case 2:
//acknowledge byte
				if(SCCBMaster.currentBit<2){
					GPIODirModeSet(SCCBMaster.GpioBase,SCCBMaster.sdaGpio,GPIO_DIR_MODE_OUT);
					GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sdaGpio,0);
				}
				else{
					SCCBMaster.byteRegister=SCCBMaster.byteRegister<<1;
					if(GPIOPinRead(SCCBMaster.GpioBase,SCCBMaster.sdaGpio)){
						SCCBMaster.byteRegister++;
					}
				}
				break;
			case 3:
				GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sclGpio,SCCBMaster.sclGpio);
				if(SCCBMaster.currentBit==1)quarter=0;
				SCCBMaster.currentBit--;
				break;
		}

	}

	else{

		switch(quarter){
			case 0:
				//first bit sda goes low
				//
				break;
			case 1:
				//clock goes low
				GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sclGpio,0);
				break;
			case 2:
				//read/write bit to write
				if(SCCBMaster.currentBit==1){
					GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sdaGpio,0);
				}
				else{
					GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sdaGpio,SCCBMaster.byteRegister&256?SCCBMaster.sdaGpio:0);
				}
				break;
			case 3:
				//clock goes high
				GPIOPinWrite(SCCBMaster.GpioBase, SCCBMaster.sclGpio,255);
				//last bit is finished
				SCCBMaster.byteRegister=SCCBMaster.byteRegister<<1;
				if(SCCBMaster.currentBit==1)quarter=0;
				SCCBMaster.currentBit--;
				break;
		}
	}
	quarter++;
	if(quarter>3)quarter=0;
}
开发者ID:Robotonics,项目名称:tinkering,代码行数:65,代码来源:softsccb.c


示例17: GPIODirModeSet

	/**
	 * Set pin mode to input
	 */
	void DigitalIOPin::Input(void)
	{
		GPIODirModeSet(this->port, this->pin, GPIO_DIR_MODE_IN);
	}
开发者ID:MrDoomBringer,项目名称:stellaris-pins,代码行数:7,代码来源:DigitalIOPin.cpp


示例18: softwareControlEthernetLeds

void softwareControlEthernetLeds()
{
    GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_3, GPIO_DIR_MODE_OUT);
}
开发者ID:vtoanb,项目名称:msp430lioamaintain,代码行数:4,代码来源:hal_gw1.c


示例19: portInit


//.........这里部分代码省略.........
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles
    /* Outputs */
    GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, (GPIO_PIN_4 | GPIO_PIN_5));
    //GPIOPadConfigSet(GPIO_PORTC_BASE, (GPIO_PIN_4 | GPIO_PIN_5), GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);


    /* Port D
     * PD0      Spare 0
     * PD1
     * PD2      Spare Rx
     * PD3      Spare Tx
     * PD4
     * PD5      Module Reset
     * PD6      SRDY
     * PD7
     */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);  //FOR Module CONTROL
    SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles
    /* Outputs */
    GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_5);
    //GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_5, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
    /* Inputs */
    GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_6);


    RADIO_OFF();
    SPI_SS_CLEAR();

    /* Port E
     * PE0      Spare
     * PE1      Spare
     * PE2      Spare
     * PE3      Internal button
     */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles
    /* Inputs */
    GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_3 , GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPD);
    GPIODirModeSet(GPIO_PORTE_BASE, GPIO_PIN_3, GPIO_DIR_MODE_IN);
    GPIOIntTypeSet(GPIO_PORTE_BASE, GPIO_PIN_3, GPIO_RISING_EDGE); // Make button a falling-edge triggered interrupt
    GPIOPinIntEnable(GPIO_PORTE_BASE, GPIO_PIN_3);                  // Enable the interrupt on this pin
    GPIOPinIntClear(GPIO_PORTE_BASE, GPIO_PIN_3);                   //Clear interrupts
    IntEnable(INT_GPIOE);                                           //enable interrupt 18

    /* Port F
     * PF0      Internal LED0 - "D1" Red
     * PF1      External button
     * PF2		Ethernet LED1 (Rx or Tx Activity)
     * PF3		Ethernet LED0 (Link Ok)
     */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles
    /* Outputs */
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0);  //configure LED
    /* Inputs */
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1 , GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPD);
    GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN);
    GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_RISING_EDGE); // Make button a falling-edge triggered interrupt
    GPIOPinIntEnable(GPIO_PORTF_BASE, GPIO_PIN_1);                  // Enable the interrupt on this pin
    GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1);                   //Clear interrupts
    IntEnable(INT_GPIOF);                                           //enable interrupt 18
    /* Ethernet LEDs */
    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);

    return;

    /* Port G
     * PG0      UART2 Rx
     * PG1      UART2 Tx
     */
#ifdef USE_UART2
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
    SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    SysCtlDelay(10); //delay by (3 * 10) 30 clock cycles

    GPIOPinTypeUART(GPIO_PORTG_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    // Configure the UART for 115,200, 8-N-1 operation.
    //UARTConfigSetExpClk(UART2_BASE, SysCtlClockGet(), 115200,
    //		(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
    // Enable the UART interrupt.
    IntEnable(INT_UART2);

    UARTIntEnable(UART2_BASE, UART_INT_RX | UART_INT_RT);
    //UARTStdioInit(2);  //configures this UART0 as the uart to use for UARTprintf
#else
    //SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    /* already done in port A
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    // If interrupts are desired, then enable interrupts on this UART
    IntEnable(INT_UART0);
    UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
    UARTStdioInit(0);  //configures this UART0 as the uart to use for UARTprintf
    */
#endif

}
开发者ID:vtoanb,项目名称:msp430lioamaintain,代码行数:101,代码来源:hal_gw1.c


示例20: UIInit

//*****************************************************************************
//
//! Initializes the user interface.
//!
//! This function initializes the user interface modules (on-board and serial),
//! preparing them to operate and control the motor drive.
//!
//! \return None.
//
//*****************************************************************************
void
UIInit(void)
{
    unsigned long ulSysTickVal;

    //
    // Enable the GPIO peripherals needed for the button and LEDs
    //
    SysCtlPeripheralEnable(USER_BUTTON_GPIO_PERIPH);
    SysCtlPeripheralEnable(LED_GPIO_PERIPH);

    //
    // Set up button GPIO as input, and LEDs as outputs, and turn them off
    //
    GPIODirModeSet(USER_BUTTON_PORT, USER_BUTTON_PIN, GPIO_DIR_MODE_IN);
    GPIODirModeSet(STATUS_LED_PORT, STATUS_LED_PIN, GPIO_DIR_MODE_OUT);
    GPIODirModeSet(MODE_LED_PORT, MODE_LED_PIN, GPIO_DIR_MODE_OUT);
    GPIOPinWrite(STATUS_LED_PORT, STATUS_LED_PIN, 0);
    GPIOPinWrite(MODE_LED_PORT, MODE_LED_PIN, 0);

    //
    // Set up the LED blinking function
    //
    BlinkInit(STATUS_LED, STATUS_LED_PORT, STATUS_LED_PIN);
    BlinkInit(MODE_LED, MODE_LED_PORT, MODE_LED_PIN);
    BlinkStart(MODE_LED, UI_INT_RATE / 2, UI_INT_RATE / 2, eUIMode + 1);

    //
    // Enable the ADC peripheral, needed for potentiometer
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_ADC0);

    //
    // Set the ADC to run at the maximum rate of 500 ksamples.
    //
    HWREG(SYSCTL_RCGC0) |= 0x00000200;
    HWREG(SYSCTL_SCGC0) |= 0x00000200;

    //
    // Program sequencer for collecting ADC sample for potentiometer
    // position, bus voltage, and temperature sensor.
    //
    ADCSequenceConfigure(ADC0_BASE, UI_ADC_SEQUENCER, ADC_TRIGGER_PROCESSOR,
                         UI_ADC_PRIORITY);
    ADCSequenceStepConfigure(ADC0_BASE, UI_ADC_SEQUENCER, 0, POT_ADC_CHAN);
    ADCSequenceStepConfigure(ADC0_BASE, UI_ADC_SEQUENCER, 1, BUSV_ADC_CHAN);
    ADCSequenceStepConfigure(ADC0_BASE, UI_ADC_SEQUENCER, 2,
                             ADC_CTL_TS | ADC_CTL_END);
    ADCSequenceEnable(ADC0_BASE, UI_ADC_SEQUENCER);
    ADCProcessorTrigger(ADC0_BASE, UI_ADC_SEQUENCER);   // take initial sample

    //
    // initialize the lower level,
    // positioner, which handles computing all the motion control
    //
    StepperInit();

    //
    // Get a pointer to the stepper status.
    //
    pStepperStatus = StepperGetMotorStatus();

    //
    // Force an update of all the parameters (sets defaults).
    //
    UISetPWMFreq();
    UISetChopperBlanking();
    UISetMotorParms();
    UISetControlMode();
    UISetDecayMode();
    UISetStepMode();
    UISetFixedOnTime();

    //
    // Initialize the flash parameter block driver.
    //
    FlashPBInit(FLASH_PB_START, FLASH_PB_END, FLASH_PB_SIZE);

    //
    // Initialize the serial user interface.
    //
    UISerialInit();
    IntPrioritySet(INT_UART0, UI_SER_INT_PRI);

    //
    // Make sure that the UART doesnt get put to sleep
    //
    SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART0);

//.........这里部分代码省略.........
开发者ID:VENGEL,项目名称:StellarisWare,代码行数:101,代码来源:ui.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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