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


C++ GPIOPinIntEnable函数代码示例

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


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

示例1: main

void main(void)
	{
	SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

	GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_1);
	GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);

	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0); /* led */

    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
    GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);

	GPIOIntTypeSet(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, GPIO_RISING_EDGE);
	GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_RISING_EDGE);

	GPIOPinIntEnable(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
	GPIOPinIntEnable(GPIO_PORTF_BASE, GPIO_PIN_1);

	IntMasterEnable();
    IntEnable(INT_GPIOE);
    IntEnable(INT_GPIOF);
    GPIOPinIntClear(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
    GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1);
    while(1)
    	{
    	}
	}
开发者ID:jeremiaslehmann,项目名称:IntGPIO,代码行数:29,代码来源:main.c

示例2: initYaw

// *****************************************************************************
void initYaw (void)
{
    // Register the handler for Port F into the vector table
    GPIOPortIntRegister (GPIO_PORTF_BASE, YawChangeIntHandler);

    // Enable and configure the port and pin used:  input on PF5: Pin 27 & PF7: Pin 29
    SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOF);
    GPIOPadConfigSet (GPIO_PORTF_BASE, GPIO_PIN_5 | GPIO_PIN_7, GPIO_STRENGTH_2MA,
       GPIO_PIN_TYPE_STD_WPU);

    // Set up the pin change interrupt (both edges)
    GPIOIntTypeSet (GPIO_PORTF_BASE, GPIO_PIN_5 | GPIO_PIN_7, GPIO_BOTH_EDGES);

    // Enable the pin change interrupt
    GPIOPinIntEnable (GPIO_PORTF_BASE, GPIO_PIN_5 | GPIO_PIN_7);
    IntEnable (INT_GPIOF);	// Note: INT_GPIOF defined in inc/hw_ints.h

    //Registering Port D into the vector Table (Refwewnce point)
    GPIOPortIntRegister (GPIO_PORTD_BASE, referencePosIntHandler);

    GPIOPadConfigSet (GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
	//
	// Set up the pin change interrupt (both edges)
    GPIOIntTypeSet (GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_BOTH_EDGES);
    //
    // Enable the pin change interrupt for PD0
    GPIOPinIntEnable (GPIO_PORTD_BASE, GPIO_PIN_0);

}
开发者ID:Yamoahs,项目名称:ENCE361_Helicopter_project,代码行数:30,代码来源:milestone2_MotorControl(PID)3.c

示例3: setup

void setup(void){
	//Enable the driver layer
	SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
	                       SYSCTL_XTAL_16MHZ);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

	//Pinout connections:
	//
	GPIOPinTypeGPIOInput(GPIO_PORTA_BASE,GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
	GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, GPIO_STRENGTH_2MA,
	                     GPIO_PIN_TYPE_STD_WPU);
	GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7,GPIO_FALLING_EDGE);
	GPIOPinTypeGPIOInput(GPIO_PORTB_BASE,GPIO_PIN_4);
	GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA,
		                     GPIO_PIN_TYPE_STD_WPU);
	GPIOIntTypeSet(GPIO_PORTB_BASE,GPIO_PIN_4,GPIO_FALLING_EDGE);
	GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE,GPIO_PIN_5|GPIO_PIN_4);
	GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_1|GPIO_PIN_0);
	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE,GPIO_PIN_2|GPIO_PIN_1|GPIO_PIN_3);

	GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
	GPIOPinIntEnable(GPIO_PORTB_BASE,GPIO_PIN_4);
	IntMasterEnable();
	IntEnable(INT_GPIOA);
	IntEnable(INT_GPIOB);
	GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0, 0);
	GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_1, 0);
	GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_4, 0);
	GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_5, 0);

}
开发者ID:dmanchon,项目名称:stellaris-launchpad-keypad-4x4,代码行数:35,代码来源:usb_dev_keyboard.c

示例4: GPIO_SetInterruptTask

