Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 4:ecb39b6f0e18, committed 2017-05-21
- Comitter:
- kryksyh
- Date:
- Sun May 21 14:59:47 2017 +0000
- Parent:
- 3:bb53fa90af91
- Commit message:
- set_mask method
Changed in this revision
| 6LedBar.cpp | Show annotated file Show diff for this revision Revisions of this file |
| 6LedBar.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/6LedBar.cpp Sun May 21 14:29:24 2017 +0000
+++ b/6LedBar.cpp Sun May 21 14:59:47 2017 +0000
@@ -53,4 +53,15 @@
toggle(i);
}
}
+}
+
+void LedBar::set_mask(int m) {
+ for(int i = 0; i < LEDS_COUNT; i++) {
+ if(m & (1 << i)) {
+ on(i);
+ }
+ else {
+ off(i);
+ }
+ }
}
\ No newline at end of file
--- a/6LedBar.h Sun May 21 14:29:24 2017 +0000
+++ b/6LedBar.h Sun May 21 14:59:47 2017 +0000
@@ -30,7 +30,7 @@
*
* Example using on, off, toggle methods:
*
-*@code
+* @code
*
* #include "mbed.h"
* #include "6LedBar.h"
@@ -52,13 +52,13 @@
* }
*
*
-*@endcode
+* @endcode
*
* * * * * * * * * * * * * * * * * * * * * * * * *
*
* Example using mask methods:
*
-*@code
+* @code
*
* #include "mbed.h"
* #include "6LedBar.h"
@@ -68,7 +68,7 @@
*
* int main() {
*
-* leds.on_mask(0b010101);
+* leds.set_mask(0b010101);
*
* while(true) {
* leds.toggle_mask(0b111111);
@@ -76,7 +76,7 @@
* }
* }
*
-*@endcode
+* @endcode
*
**/