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.
Fork of BubbleDisplay by
Revision 3:1d85399fdea3, committed 2016-03-29
- Comitter:
- MACRUM
- Date:
- Tue Mar 29 07:51:47 2016 +0000
- Parent:
- 2:3604f34e944b
- Commit message:
- Add a write(uint16_t) method
Changed in this revision
| bubble.cpp | Show annotated file Show diff for this revision Revisions of this file |
| bubble.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/bubble.cpp Thu Mar 26 08:10:08 2015 +0000
+++ b/bubble.cpp Tue Mar 29 07:51:47 2016 +0000
@@ -44,7 +44,9 @@
* maps the pins in a simple way for the LPC11U24.
*/
BubbleDisplay::BubbleDisplay(){
+#if defined(TARGET_LPC1768) || defined(TARGET_LPC11U24)
init(p21,p22,p23,p24,p25,p26,p36,p35,p34,p33,p30,p29);
+#endif
}
/*
@@ -158,4 +160,16 @@
_chrs[1] = c[1];
_chrs[2] = c[2];
_chrs[3] = c[3];
-}
\ No newline at end of file
+}
+
+/*
+ * This writes a sequence of integer number
+ * to the seven-segment displays.
+ */
+void BubbleDisplay::write(uint16_t num){
+ num %= 10000;
+ _chrs[0] = (num/1000);
+ _chrs[1] = ((num/100)%10);
+ _chrs[2] = (((num/10)%100)%10);
+ _chrs[3] = (((num%1000)%100)%10);
+}
--- a/bubble.h Thu Mar 26 08:10:08 2015 +0000
+++ b/bubble.h Tue Mar 29 07:51:47 2016 +0000
@@ -182,6 +182,13 @@
* to the seven-segment displays.
*/
void write(char* c);
+
+ /*
+ * This writes a sequence of integer number
+ * to the seven-segment displays.
+ */
+ void write(uint16_t num);
+
private:
/*
* This is a constructor helper function

QDSP-6040