Easy for debugging hardware/software
Toggle library easy for debugging based on : https://developer.mbed.org/cookbook/Writing-a-Library
Diff: toggle.h
- Revision:
- 0:847ab1eb73cf
- Child:
- 1:27360e9dc2c5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toggle.h Sat Jun 11 12:19:44 2016 +0000 @@ -0,0 +1,59 @@ +#ifndef TOGGLE_H +#define TOGGLE_H + +#include "mbed.h" + + + +/** Toggle pin for debugging purposes + * + * @code + * #include "mbed.h" + * #include "toggle.h" + * + * Toggle pin(P1_24); + * Toggle led(P1.25); + * + * int main() { + * + * pin.toggle(3); // toggle pin P1_24 3 times + * led.toggle(5); // toggle led P1_25 5 times + * + * } + * @endcode + */ + + +class Togglen { +public: + + /** + * toggle constructor + * + * @param pin "pin" to toggle + */ + Togglen(PinName pin); + + + /** + * toggle destructor + */ + + ~Togglen(); + + /** + * Command to n times toggle the pin + */ + + void Toggle(int n); + +private: + + /** + * Set the Digital out pin + */ + + DigitalOut _p; +}; + +#endif \ No newline at end of file