mbed libraries for KL25Z
Diff: InterruptIn.h
- Revision:
- 8:c14af7958ef5
- Parent:
- 7:73c5efe92a6c
- Child:
- 9:663789d7729f
--- a/InterruptIn.h Tue Oct 23 09:20:18 2012 +0000 +++ b/InterruptIn.h Fri Nov 09 11:33:53 2012 +0000 @@ -4,76 +4,69 @@ #ifndef MBED_INTERRUPTIN_H #define MBED_INTERRUPTIN_H -#include "device.h" +#include "platform.h" #if DEVICE_INTERRUPTIN #include "gpio_api.h" #include "gpio_irq_api.h" -#include "platform.h" -#include "Base.h" #include "FunctionPointer.h" namespace mbed { -/* Class: InterruptIn - * A digital interrupt input, used to call a function on a rising or falling edge +/** 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); - * > } - * > } + * @code + * // 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); + * } + * } + * @endcode */ -class InterruptIn : public Base { +class InterruptIn { public: - /* Constructor: InterruptIn - * Create an InterruptIn connected to the specified pin + /** Create an InterruptIn connected to the specified pin * - * Variables: - * pin - InterruptIn pin to connect to - * name - (optional) A string to identify the object + * @param pin InterruptIn pin to connect to + * @param name (optional) A string to identify the object */ - InterruptIn(PinName pin, const char *name = NULL); + InterruptIn(PinName pin); virtual ~InterruptIn(); - + int read(); #ifdef MBED_OPERATORS operator int(); #endif - /* Function: rise - * Attach a function to call when a rising edge occurs on the input + /** Attach a function to call when a rising edge occurs on the input * - * Variables: - * fptr - A pointer to a void function, or 0 to set as none + * @param fptr A pointer to a void function, or 0 to set as none */ void rise(void (*fptr)(void)); - /* Function: rise - * Attach a member function to call when a rising edge occurs on the input + /** Attach a member function to call when a rising edge occurs on the input * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called */ template<typename T> void rise(T* tptr, void (T::*mptr)(void)) { @@ -81,20 +74,16 @@ gpio_irq_set(&gpio_irq, IRQ_RISE, 1); } - /* Function: fall - * Attach a function to call when a falling edge occurs on the input + /** Attach a function to call when a falling edge occurs on the input * - * Variables: - * fptr - A pointer to a void function, or 0 to set as none + * @param fptr A pointer to a void function, or 0 to set as none */ void fall(void (*fptr)(void)); - /* Function: fall - * Attach a member function to call when a falling edge occurs on the input + /** Attach a member function to call when a falling edge occurs on the input * - * Variables: - * tptr - pointer to the object to call the member function on - * mptr - pointer to the member function to be called + * @param tptr pointer to the object to call the member function on + * @param mptr pointer to the member function to be called */ template<typename T> void fall(T* tptr, void (T::*mptr)(void)) { @@ -102,11 +91,9 @@ gpio_irq_set(&gpio_irq, IRQ_FALL, 1); } - /* Function: mode - * Set the input pin mode + /** Set the input pin mode * - * Variables: - * mode - PullUp, PullDown, PullNone + * @param mode PullUp, PullDown, PullNone */ void mode(PinMode pull);