TEST
Dependents: ADXL345Test ADXL345Test1
Fork of TM1638 by
Diff: TM1638.cpp
- Revision:
- 3:25ddabfadc8c
- Parent:
- 2:532ce15ea9ec
- Child:
- 4:b2bbdc58967e
--- 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