maxint-rd / TM16xx

Arduino TM16xx library for LED & KEY and LED Matrix modules based on TM1638, TM1637, TM1640 and similar chips. Simply use print() on 7-segment and use Adafruit GFX on matrix.
164 stars 34 forks source link

TM1650 read key command better compatibility with FD650B #19

Closed peter-kutak closed 5 months ago

peter-kutak commented 2 years ago

FD650B (clone of TM1650) need to read from 0x4f this correspond to datasheet TM1650_V2.1 page 7

maxint-rd commented 5 months ago

Hello @peter-kutak , please excuse me for not replying any sooner. Somehow this pull request didn't catch my attention. I would like to merge your change, as it seems compatible. However, just to take caution I wanted to read the version of the datasheet you mention. Unfortunately I couldn't find it. Do you have a copy?

peter-kutak commented 5 months ago

I think it was Chinese datasheet TM1650_V2.1.pdf at page7 top-right

https://github.com/allenchak/TM1650_STM8/blob/master/datasheets/TM1650_V2.1.pdf

https://github.com/allenchak/TM1650_STM8/tree/master/datasheets

peter-kutak commented 5 months ago

also point 7 on page 3 bottom command: read key command 4FH;

maxint-rd commented 5 months ago

Hello @peter-kutak , thank you for providing a link. After some more searching, I also found an English translation of that version of the TM1650 datasheet on the Titan Micro website. For future reference I uploaded a copy here in the library documents folder on Github.

Looking into the TM1650 datasheet: the documentation of the read command appears to be conflicting. As you correctly state it mentions the value 0x4F in point "7. Read key sequence" of section "V. Communication sequence format" (bottom page 5 in the English datasheet). It also shows value 0x4F as read command in "VI. Complete operation flow chart" (top page 12 English datasheet). However, in the table in point "1, Data command settings" of section "V. Instruction set description" (top page 8) it lists Instruction value 0x49 as Read Command and below the table it mentions for bits B1 and B2 this: "The bit X of can be 1 or 0. It is recommended to write 0. Others must be fixed". I guess I followed that recommendation. (I read the same in the Chinese version 2.1)

For completeness I also looked into the FD650 datasheet, but couldn't find a command overview.

Understanding that, although not recommended, the value 0x4F as read command should work just as well; I will merge your pull request. Thank you for your contribution!

peter-kutak commented 5 months ago

Hello, i only have FD650, it needs 0x4f i hoped you can test on original hardware Thanks for your work - my gadget is still working