BLE temperature profile using digital DS1820 or analog LM35 sensors

Dependencies:   DS1820

Embed: (wiki syntax)

« Back to documentation index

InterruptIn Class Reference

InterruptIn Class Reference

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

#include <InterruptIn.h>

Public Member Functions

 InterruptIn (PinName pin)
 Create an InterruptIn connected to the specified pin.
void rise (void(*fptr)(void))
 Attach a function to call when a rising edge occurs on the input.
template<typename T >
void rise (T *tptr, void(T::*mptr)(void))
 Attach a member function to call when a rising edge occurs on the input.
void fall (void(*fptr)(void))
 Attach a function to call when a falling edge occurs on the input.
template<typename T >
void fall (T *tptr, void(T::*mptr)(void))
 Attach a member function to call when a falling edge occurs on the input.
void mode (PinMode pull)
 Set the input pin mode.
void enable_irq ()
 Enable IRQ.
void disable_irq ()
 Disable IRQ.

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);
     }
 }

Definition at line 53 of file InterruptIn.h.


Constructor & Destructor Documentation

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 disable_irq (  )

Disable IRQ.

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

void enable_irq (  )

Enable IRQ.

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

void 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
void fall ( T *  tptr,
void(T::*)(void)  mptr 
)

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

Definition at line 100 of file InterruptIn.h.

void mode ( PinMode  pull )

Set the input pin mode.

Parameters:
modePullUp, PullDown, PullNone
void 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
void rise ( T *  tptr,
void(T::*)(void)  mptr 
)

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

Definition at line 83 of file InterruptIn.h.