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: Font_7Seg.h
- Revision:
- 4:b2bbdc58967e
- Parent:
- 2:532ce15ea9ec
diff -r 25ddabfadc8c -r b2bbdc58967e Font_7Seg.h --- a/Font_7Seg.h Tue Jan 19 18:58:22 2016 +0000 +++ b/Font_7Seg.h Sun Jan 31 12:11:06 2016 +0000 @@ -1,6 +1,7 @@ /* mbed LED Font Library, for TM1638 LED Controller * Copyright (c) 2015, v01: WH, Initial version, Test in LEDKEY8 - * 2016, v02: WH, Added ASCII alphabet, changed fonttable into short + * 2016, v02: WH, Added ASCII alphabet, changed fonttable into short + * 2016, v03: WH, Added QYF-TM1638 and LKM1638 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -109,6 +110,231 @@ extern const char MASK_ICON_GRID[][2]; #endif +#if (QYF_TEST == 1) +// Segment bit positions for 7 Segment display using the QYF mapping for TM1638 +// This display module uses a single byte of each grid to drive a specific segment of all digits. +// So the bits in byte 0 (Grid 1) drive all A-segments, the bits in byte 2 (Grid 2) drive all B-segments etc. +// Bit0 is for the segment in Digit 8, Bit1 is for the segment in Digit 7 etc.. This bit manipulation is handled in _putc(). +// +// The ASCII character defines and the FONT_7S const table below will be adapted automatically according to the bit-to-segment mapping. +// +// A +// ----- +// | | +// F | | B +// | G | +// ----- +// | | +// E | | C +// | | +// ----- * DP +// D +// +//Generic segment placeholders +#define S7_A 0x0001 +#define S7_B 0x0002 +#define S7_C 0x0004 +#define S7_D 0x0008 +#define S7_E 0x0010 +#define S7_F 0x0020 +#define S7_G 0x0040 +#define S7_DP 0x0080 + +//Mask for blending out and setting 7 segments digits +//#define MASK_7S_ALL = (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G} + +//Segments and Icons Grid 1 +#define S7_A1 0x0080 +#define S7_B1 0x0080 +#define S7_C1 0x0080 +#define S7_D1 0x0080 +#define S7_E1 0x0080 +#define S7_F1 0x0080 +#define S7_G1 0x0080 +#define S7_DP1 0x0080 +#define S7_ICON_GR1 (0x0000) + +//Segments and Icons Grid 2 +#define S7_A2 0x0040 +#define S7_B2 0x0040 +#define S7_C2 0x0040 +#define S7_D2 0x0040 +#define S7_E2 0x0040 +#define S7_F2 0x0040 +#define S7_G2 0x0040 +#define S7_DP2 0x0040 +#define S7_ICON_GR2 (0x0000) + +//Segments and Icons Grid 3 +#define S7_A3 0x0020 +#define S7_B3 0x0020 +#define S7_C3 0x0020 +#define S7_D3 0x0020 +#define S7_E3 0x0020 +#define S7_F3 0x0020 +#define S7_G3 0x0020 +#define S7_DP3 0x0020 +#define S7_ICON_GR3 (0x0000) + +//Segments and Icons Grid 4 +#define S7_A4 0x0010 +#define S7_B4 0x0010 +#define S7_C4 0x0010 +#define S7_D4 0x0010 +#define S7_E4 0x0010 +#define S7_F4 0x0010 +#define S7_G4 0x0010 +#define S7_DP4 0x0010 +#define S7_ICON_GR4 (0x0000) + +//Segments and Icons Grid 5 +#define S7_A5 0x0008 +#define S7_B5 0x0008 +#define S7_C5 0x0008 +#define S7_D5 0x0008 +#define S7_E5 0x0008 +#define S7_F5 0x0008 +#define S7_G5 0x0008 +#define S7_DP5 0x0008 +#define S7_ICON_GR5 (0x0000) + +//Segments and Icons Grid 6 +#define S7_A6 0x0004 +#define S7_B6 0x0004 +#define S7_C6 0x0004 +#define S7_D6 0x0004 +#define S7_E6 0x0004 +#define S7_F6 0x0004 +#define S7_G6 0x0004 +#define S7_DP6 0x0004 +#define S7_ICON_GR6 (0x0000) + +//Segments and Icons Grid 7 +#define S7_A7 0x0002 +#define S7_B7 0x0002 +#define S7_C7 0x0002 +#define S7_D7 0x0002 +#define S7_E7 0x0002 +#define S7_F7 0x0002 +#define S7_G7 0x0002 +#define S7_DP7 0x0002 +#define S7_ICON_GR7 (0x0000) + +//Segments and Icons Grid 8 +#define S7_A8 0x0001 +#define S7_B8 0x0001 +#define S7_C8 0x0001 +#define S7_D8 0x0001 +#define S7_E8 0x0001 +#define S7_F8 0x0001 +#define S7_G8 0x0001 +#define S7_DP8 0x0001 +#define S7_ICON_GR8 (0x0000) + +//Mask for blending out and restoring Icons +extern const char MASK_ICON_GRID[][2]; +#endif + +#if (LKM1638_TEST == 1) +// Segment bit positions for 7 Segment display using the LKM1638 mapping for TM1638 +// Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below +// will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment +// mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers. +// +// The ASCII character defines and the FONT_7S const table below will be adapted automatically according to the bit-to-segment mapping. +// +// A +// ----- +// | | +// F | | B +// | G | +// ----- +// | | +// E | | C +// | | +// ----- * DP +// D +// +//Generic segment placeholders +#define S7_A 0x0001 +#define S7_B 0x0002 +#define S7_C 0x0004 +#define S7_D 0x0008 +#define S7_E 0x0010 +#define S7_F 0x0020 +#define S7_G 0x0040 +#define S7_DP 0x0080 + +//Mask for blending out and setting 7 segments digits +//#define MASK_7S_ALL = (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G} + +//Icons Grid 1 +#define S7_DP1 0x0080 +#define S7_GR1 0x0100 +#define S7_RD1 0x0200 +#define S7_YL1 0x0300 +#define S7_ICON_GR1 (S7_RD1 | S7_GR1 | S7_YL1) +//#define S7_ICON_GR1 (S7_RD1 | S7_GR1 | S7_YL1 | S7_DP1) + +//Icons Grid 2 +#define S7_DP2 0x0080 +#define S7_GR2 0x0100 +#define S7_RD2 0x0200 +#define S7_YL2 0x0300 +#define S7_ICON_GR2 (S7_RD2 | S7_GR2 | S7_YL2) +//#define S7_ICON_GR2 (S7_RD2 | S7_GR2 | S7_YL2 | S7_DP2) + +//Icons Grid 3 +#define S7_DP3 0x0080 +#define S7_GR3 0x0100 +#define S7_RD3 0x0200 +#define S7_YL3 0x0300 +#define S7_ICON_GR3 (S7_RD3 | S7_GR3 | S7_YL3) +//#define S7_ICON_GR3 (S7_RD3 | S7_GR3 | S7_YL3 | S7_DP3) + +//Icons Grid 4 +#define S7_DP4 0x0080 +#define S7_GR4 0x0100 +#define S7_RD4 0x0200 +#define S7_YL4 0x0300 +#define S7_ICON_GR4 (S7_RD4 | S7_GR4 | S7_YL4) +//#define S7_ICON_GR4 (S7_RD4 | S7_GR4 | S7_YL4 | S7_DP4) + +//Icons Grid 5 +#define S7_DP5 0x0080 +#define S7_GR5 0x0100 +#define S7_RD5 0x0200 +#define S7_YL5 0x0300 +#define S7_ICON_GR5 (S7_RD5 | S7_GR5 | S7_YL5) +//#define S7_ICON_GR5 (S7_RD5 | S7_GR5 | S7_YL5 | S7_DP5) + +//Icons Grid 6 +#define S7_DP6 0x0080 +#define S7_GR6 0x0100 +#define S7_RD6 0x0200 +#define S7_YL6 0x0300 +#define S7_ICON_GR6 (S7_RD6 | S7_GR6 | S7_YL6) +//#define S7_ICON_GR6 (S7_RD6 | S7_GR6 | S7_YL6 | S7_DP6) + +//Icons Grid 7 +#define S7_DP7 0x0080 +#define S7_GR7 0x0100 +#define S7_RD7 0x0200 +#define S7_YL7 0x0300 +#define S7_ICON_GR7 (S7_RD7 | S7_GR7 | S7_YL7) +//#define S7_ICON_GR7 (S7_RD7 | S7_GR7 | S7_YL7 | S7_DP7) + +//Icons Grid 8 +#define S7_DP8 0x0080 +#define S7_GR8 0x0100 +#define S7_RD8 0x0200 +#define S7_YL8 0x0300 +#define S7_ICON_GR8 (S7_RD8 | S7_GR8 | S7_YL8) +//#define S7_ICON_GR8 (S7_RD8 | S7_GR8 | S7_YL8 | S7_DP8) + +//Mask for blending out and restoring Icons +extern const char MASK_ICON_GRID[][2]; +#endif // ASCII Font definitions for segments in each character //