// *************** GPIO_SetInterruptTask *************** 					
void GPIO_SetInterruptTask( GPIO_PORT_T port, GPIO_PIN_T pins,
                            unsigned long int_type, unsigned long priority, 
							void (*task)( void ) )
{
	unsigned long port_base = GPIO_PortBase[port];

	// Set the interrupt task for the specified port and pins
	if     ( pins & 0x01 ) GPIO_PinISR[port][0] = task;
	else if( pins & 0x02 ) GPIO_PinISR[port][1] = task; 
	else if( pins & 0x04 ) GPIO_PinISR[port][2] = task;
	else if( pins & 0x08 ) GPIO_PinISR[port][3] = task;
	else if( pins & 0x10 ) GPIO_PinISR[port][4] = task;
	else if( pins & 0x20 ) GPIO_PinISR[port][5] = task;
	else if( pins & 0x40 ) GPIO_PinISR[port][6] = task;
	else if( pins & 0x80 ) GPIO_PinISR[port][7] = task;

	// Set the event type and priority, and clear the interrupt
	IntPrioritySet( GPIO_IntAssignment[port], priority );	 
	GPIOIntTypeSet( port_base, pins, int_type );
	GPIOPinIntClear( port_base, pins);

	// Enable interrupts
	IntEnable( GPIO_IntAssignment[port] );
 	GPIOPinIntEnable( port_base, pins );
}
开发者ID:yguo89,项目名称:CodeBrain,代码行数:26,代码来源:GPIO_Driver.c

示例5: Transceiver_ReceiveMessage

/******** Transceiver_receiveMessage *****************************************
// dequeue transceiver packet
// Input: 
//	  *pkt - pointer to received message 
// Output: status
// ------------------------------------------------------------------------*/
unsigned char Transceiver_ReceiveMessage ( TransceiverPacket *pkt )
{
	unsigned char rx[TRANSCEIVER_MAX_PAYLOAD];
	unsigned char index;
	unsigned char status = SUCCESS;

	GPIOPinIntDisable ( nrf24l01_IRQ_IOREGISTER, nrf24l01_IRQ_PIN );
	if ( pdPASS == xQueueReceive(Transceiver_RX_Queue, rx, (portTickType)0) )
	{
		pkt->srcID = rx[SOURCE_ID_INDEX];
		pkt->destID = rx[DEST_ID_INDEX];
		pkt->msgID = rx[MSG_ID_INDEX];
		pkt->dataSize = rx[DATA_SIZE_INDEX];
		for ( index = 0; index < pkt->dataSize; index++ )
		{
			pkt->data[index] = rx[index+PACKET_HEADER_SIZE];
		}
		Debug_NetworkTransceiver_PrintPacket(pkt);
	}
	else
	{
		// empty queue
		status = ERROR_QUEUE_EMPTY;
		Debug_Printf ("Transceiver_ReceiveMessage 0x%x\n", status);
		if ( EmptyQueueCallBack != NULL )
			xTaskCreate( Transceiver_EmptyQueueCallBack, ( signed portCHAR * ) "Transceiver_EmptyQueueCallBack", 
				 DEFAULT_STACK_SIZE, NULL, DEFAULT_PRIORITY, NULL );
	}

	GPIOPinIntEnable ( nrf24l01_IRQ_IOREGISTER, nrf24l01_IRQ_PIN );

	return status;
}
开发者ID:yguo89,项目名称:CodeBrain,代码行数:39,代码来源:Transceiver.c

示例6: ctl_buttons_isr_init

//ISR INIT
void ctl_buttons_isr_init(CTL_ISR_FN_t fn)
{
int en; int32u proba;
en=ctl_global_interrupts_set(0);
buttons_isr=fn;
SysCtlPeripheralEnable(PUSHBUTTON_PERIPH);
//UNLOCKOLNI KELL A PF0 REGISZTERT MERT NMI-RE VAN ALLITVA
HWREG(PUSHBUTTON_PORT + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
HWREG(PUSHBUTTON_PORT + GPIO_O_CR) |= 0x01;
HWREG(PUSHBUTTON_PORT + GPIO_O_LOCK) = 0;

GPIODirModeSet(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH , GPIO_DIR_MODE_IN);
GPIOPadConfigSet(PUSHBUTTON_PORT,LEFT_SWITCH | RIGHT_SWITCH , GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPinIntDisable(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH);
if((GPIOPinIntStatus(PUSHBUTTON_PORT, 1)) == LEFT_SWITCH )
{
 GPIOPinIntClear(PUSHBUTTON_PORT, LEFT_SWITCH );
}
if((GPIOPinIntStatus(PUSHBUTTON_PORT, 1)) == RIGHT_SWITCH )
{
 GPIOPinIntClear(PUSHBUTTON_PORT, RIGHT_SWITCH );
}
ctl_set_priority(PUSHBUTTON_IRQ_PRIORITY, 1);
ctl_unmask_isr(PUSHBUTTON_IRQ_PRIORITY);
ctl_global_interrupts_set(en);
GPIOIntTypeSet(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH , GPIO_BOTH_EDGES); //GPIO_BOTH_EDGES
GPIOPinIntEnable(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH );
}
开发者ID:fegyizoli,项目名称:zolcsirobot,代码行数:29,代码来源:robot_buttons.c

示例7: hw_init

void hw_init(void){
	SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

	f_cpu = SysCtlClockGet();
	SysTickPeriodSet(0xffffffff);
	SysTickEnable();
//	UARTStdioInit();

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	GPIODirModeSet(SONAR_PORT, TRIG_PIN, GPIO_DIR_MODE_OUT);
	GPIODirModeSet(SONAR_PORT, SERVO_PIN, GPIO_DIR_MODE_OUT);

	GPIOPinTypeGPIOInput(SONAR_PORT, ECHO_PIN);
	GPIOIntTypeSet(SONAR_PORT, ECHO_PIN, GPIO_RISING_EDGE);
	GPIOPinIntEnable(SONAR_PORT,ECHO_PIN);
	IntEnable(INT_GPIOD);

	//Timer configuration
	SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
	TimerConfigure(TIMER0_BASE, TIMER_CFG_A_PERIODIC);
	const long timer_match = (f_cpu/1000000)*10;
	const long timer_out = (f_cpu/1000)*80;
	TimerLoadSet(TIMER0_BASE, TIMER_A, timer_out);
	TimerMatchSet(TIMER0_BASE, TIMER_A, timer_match);
	TimerEnable(TIMER0_BASE, TIMER_A);
	TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
	TimerIntClear(TIMER0_BASE,TIMER_A);
	IntEnable(INT_TIMER0A);

	IntMasterEnable();

}
开发者ID:gluker,项目名称:sonar,代码行数:32,代码来源:main.c

示例8: GPIO_PortF_IntHandler

void GPIO_PortF_IntHandler(void) {
	GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_4);
	GPIOPinIntDisable(GPIO_PORTF_BASE, GPIO_PIN_4);
	Encoder_Count++;
	GPIOPinIntEnable(GPIO_PORTF_BASE, GPIO_PIN_4);

}
开发者ID:AlpNov,项目名称:Embedded-Robot,代码行数:7,代码来源:shaft_encoder.c

示例9: button_init

/**
 * Configures the used button as input source
 * Registers gpio_c interrupt..
 */
void button_init(){
	GPIOPinTypeGPIOInput(BSP_BUTTON_BASE, BSP_USER_BUTTON);
	GPIOIntTypeSet(BSP_BUTTON_BASE,BSP_USER_BUTTON,GPIO_FALLING_EDGE);
	GPIOPortIntRegister(BSP_BUTTON_BASE,GPIO_C_Isr_Handler);
	GPIOPinIntClear(BSP_BUTTON_BASE, BSP_USER_BUTTON);
	GPIOPinIntEnable(BSP_BUTTON_BASE, BSP_USER_BUTTON);
}
开发者ID:barriquello,项目名称:iotstack,代码行数:11,代码来源:board.c

示例10: init_spi

int init_spi(void)
{
  #if CFG_CC3000_SPI_PORT == 1
    ssp1Init();
  #else
    ssp0Init();
  #endif

  /* Set VBAT EN pin to output */
  LPC_GPIO->DIR[CFG_CC3000_EN_PORT] |= (1 << CFG_CC3000_EN_PIN);
  LPC_GPIO->SET[CFG_CC3000_EN_PORT]  = (1 << CFG_CC3000_EN_PIN);
  delay(100);

  /* Set CS pin to output */
  LPC_GPIO->DIR[CFG_CC3000_CS_PORT] |= (1 << CFG_CC3000_CS_PIN);
  CC3000_DEASSERT_CS;

  /* Set interrupt/gpio pin to input */
  LPC_GPIO->DIR[CFG_CC3000_IRQ_PORT]  &= ~(1 << CFG_CC3000_IRQ_PIN);

  /* Channel 2, sense (0=edge, 1=level), polarity (0=low/falling, 1=high/rising) */
  GPIOSetPinInterrupt( 2, CFG_CC3000_IRQ_PORT, CFG_CC3000_IRQ_PIN, 0, 1 );

  /* Enable interrupt 2 on falling edge */
  GPIOPinIntEnable( 2, 0 );

  return(ESUCCESS);
}
开发者ID:ismamont,项目名称:LPC11U_LPC13U_CodeBase,代码行数:28,代码来源:spi.c

示例11: GPIOPinIntClear

void GpioIn::enableInterrupts(void)
{
    // Clear the interrupt
    GPIOPinIntClear(gpio_.port, gpio_.pin);

    // Enable the interrupt
    GPIOPinIntEnable(gpio_.port, gpio_.pin);
}
开发者ID:openwarelab,项目名称:firmware,代码行数:8,代码来源:GpioIn.cpp

示例12: Transceiver_SendMessage

/******** Transceiver_SendMessage *******************************************
// unpack transceiver packet and send out
// Input:
//    pkt - transceiver packet to be sent 
// Output: status
// ------------------------------------------------------------------------*/
unsigned char Transceiver_SendMessage ( TransceiverPacket pkt )
{
	unsigned char tx[TRANSCEIVER_MAX_PAYLOAD];
	unsigned char index, length;
	unsigned char status = SUCCESS;

	// validate packet
	Debug_NetworkTransceiver_PrintPacket(&pkt);

	if ( MAX_DATA_SIZE < pkt.dataSize )
	{
		status = ERROR_INVALID_PAKCET;
		Debug_Printf ("Transceiver_SendMessage: Error 0x%x\n", status);
		goto exit;
	}

	// unpack transceiver packet
	tx[SOURCE_ID_INDEX] = pkt.srcID;
	tx[DEST_ID_INDEX] = pkt.destID;
	tx[MSG_ID_INDEX] = pkt.msgID;
	tx[DATA_SIZE_INDEX] = pkt.dataSize;
	length = DATA_INDEX;
	for ( index = 0; index < pkt.dataSize; index++,length++ )
	{
		tx[length] = pkt.data[index];
	}

	Debug_NetworkTransceiver_PrintPayload(tx);

	// lock transceiver
	while ( xSemaphoreTake(Transceiver_Mutex, portMAX_DELAY) != pdTRUE );
	GPIOPinIntDisable ( nrf24l01_IRQ_IOREGISTER, nrf24l01_IRQ_PIN );

	nrf24l01_set_as_tx();
	nrf24l01_write_tx_payload ( tx, TRANSCEIVER_MAX_PAYLOAD, true );

	//wait until the packet has been sent or the maximum number of retries has been active
	while( !( nrf24l01_irq_pin_active() && (nrf24l01_irq_tx_ds_active()||nrf24l01_irq_max_rt_active()) ) );
	if ( nrf24l01_irq_max_rt_active() )	
	{
		// hit maximum number of retries
		nrf24l01_flush_tx();
		status = ERROR_MAX_RETRIES;
		Debug_Printf ("Transceiver_SendMessage: Error 0x%x\n", status);
	}

	// reset transceiver
	nrf24l01_irq_clear_all();
	nrf24l01_set_as_rx(true);
	Delay_US(130);

	//unlock transceiver
	GPIOPinIntEnable ( nrf24l01_IRQ_IOREGISTER, nrf24l01_IRQ_PIN );
	while ( xSemaphoreGive(Transceiver_Mutex) != pdTRUE );

exit:
	return status;
}
开发者ID:yguo89,项目名称:CodeBrain,代码行数:64,代码来源:Transceiver.c

示例13: initHW

void
initHW(void)
{
  volatile unsigned long ulLoop;

  //initHW();

  SysCtlClockSet(
      SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);

  // Enable the ports
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

  // Inputs :
  // PE0 : Up button
  // PE1 : Down button
  // PE2 : Left button
  // PE3 : Right button
  // PF1 : Select button
  //
  GPIODirModeSet(GPIO_PORTE_BASE,
      GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, GPIO_DIR_MODE_IN);
  GPIOPadConfigSet(GPIO_PORTE_BASE,
      GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, GPIO_STRENGTH_2MA,
      GPIO_PIN_TYPE_STD_WPU);

  GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN);
  GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA,
      GPIO_PIN_TYPE_STD_WPU);

  // Outputs:
  // PF0 : Status LED
  GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_DIR_MODE_OUT);
  GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA,
      GPIO_PIN_TYPE_STD);
  GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 1);

  // Enable edge triggered interrupt on select button
  // Clear the interrupt just in case
  GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_FALLING_EDGE);
  GPIOPinIntEnable(GPIO_PORTF_BASE, GPIO_PIN_1 );

  SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOF);


  // Enable the interrupt for port F
  IntEnable(INT_GPIOF);

  // Global interrupt enable
  IntMasterEnable();


  // a short delay to ensure stable IO before running the rest of the program
  for (ulLoop = 0; ulLoop < 200; ulLoop++)
    {
    }
}
开发者ID:BetteLars,项目名称:EAL_Embedded,代码行数:58,代码来源:main.c

