TM1638 LED controller. Max 80 LEDs, Max 24 Key scan. Supports LED&KEY, QYF-TM1638 and JY-LKM1638 module.
Dependents: mbed_TM1638 Otjimaniya RL0201-V1
See here for more information.
Diff: TM1638.cpp
- Revision:
- 3:25ddabfadc8c
- Parent:
- 2:532ce15ea9ec
- Child:
- 4:b2bbdc58967e
diff -r 532ce15ea9ec -r 25ddabfadc8c TM1638.cpp
--- a/TM1638.cpp Fri Jan 15 19:09:59 2016 +0000
+++ b/TM1638.cpp Tue Jan 19 18:58:22 2016 +0000
@@ -190,6 +190,7 @@
* @param char data
* @return bitreversed data
*/
+#if(1)
char TM1638::_flip(char data) {
char value=0;
@@ -203,7 +204,14 @@
if (data & 0x80) {value |= 0x01;} ;
return value;
}
+#else
+char TM1638::_flip(char data) {
+ data = (((data & 0xAA) >> 1) | ((data & 0x55) << 1));
+ data = (((data & 0xCC) >> 2) | ((data & 0x33) << 2));
+ return (((data & 0xF0) >> 4) | ((data & 0x0F) << 4));
+}
+#endif
/** Write command and parameter to TM1638
* @param int cmd Command byte
TM1638 LED controller (80 LEDs max), Keyboard scan (24 keys max)