static int int_gpio_negedge_set_status( elua_int_resnum resnum, int status )
{
  unsigned long portbase = pio_base[ PLATFORM_IO_GET_PORT( resnum ) ];
  u8 pinmask = 1 << PLATFORM_IO_GET_PIN( resnum );
  int prev = int_gpio_posedge_get_status( resnum );
  int crtstat = inth_gpio_get_int_status( resnum );

  if( status == PLATFORM_CPU_ENABLE )
  {
    // If already configured for rising edge, set both edges
    // Otherwise set only negedge
    if( crtstat & GPIO_INT_POSEDGE_ENABLED )
      HWREG( portbase + GPIO_O_IBE ) |= pinmask;
    else
      HWREG( portbase + GPIO_O_IEV ) &= ( u8 )~pinmask;
    MAP_GPIOPinIntEnable( portbase, pinmask );
  }
  else
  {
    // If configured for both, enable only rising edge
    // Otherwise disable interrupts completely
    if( crtstat == GPIO_INT_BOTH_ENABLED )
    {
      HWREG( portbase + GPIO_O_IBE ) &= ( u8 )~pinmask;
      HWREG( portbase + GPIO_O_IEV ) |= pinmask;
    }
    else if( crtstat == GPIO_INT_NEGEDGE_ENABLED )
      MAP_GPIOPinIntDisable( portbase, pinmask );
  }
  return prev;
}
示例#2
0
//*****************************************************************************
//
//! Initialize LEDs
//!
//! \param  none
//!
//! \return none
//!
//! \brief  Initializes LED Ports and Pins
//
//*****************************************************************************
void initLEDs()
{
	// Enable use of PORTF to toggle LED and disable interrupt on this port
	MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    //
    // Unlock PF0 so we can change it to a GPIO input
    // Once we have enabled (unlocked) the commit register then re-lock it
    // to prevent further changes.  PF0 is muxed with NMI thus a special case.
    //
    HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
    HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01;
    HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0;

    
	MAP_GPIOPinIntDisable(GPIO_PORTF_BASE, 0xFF);
	
	// Configure Red LED
	MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
	MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, PIN_LOW); 
	
	// Configure Blue LED
	MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
	MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, PIN_LOW); 
	
	// Configure Green LED
	MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3);
	MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, PIN_LOW); 
	
    
    // Button inputs
	ROM_GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4, GPIO_DIR_MODE_IN);
    ROM_GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);

}
示例#3
0
void DataReadyIntHandler(void)
{
	uint8_t p = ROM_GPIOPinIntStatus(ADS_DRY_PORT, true) & 0xFF;

	MAP_IntDisable(INT_GPIOC);
	MAP_GPIOPinIntDisable(ADS_DRY_PORT, ADS_DRY_PIN);

	GPIOPinIntClear(ADS_DRY_PORT, p);

	HWREGBITW(&g_ulFlags, FLAG_ADS_INT) = 1;

}
示例#4
0
文件: board.c 项目: ianjuch/ee149
//*****************************************************************************
//
//! Initialize LEDs
//!
//! \param  none
//!
//! \return none
//!
//! \brief  Initializes LED Ports and Pins
//
//*****************************************************************************
void initLEDs()
{
	// Enable use of PORTF to toggle LED and disable interrupt on this port
	MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
	MAP_GPIOPinIntDisable(GPIO_PORTF_BASE, 0xFF);
	
	// Configure Red LED
	MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
	MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, PIN_LOW); 
	
	// Configure Blue LED
	MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
	MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, PIN_LOW); 
	
	// Configure Green LED
	MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3);
	MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, PIN_LOW); 
	
}
示例#5
0
void pio_init()
{
					 //  Board Initialization start
				 //
				 //
				 // The FPU should be enabled because some compilers will use floating-
				 // point registers, even for non-floating-point code.  If the FPU is not
				 // enabled this will cause a fault.  This also ensures that floating-
				 // point operations could be added to this application and would work
				 // correctly and use the hardware floating-point unit.  Finally, lazy
				 // stacking is enabled for interrupt handlers.  This allows floating-
				 // point instructions to be used within interrupt handlers, but at the
				 // expense of extra stack usage.
				 //
				 FPUEnable(); 
				 FPULazyStackingEnable();	  
				 
				 //Init the device with 16 MHz clock.
				 initClk();
	
                 /* Configure the system peripheral bus that IRQ & EN pin are map to */
					MAP_SysCtlPeripheralEnable( SYSCTL_PERIPH_IRQ_PORT);
					//
					// Disable all the interrupts before configuring the lines
					//
					MAP_GPIOPinIntDisable(SPI_GPIO_IRQ_BASE, 0xFF);
					//
					// Cofigure WLAN_IRQ pin as input
					//
					MAP_GPIOPinTypeGPIOInput(SPI_GPIO_IRQ_BASE, SPI_IRQ_PIN);

					GPIOPadConfigSet(SPI_GPIO_IRQ_BASE, SPI_IRQ_PIN, GPIO_STRENGTH_2MA,
												GPIO_PIN_TYPE_STD_WPU);     
					//
					// Setup the GPIO interrupt for this pin
					//
					MAP_GPIOIntTypeSet(SPI_GPIO_IRQ_BASE, SPI_IRQ_PIN, GPIO_FALLING_EDGE);

					//
					// Configure WLAN chip
					//
                    MAP_GPIOPinTypeGPIOOutput(SPI_GPIO_IRQ_BASE, SPI_EN_PIN);
                    MAP_GPIODirModeSet( SPI_GPIO_IRQ_BASE, SPI_EN_PIN, GPIO_DIR_MODE_OUT );
                    MAP_GPIOPadConfigSet( SPI_GPIO_IRQ_BASE, SPI_EN_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPD );



					MAP_GPIOPinWrite(SPI_GPIO_IRQ_BASE, SPI_EN_PIN, PIN_LOW);	
					SysCtlDelay(600000);
					SysCtlDelay(600000);
					SysCtlDelay(600000);
					//
					// Disable WLAN CS with pull up Resistor
					//
					MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SPI_PORT);	
					MAP_GPIOPinTypeGPIOOutput(SPI_CS_PORT, SPI_CS_PIN);
					GPIOPadConfigSet(SPI_CS_PORT, SPI_CS_PIN, GPIO_STRENGTH_2MA,
												GPIO_PIN_TYPE_STD_WPU);     
					MAP_GPIOPinWrite(SPI_CS_PORT, SPI_CS_PIN, PIN_HIGH);

					// 
					// Enable interrupt for WLAN_IRQ pin
					//
					MAP_GPIOPinIntEnable(SPI_GPIO_IRQ_BASE, SPI_IRQ_PIN);
					// 
					// Clear interrupt status
					//
					SpiCleanGPIOISR();

					MAP_IntEnable(INT_GPIO_SPI);
					
					//init LED
					initLEDs();

}
示例#6
0
void WlanInterruptDisable()
{
  MAP_GPIOPinIntDisable(SPI_GPIO_IRQ_BASE, SPI_IRQ_PIN);
}