示例14: vs_play

void vs_play(void)
{
  if(vs_request() && vs_playing)
  {
    GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_1); //enable dreq irq
  }

  return;
}
开发者ID:Bob4ik888,项目名称:WebRadio,代码行数:9,代码来源:vs.c

示例15: initMotor

//GPIO³õʼ»¯
void initMotor()
{
    //³õʼ»¯ÍâÉè¶Ë¿Ú
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
    
    //µç»úÕý·´×ª¿ØÖƶ˿ÚÅäÖÃ
    GPIODirModeSet(GPIO_PORTD_BASE,  MOTOR_R0 | MOTOR_R1, GPIO_DIR_MODE_OUT);
    GPIOPadConfigSet(GPIO_PORTD_BASE, MOTOR_R0 | MOTOR_R1, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
    
    GPIODirModeSet(GPIO_PORTG_BASE,  MOTOR_L0 | MOTOR_L1, GPIO_DIR_MODE_OUT);
    GPIOPadConfigSet(GPIO_PORTG_BASE, MOTOR_L0 | MOTOR_L1, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);

    //±àÂëÆ÷ÖжÏÉèÖã¬Ï½µÑØ´¥·¢    
    GPIODirModeSet(GPIO_PORTG_BASE, CODE_L, GPIO_DIR_MODE_IN); 
    GPIOPadConfigSet(GPIO_PORTG_BASE, CODE_L, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
    GPIOIntTypeSet(GPIO_PORTG_BASE, CODE_L, GPIO_FALLING_EDGE);
    GPIOPinIntEnable(GPIO_PORTG_BASE, CODE_L);
    
    GPIODirModeSet(GPIO_PORTD_BASE, CODE_R, GPIO_DIR_MODE_IN); 
    GPIOPadConfigSet(GPIO_PORTD_BASE, CODE_R, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
    GPIOIntTypeSet(GPIO_PORTD_BASE, CODE_R, GPIO_FALLING_EDGE);
    GPIOPinIntEnable(GPIO_PORTD_BASE, CODE_R);
    
    /*
    HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
    // Set the commit register for PB7 to allow changing the function
    HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0x80;
    // Enable the alternate function for PB7 (NMI)
    HWREG(GPIO_PORTB_BASE + GPIO_O_AFSEL) |= 0x80;
    // Turn on the digital enable for PB7
    HWREG(GPIO_PORTB_BASE + GPIO_O_DEN) |= 0x80;
    
    
    GPIODirModeSet(GPIO_PORTB_BASE,GPIO_PIN_7,GPIO_DIR_MODE_IN); 
    GPIOPadConfigSet(GPIO_PORTB_BASE,GPIO_PIN_7,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD);
    GPIOIntTypeSet( GPIO_PORTB_BASE,GPIO_PIN_7,GPIO_FALLING_EDGE ); 
    // Relock the commit register
    HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = 0;
    */
    
    IntEnable(INT_GPIOD);
    IntEnable(INT_GPIOG);
}
开发者ID:flyfire,项目名称:WebBasedRobot,代码行数:45,代码来源:motor.c


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