Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefine Pins #30

Open
ngsjo opened this issue Feb 21, 2023 · 1 comment
Open

Redefine Pins #30

ngsjo opened this issue Feb 21, 2023 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@ngsjo
Copy link

ngsjo commented Feb 21, 2023

Hello, I'm looking for where the pins are defined. We have a custom application for the 1620 chip and the pins are defined differently. I'm trying to figure out where in the library to redefine which segment of the display each output pin is connected to.

For whatever reason this is how the PCB designer set it up.
1620 PIN Segment
2 A
3 F
4 B
5 G
6 C
7 DP
8 D
9 E

@maxint-rd maxint-rd self-assigned this Feb 21, 2023
@maxint-rd maxint-rd added the question Further information is requested label Feb 21, 2023
@maxint-rd
Copy link
Owner

Hello Ngsjo,

At the moment there is no specific API in the library for using a modified segment order. The library kind-of expects the segments to be wired up correctly. Depending demand I may implement such API in a future version, but this won't be very soon. So you may need to make some modifications yourself, for which I'll give you some suggestions.

The pin definition is primarily hardcoded in the font (see TM16xxFonts.h). So you could change the font to get the desired result. (First focus on only the numbers in TM16XX_NUMBER_FONT).
The example TM16xx_setSegmentsDebug.ino may be handy to test the order of the segments. The example TM16xxDisplay_Print.ino is very simple and shows a counter,

A more evolved method is implemented in the TM1640Anode class. There a mapping function maps the segments in different order using these functions:
void TM1640Anode::setSegmentMap(const byte aMap[])
uint16_t TM1640Anode::mapSegments16(uint16_t segments)
void TM1640Anode::setSegments16(uint16_t segments, byte position)

If you're a programmer, you could use the TM1620 class as a base and make a derived TM1620ngsjo class that overwrites the setSegments() or the sendChar() method, to change the order of the segments (or perhaps also the position of the digits). Using such class allows you to still use all the features in the library without further changes.
The InvertedTM1638 class uses such a technique. That class is derived from the regular TM1638 class. It changes the sendChar() method to manipulate both reversed digits, as well as changed segment positions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants