本文整理匯總了C++中GPIOIntClear函數的典型用法代碼示例。如果您正苦於以下問題:C++ GPIOIntClear函數的具體用法?C++ GPIOIntClear怎麽用?C++ GPIOIntClear使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GPIOIntClear函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ButtonHandler
void ButtonHandler(){
uint32_t mask=GPIOIntStatus(GPIO_PORTF_BASE,false);
uint8_t value=0;
if(mask & GPIO_PIN_4){
//Boton izquierdo
value= GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4);
if(value==0){
//boton pulsado
// Activa el Timer4A (empezara a funcionar)
TimerEnable(TIMER4_BASE, TIMER_A);
pulsacionLarga=true;
}else{
TimerDisable(TIMER4_BASE,TIMER_A);
if(pulsacionLarga){
xEventGroupSetBits(xEventGroup, PilotoAutomaticoBit);
if((xTaskCreate(PilAuto, (signed portCHAR *)"Piloto Auto", LED1TASKSTACKSIZE,NULL,tskIDLE_PRIORITY + 1, &PilautTaskHandle) != pdTRUE))
{
while(1);
}
}
}
}
if(mask & GPIO_PIN_0){
//boton derecho
xEventGroupClearBits( xEventGroup, PilotoAutomaticoBit );
}
GPIOIntClear(GPIO_PORTF_BASE,GPIO_PIN_0|GPIO_PIN_4);
}
示例2: PortKIntHandler
//*****************************************************************************
//
//! This is the Pulse Per Second (PPS) interrupt handler.
//! The updateCounter is incremented on each Pulse per second call, if equal to
//! the update rate, the GPS data is parsed and logged.
//
//*****************************************************************************
void PortKIntHandler(void) {
uint32_t intStatus = 0;
//
// Get the current interrupt status for Port K
//
intStatus = GPIOIntStatus(GPIO_PORTK_BASE,true);
//
// Clear the set interrupts for Port K
//
GPIOIntClear(GPIO_PORTK_BASE,intStatus);
//
// Execute code for PK2 interrupt
//
if((intStatus & GPIO_INT_PIN_2) == GPIO_INT_PIN_2){
if (updateRate == updateCounter++) {
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x02);
gpsData();
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x00);
updateCounter = 0;
//
// Disable PPS interrupt after one read if in low power mode
//
if (lowPowerOn == 1) {
IntDisable(INT_GPIOK);
logComplete = 1;
}
}
}
} // End function PortKIntHandler
示例3: confGPIO
void confGPIO(){
//Inicializa el puerto F (LEDs) --> No hace falta si usamos la libreria RGB
// ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
// ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
//ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0); //LEDS APAGADOS
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOE);
//Inicializa los LEDs usando libreria RGB
RGBInit(1);
SysCtlPeripheralSleepEnable(GREEN_TIMER_PERIPH);
SysCtlPeripheralSleepEnable(BLUE_TIMER_PERIPH);
RGBEnable();
//Inicializamos los botones y su interrupción
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ButtonsInit();
GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_0|GPIO_INT_PIN_4);
GPIOIntRegister(GPIO_PORTF_BASE,ButtonHandler);
GPIOIntTypeSet(GPIO_PORTF_BASE,GPIO_INT_PIN_0|GPIO_INT_PIN_4, GPIO_BOTH_EDGES);
GPIOIntEnable(GPIO_PORTF_BASE, GPIO_INT_PIN_0|GPIO_INT_PIN_4);
SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOF);
}
示例4: mode2unset
void mode2unset()
{
GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4); //Clear any existing interrupts
GPIOIntDisable(GPIO_PORTF_BASE, GPIO_PIN_4); //Enable the GPIO Interrupts on Port F
IntDisable(INT_TIMER1A);
TimerIntDisable(TIMER1_BASE,TIMER_TIMA_TIMEOUT);
}
示例5: PIOINT1_IRQHandler
/**
* @brief interrupt handler, updates timer, when fired
*
* */
void PIOINT1_IRQHandler(void)
{
GPIOIntClear( TRIG_IN_PORT_1, TRIG_IN_PIN_1);
/* detect change time */
timeLast1 = timeEdge1;
timeEdge1 = millis();
}
示例6: GPIO_PORTF_isr
//definition of isr for PORT F
void GPIO_PORTF_isr(void)
{
uint32_t actual_GPIO_PORTF_status=((GPIO_PIN_0 | GPIO_PIN_4) & ~GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4));
switch (actual_GPIO_PORTF_status)
{
case GPIO_PIN_4: //if SW1 is pressed
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_PIN_1); //turn on RED LED
UARTprintf("RED LED on\n\r");
break;
case GPIO_PIN_0: //if SW2 is pressed
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); //turn on BLUE LED
UARTprintf("BLUE LED on\n\r");
break;
case (GPIO_PIN_0|GPIO_PIN_4): //either SW1 and SW2 are pressed
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_1, GPIO_PIN_2 | GPIO_PIN_1); //turn on RED & BLUE LEDs
UARTprintf("RED & BLUE LEDs on\n\r");
break;
default: //neither SW1 nor SW2 are pressed
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_1 , 0); //turn off RED & BLUE LEDs
UARTprintf("RED & BLUE LEDs off\n\r");
break;
}
GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_0 | GPIO_INT_PIN_4);
}
示例7: IntHandlerGPIOPortE
//*****************************************************************************
//
// Called by the NVIC as a result of GPIO port E interrupt event. For this
// application GPIO port E pin 5 is the interrupt line for the ISL29023
//
// Notifies the application that light is outside of threshold limits.
// Task will poll the semaphore and adjust the ranges accordingly.
//
//*****************************************************************************
void
IntHandlerGPIOPortE(void)
{
unsigned long ulStatus;
portBASE_TYPE xHigherPriorityTaskWoken;
ulStatus = GPIOIntStatus(GPIO_PORTE_BASE, true);
//
// Clear all the pin interrupts that are set
//
GPIOIntClear(GPIO_PORTE_BASE, ulStatus);
if(ulStatus & GPIO_PIN_5)
{
//
// ISL29023 has indicated that the light level has crossed outside of
// the intensity threshold levels set in INT_LT and INT_HT registers.
//
xSemaphoreGiveFromISR(g_xISL29023AdjustRangeSemaphore,
&xHigherPriorityTaskWoken);
//
// If the give of this semaphore causes a task to be ready then
// make sure it has opportunity to run immediately upon return from
// this ISR.
//
if(xHigherPriorityTaskWoken == pdTRUE)
{
portYIELD_FROM_ISR(true);
}
}
}
示例8: decodeMatrixInput
void decodeMatrixInput() {
SysCtlDelay(1000000); // debounce wait
uint32_t input = GPIOPinRead(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
if ((input & 0xF0) != 0xF0) // try to decode if something is pushed.
{
int i, row = -1, col = -1;
for (i = 1; i < 5; i++) // get row
{
if (!(input & (8 << i)))
row = i - 1;
}
for(i = 0; i < 4; i++) // get col
{
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5, 4 << i);
if (GPIOPinRead(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7) & (16 << row))
{
col = i;
break;
}
}
if (col != -1 && row != -1)
activePattern = row * 4 + col; // get the char of the button.
}
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5, 0);
GPIOIntClear(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
SysCtlDelay(1000000); // wait to allow button to be lifted
}
示例9: PIOINT2_IRQHandler
/**
* @brief interrupt handler, updates timer, when fired
*
* */
void PIOINT2_IRQHandler(void)
{
GPIOIntClear( TRIG_IN_PORT_2, TRIG_IN_PIN_2);
/* detect change time */
timeLast2 = timeEdge2;
timeEdge2 = millis();
}
示例10: GPIOPortMIntHandler
//*****************************************************************************
//
// Called by the NVIC as a result of GPIO port M interrupt event. For this
// application GPIO port M pin 3 is the interrupt line for the MPU9150
//
// For BoosterPack 2 Interface use Port M pin 7.
//
//*****************************************************************************
void
GPIOPortMIntHandler(void)
{
unsigned long ulStatus;
//
// Get the status flags to see which pin(s) caused the interrupt.
//
ulStatus = GPIOIntStatus(GPIO_PORTM_BASE, true);
//
// Clear all the pin interrupts that are set
//
GPIOIntClear(GPIO_PORTM_BASE, ulStatus);
//
// Check if this is an interrupt on the MPU9150 interrupt line.
//
// For BoosterPack 2 use Pin 7 instead.
//
if(ulStatus & GPIO_PIN_3) {
//
// Turn on the LED to show that transaction is starting.
//
LEDWrite(CLP_D3 | CLP_D4, CLP_D3);
//
// MPU9150 Data is ready for retrieval and processing.
//
MPU9150DataRead(&g_sMPU9150Inst, MPU9150AppCallback, &g_sMPU9150Inst);
}
}
示例11: init_BtnHandler
/*****************************************************
* Function: init_BtnHandler
* Description: Initializes button interrupt
* Initializes timer for button counter
* Input: NONE
* Output: NONE
*****************************************************/
void init_BtnHandler(void)
{
// Unlock un-maskable pin
HWREG(BTN_OVERRIDE_REG + GPIO_O_LOCK) = GPIO_LOCK_KEY;
// Set up our interrupt for button presses
IntMasterDisable(); // Disable all interrupts
GPIOIntDisable(BTN_OVERRIDE_REG, BTN_OVERRIDE);
GPIOPinTypeGPIOInput(BTN_OVERRIDE_REG, BTN_OVERRIDE);
GPIOPadConfigSet(BTN_OVERRIDE_REG, BTN_OVERRIDE, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU); // Set Pull-up
GPIOIntTypeSet(BTN_OVERRIDE_REG, BTN_OVERRIDE, GPIO_BOTH_EDGES); // Set edge to trigger on
GPIOIntClear(BTN_OVERRIDE_REG, BTN_OVERRIDE); // Clear the interrupt bit
GPIOIntEnable(BTN_OVERRIDE_REG, BTN_OVERRIDE); // Enable the interrupt
IntEnable(INT_GPIOE);
// Lock un-maskable pin
HWREG(BTN_OVERRIDE_REG + GPIO_O_LOCK) = 0;
// Setup timer interrupt for button pressing
// This timer will run up and when it is released we will check how long it was running
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerConfigure(BTN_OVERRIDE_TIM_BASE, TIMER_CFG_PERIODIC); // Setup interrupt as 32 bit timer counting up
TimerLoadSet(BTN_OVERRIDE_TIM_BASE, BTN_OVERRIDE_TIM, clockTime/1000); // Load Timer
IntEnable(INT_TIMER0A);
TimerIntEnable(BTN_OVERRIDE_TIM_BASE, TIMER_TIMA_TIMEOUT);
// Turn the input pin to the button high
GPIOPinTypeGPIOOutput(BTN_OVERRIDE_CONTROL_REG, BTN_OVERRIDE_CONTROL);
GPIOPinWrite(BTN_OVERRIDE_CONTROL_REG, BTN_OVERRIDE_CONTROL, BTN_OVERRIDE_CONTROL);
}
示例12: mode2set
void mode2set()
{
GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4); //Clear any existing interrupts
GPIOIntEnable(GPIO_PORTF_BASE, GPIO_PIN_4); //Enable the GPIO Interrupts on Port F
TimerLoadSet(TIMER1_BASE, TIMER_A,SysCtlClockGet()/3); //Set the Max Value of the timer
IntEnable(INT_TIMER1A);
TimerIntEnable(TIMER1_BASE,TIMER_TIMA_TIMEOUT); //Enable Timer1 Interrupt
}
示例13: IntGPIOe
/** Port E interrupt service routine
@note Must be configured in startup_ccs.c or else will not be called.
*/
void IntGPIOe(void)
{
buttonIsr(0); // Button 0 was pressed
#ifdef TIVA
GPIOIntClear(GPIO_PORTE_BASE, GPIO_PIN_4); //Clear interrupts
#else
GPIOPinIntClear(GPIO_PORTE_BASE, GPIO_PIN_4); //Clear interrupts
#endif
}
示例14: Interrupt_PB3Init
void Interrupt_PB3Init(void)
{
GPIOIntRegister(GPIO_PORTB_BASE,Interrupt_PB3Handler);
ROM_GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_3);
ROM_GPIOPadConfigSet(GPIO_PORTB_BASE,GPIO_PIN_3,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU);
GPIOIntDisable(GPIO_PORTB_BASE,GPIO_INT_PIN_3);
GPIOIntClear(GPIO_PORTB_BASE,GPIO_INT_PIN_3);
GPIOIntTypeSet(GPIO_PORTB_BASE,GPIO_INT_PIN_3,GPIO_LOW_LEVEL);
}
示例15: onButtonUp
void onButtonUp(void) {
if (GPIOIntStatus(GPIO_PORTF_BASE, false) & GPIO_PIN_4) {
// PF4 was interrupt cause
printf("Button Up\n");
GPIOIntRegister(GPIO_PORTF_BASE, onButtonDown); // Register our handler function for port F
GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_FALLING_EDGE); // Configure PF4 for falling edge trigger
GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4); // Clear interrupt flag
}
}