mbed-drivers
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
mbed::InterruptIn Class Reference

#include <InterruptIn.h>

Public Member Functions

 InterruptIn (PinName pin)
 
int read ()
 
 operator int ()
 
void rise (void(*fptr)(void))
 
template<typename T >
void rise (T *tptr, void(T::*mptr)(void))
 
void fall (void(*fptr)(void))
 
template<typename T >
void fall (T *tptr, void(T::*mptr)(void))
 
void mode (PinMode pull)
 
void enable_irq ()
 
void disable_irq ()
 

Static Public Member Functions

static void _irq_handler (uint32_t id, gpio_irq_event event)
 

Protected Attributes

gpio_t gpio
 
gpio_irq_t gpio_irq
 
mbed::util::FunctionPointer _rise
 
mbed::util::FunctionPointer _fall
 

Detailed Description

A digital interrupt input, used to call a function on a rising or falling edge

Example:

// Flash an LED while waiting for events
#include "mbed.h"
InterruptIn event(p16);
DigitalOut led(LED1);
void trigger() {
printf("triggered!\n");
}
int main() {
event.rise(&trigger);
while(1) {
led = !led;
wait(0.25);
}
}

Constructor & Destructor Documentation

mbed::InterruptIn::InterruptIn ( PinName  pin)

Create an InterruptIn connected to the specified pin

Parameters
pinInterruptIn pin to connect to
name(optional) A string to identify the object

Member Function Documentation

void mbed::InterruptIn::disable_irq ( )

Disable IRQ. This method depends on hw implementation, might disable one port interrupts. For further information, check gpio_irq_disable().

void mbed::InterruptIn::enable_irq ( )

Enable IRQ. This method depends on hw implementation, might enable one port interrupts. For further information, check gpio_irq_enable().

void mbed::InterruptIn::fall ( void(*)(void)  fptr)

Attach a function to call when a falling edge occurs on the input

Parameters
fptrA pointer to a void function, or 0 to set as none
template<typename T >
void mbed::InterruptIn::fall ( T *  tptr,
void(T::*)(void)  mptr 
)
inline

Attach a member function to call when a falling edge occurs on the input

Parameters
tptrpointer to the object to call the member function on
mptrpointer to the member function to be called
void mbed::InterruptIn::mode ( PinMode  pull)

Set the input pin mode

Parameters
modePullUp, PullDown, PullNone
void mbed::InterruptIn::rise ( void(*)(void)  fptr)

Attach a function to call when a rising edge occurs on the input

Parameters
fptrA pointer to a void function, or 0 to set as none
template<typename T >
void mbed::InterruptIn::rise ( T *  tptr,
void(T::*)(void)  mptr 
)
inline

Attach a member function to call when a rising edge occurs on the input

Parameters
tptrpointer to the object to call the member function on
mptrpointer to the member function to be called

The documentation for this class was generated from the following files: