LedBlink library makes it possible to change blink frequency of a given LED by calling the Blink function with a float parameter elsewhere in the code to visualise state changes in a program.
Revision 3:9d5aa4d61bf0, committed 2015-12-07
- Comitter:
- jensstruemper
- Date:
- Mon Dec 07 14:53:20 2015 +0000
- Parent:
- 2:ada0b8ebf504
- Commit message:
- update documentation
Changed in this revision
LedBlink.cpp | Show annotated file Show diff for this revision Revisions of this file |
LedBlink.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r ada0b8ebf504 -r 9d5aa4d61bf0 LedBlink.cpp --- a/LedBlink.cpp Mon Dec 07 14:45:46 2015 +0000 +++ b/LedBlink.cpp Mon Dec 07 14:53:20 2015 +0000 @@ -27,5 +27,4 @@ led_timer = frequency; ChangeStatusFlag = true; LedBlinkCallback(); -} - +} \ No newline at end of file
diff -r ada0b8ebf504 -r 9d5aa4d61bf0 LedBlink.h --- a/LedBlink.h Mon Dec 07 14:45:46 2015 +0000 +++ b/LedBlink.h Mon Dec 07 14:53:20 2015 +0000 @@ -5,57 +5,57 @@ * function of class LedBlink and passing a float as paramter for * the frequency where 0 = off and 1 = 1 hz. -Example: -@code + * Example: + * @code -#include "mbed.h" -#include "LedBlink.h" + * #include "mbed.h" + * #include "LedBlink.h" -InterruptIn pb(p17); -// SPST Pushbutton count demo using interrupts -// no external PullUp resistor needed -// Pushbutton from P17 to GND. -// A pb falling edge (hit) generates an interrupt and activates the interrupt routine + * InterruptIn pb(p17); + * // SPST Pushbutton count demo using interrupts + * // no external PullUp resistor needed + * // Pushbutton from P17 to GND. + * // A pb falling edge (hit) generates an interrupt and activates the interrupt routine -// Global count variable -int volatile count=0; + * // Global count variable + * int volatile count=0; -//Instantiate LedBlink object. - LedBlink ledb(p21); + * //Instantiate LedBlink object. + * LedBlink ledb(p21); -// pb Interrupt routine - is interrupt activated by a falling edge of pb input -void pb_hit_interrupt (void) { - count++; -//Set Blink Frequency based on button count. -//Function Blinker accepts a parameter of type float to set the blink frequency. - if (count == 1){ - ledb.Blinker(1.0); - } - if (count == 2){ - ledb.Blinker(0.5); - } - if (count == 3){ - ledb.Blinker(0.1); - } - if (count == 4){ - ledb.Blinker(0); - count = 0; - } - } + * // pb Interrupt routine - is interrupt activated by a falling edge of pb input + * void pb_hit_interrupt (void) { + * count++; + * //Set Blink Frequency based on button count. + * //Function Blinker accepts a parameter of type float to set the blink frequency. + * if (count == 1){ + * ledb.Blinker(1.0); + * } + * if (count == 2){ + * ledb.Blinker(0.5); + * } + * if (count == 3){ + * ledb.Blinker(0.1); + * } + * if (count == 4){ + * ledb.Blinker(0); + * count = 0; + * } + * } -int main(void) { - // Use internal pullup for pushbutton - pb.mode(PullUp); - // Delay for initial pullup to take effect - wait(.01); - // Attach the address of the interrupt handler routine for pushbutton - pb.fall(&pb_hit_interrupt); + *int main(void) { + * // Use internal pullup for pushbutton + * pb.mode(PullUp); + * // Delay for initial pullup to take effect + * wait(.01); + * // Attach the address of the interrupt handler routine for pushbutton + * pb.fall(&pb_hit_interrupt); - while (1){ - } -} -@endcode -*/ + * while (1){ + * } + *} + *@endcode + */ #ifndef MBED_LEDBLINK_H #define MBED_LEDBLINK_H