PT6311 VFD driver lib. Initial version, supports VFDEM2 DVD player display.

Dependents:   mbed_PT6311

Revision:
0:43499fc489c6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Font_16Seg.h	Wed Jan 20 19:05:43 2016 +0000
@@ -0,0 +1,275 @@
+/* mbed VFD Font Library, for Princeton PT6311 VFD controller as used in VFDEM2
+ * Copyright (c) 2016, v01: WH, Initial version for VFDEM2
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef MBED_FONT_16SEG_H
+#define MBED_FONT_16SEG_H
+
+// Select one of the testboards for Princeton PT6312 VFD controller
+#include "PT6311_Config.h"
+
+#if (VFDEM2_TEST == 1) 
+//#if (1) 
+// Segment bit positions for 14 or 16 Segment display using the VFDEM2 mapping for PT6311
+// Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_16S 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.
+//
+//           A1   A2
+//          ---- ----
+//         |H\ J|  /K|     
+//       F |  \ | /  | B    
+//         |G1 \|/ G2|     
+//          --- + ---
+//         |   /|\   |     
+//       E |  / | \  | C    
+//         |N/ M|  \L|     
+//          ---- ----    * DP
+//           D1   D2
+//
+#define S16_D1   0x0004  // Assuming 2 part D segment
+#define S16_D2   0x0004
+#define S16_E    0x0008
+#define S16_N    0x0010
+#define S16_M    0x0020
+#define S16_L    0x0040
+#define S16_C    0x0080
+#define S16_G2   0x0100  // 2 part G segment
+#define S16_G1   0x0200
+#define S16_F    0x0400
+#define S16_H    0x0800
+#define S16_J    0x1000 
+#define S16_K    0x2000
+#define S16_B    0x4000
+#define S16_A1   0x8000  // Assuming 2 part A segment
+#define S16_A2   0x8000
+
+#define S16_S    0x0000  // NA
+
+//Icons All Grids
+//#define S16_DP   0x8000  // Assuming single DP segment
+
+//Icons Grid 1
+#define S16_CIR  0x0008
+#define S16_PIE_R 0x0010
+#define S16_PIE_G 0x0020
+#define S16_PIE_B 0x0040
+#define S16_STP  0x0080
+#define S16_PSE  0x0100
+#define S16_PLY  0x0200
+#define S16_RR   0x0400
+#define S16_LL   0x0800
+#define S16_PCM  0x1000
+#define S16_DTS  0x2000
+#define S16_MIC  0x4000
+#define S16_DLB  0x8000
+#define S16_ICON_GR1  (S16_CIR | S16_PIE_R | S16_PIE_G | S16_PIE_B | S16_STP | S16_PSE | S16_PLY | S16_RR | S16_LL | S16_PCM | S16_DTS | S16_MIC | S16_DLB)
+
+//Icons Grid 2
+#define S16_REC  0x0001
+#define S16_ICON_GR2  (S16_REC)
+
+//Icons Grid 3
+#define S16_PRG  0x0001
+#define S16_RND  0x0002
+#define S16_ICON_GR3  (S16_PRG | S16_RND)
+
+//Icons Grid 4
+#define S16_DP8  0x0001
+#define S16_COL8 0x0002
+#define S16_ICON_GR4  (S16_DP8 | S16_COL8)
+
+//Icons Grid 5
+#define S16_ANG  0x0001
+#define S16_ZM   0x0002
+#define S16_ICON_GR5  (S16_ANG | S16_ZM)
+
+//Icons Grid 6
+#define S16_PBC  0x0001
+#define S16_COL6 0x0002
+#define S16_ICON_GR6  (S16_PBC | S16_COL6)
+
+//Icons Grid 7
+#define S16_ICON_GR7  (0x0000)
+
+//Icons Grid 8
+#define S16_ICON_GR8  (0x0000)
+
+//Icons Grid 9
+#define S16_ICON_GR9  (0x0000)
+
+//Icons Grid 10
+#define S16_ICON_GR10 (0x0000)
+
+//Icons Grid 11
+#define S16_ICON_GR11 (0x0000)
+
+//Icons Grid 12
+#define S16_MP3  0x0008
+#define S16_CDDA 0x0010
+#define S16_SS   0x0020
+#define S16_VCD  0x0040
+#define S16_DVD  0x0080
+#define S16_ARW  0x0100
+#define S16_ONE  0x0200
+#define S16_ALL  0x0400
+#define S16_AA   0x0800
+#define S16_BB   0x1000
+#define S16_TTL  0x2000
+#define S16_CHP  0x4000
+#define S16_ICON_GR12 (S16_MP3 | S16_CDDA | S16_SS | S16_VCD | S16_DVD | S16_ARW | S16_ONE | S16_ALL | S16_AA | S16_BB | S16_TTL | S16_CHP)
+
+
+//Mask for blending out and restoring Icons
+extern const char MASK_ICON_GRID[][3]; 
+
+//One mask pattern will be sufficient assuming that all digits use the same mapping.
+//#define S16_ICON_MSK (S16_COL3)
+
+#endif
+
+
+// ASCII Font definitions for segments in each character
+//
+//32 0x20
+#define C16_SPC  (0x0000)    //Space
+#define C16_EXC  (S16_B | S16_C) //!
+#define C16_QTE  (S16_B | S16_F) //"
+#define C16_HSH  (S16_B | S16_C | S16_D1 | S16_D2 | S16_G1 | S16_G2 | S16_J | S16_M) //#
+#define C16_DLR  (S16_A1 | S16_A2 | S16_C | S16_D1 | S16_D2 | S16_F | S16_G1 | S16_G2 | S16_J | S16_M | S16_S) //$
+#define C16_PCT  (S16_C | S16_F | S16_K | S16_N | S16_S) //%
+//#define C16_AMP    (S16_A1 | S16_C | S16_D1 | S16_D2 | S16_E | S16_G1 | S16_J | S16_H | S16_L) // Not correct when J and M are linked
+#define C16_AMP  (S16_A1 | S16_A2 | S16_C | S16_D1 | S16_D2 | S16_H | S16_K | S16_L | S16_N | S16_S) //&
+#define C16_ACC  (S16_B) //'
+#define C16_LBR  (S16_K | S16_L) //(
+#define C16_RBR  (S16_H | S16_N) //)
+#define C16_MLT  (S16_G1 | S16_G2 | S16_J | S16_M | S16_K | S16_L | S16_H | S16_N | S16_S)  //*
+#define C16_PLS  (S16_G1 | S16_G2 | S16_J | S16_M | S16_S) //+
+#define C16_CMA  (S16_C) //,
+#define C16_MIN  (S16_G1 | S16_G2 | S16_S) //-
+#define C16_DOT  (S16_C) //.
+#define C16_RS   (S16_K | S16_N  | S16_S)  // /
+//48 0x30 digits
+#define C16_0    (S16_A1 | S16_A2 | S16_B | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F)
+#define C16_1    (S16_B  | S16_C)
+#define C16_2    (S16_A1 | S16_A2 | S16_B | S16_D1 | S16_D2 | S16_E  | S16_G1 | S16_G2 | S16_S)
+#define C16_3    (S16_A1 | S16_A2 | S16_B | S16_C  | S16_D1 | S16_D2 | S16_G2 | S16_S)
+#define C16_4    (S16_B  | S16_C  | S16_F | S16_G1 | S16_G2 | S16_S)
+#define C16_5    (S16_A1 | S16_A2 | S16_C | S16_D1 | S16_D2 | S16_F | S16_G1 | S16_G2 | S16_S)
+#define C16_6    (S16_A1 | S16_A2 | S16_C | S16_D1 | S16_D2 | S16_E | S16_F  | S16_G1 | S16_G2 | S16_S)
+#define C16_7    (S16_A1 | S16_A2 | S16_B | S16_C)
+#define C16_8    (S16_A1 | S16_A2 | S16_B | S16_C  | S16_D1 | S16_D2 | S16_E | S16_F  | S16_G1 | S16_G2 | S16_S)
+#define C16_9    (S16_A1 | S16_A2 | S16_B | S16_C  | S16_D1 | S16_D2 | S16_F | S16_G1 | S16_G2 | S16_S)
+//58 0x3A
+#define C16_COL  (S16_D1 | S16_D2 | S16_G1 | S16_G2 | S16_S) // :
+#define C16_SCL  (S16_D1 | S16_D2 | S16_G1 | S16_G2 | S16_S) // ;
+#define C16_LT   (S16_K  | S16_L  | S16_S)               // <
+#define C16_EQ   (S16_D1 | S16_D2 | S16_G1 | S16_G2 | S16_S) // =
+#define C16_GT   (S16_H  | S16_N  | S16_S)               // >   
+//#define C16_QM   (S16_A1 | S16_A2 | S16_B | S16_G2 | S16_M) // Not correct when J and M are linked
+#define C16_QM   (S16_A1 | S16_A2 | S16_B | S16_G2 | S16_N | S16_S)  // ?
+//64 0x40
+//#define C16_AT   (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E | S16_G1  | S16_M | S16_S) // Not correct when J and M are linked
+#define C16_AT   (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_G1 | S16_S)  // @
+#define C16_A    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_E  | S16_F  | S16_G1 | S16_G2 | S16_S)  // Upper case alphabet
+#define C16_B    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_J  | S16_M  | S16_G2 | S16_S)
+#define C16_C    (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_E  | S16_F)
+#define C16_D    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_J  | S16_M  | S16_S)
+#define C16_E    (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_E  | S16_F  | S16_G1 | S16_S)
+#define C16_F    (S16_A1 | S16_A2 | S16_E  | S16_F  | S16_G1 | S16_S)
+#define C16_G    (S16_A1 | S16_A2 | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F  | S16_G2 | S16_S)
+#define C16_H    (S16_B  | S16_C  | S16_E  | S16_F  | S16_G1 | S16_G2 | S16_S)
+#define C16_I    (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_J  | S16_M  | S16_S)
+#define C16_J    (S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E)
+#define C16_K    (S16_E  | S16_F  | S16_G1 | S16_K  | S16_L  | S16_S)
+#define C16_L    (S16_D1 | S16_D2 | S16_E  | S16_F)
+#define C16_M    (S16_B  | S16_C  | S16_E  | S16_F  | S16_H  | S16_K  | S16_S)
+#define C16_N    (S16_B  | S16_C  | S16_E  | S16_F  | S16_H  | S16_L  | S16_S)
+#define C16_O    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F)
+#define C16_P    (S16_A1 | S16_A2 | S16_B  | S16_E  | S16_F  | S16_G1 | S16_G2 | S16_S)
+#define C16_Q    (S16_A1 | S16_A2 | S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F  | S16_L)
+#define C16_R    (S16_A1 | S16_A2 | S16_B  | S16_E  | S16_F  | S16_G1 | S16_G2 | S16_L  | S16_S)
+#define C16_S    (S16_A1 | S16_A2 | S16_C  | S16_D1 | S16_D2 | S16_F  | S16_G1 | S16_G2 | S16_S)
+#define C16_T    (S16_A1 | S16_A2 | S16_J  | S16_M  | S16_S)
+#define C16_U    (S16_B  | S16_C  | S16_D1 | S16_D2 | S16_E  | S16_F)
+#define C16_V    (S16_E  | S16_F  | S16_N  | S16_K  | S16_S)
+#define C16_W    (S16_B  | S16_C  | S16_E  | S16_F  | S16_L  | S16_N  | S16_S)
+#define C16_X    (S16_H  | S16_K  | S16_L  | S16_N  | S16_S)
+//#define C16_Y    (S16_H | S16_K | S16_M | S16_S) // Not correct when J and M are linked
+#define C16_Y    (S16_B  | S16_C  | S16_D1 | S16_D2 | S16_F  | S16_G1 | S16_G2 | S16_S)
+#define C16_Z    (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_K  | S16_N  | S16_S)
+//91 0x5B
+#define C16_SBL  (S16_A1 | S16_D1 | S16_E  | S16_F)  // [
+#define C16_LS   (S16_H  | S16_L  | S16_S)           // left slash
+#define C16_SBR  (S16_A2 | S16_B | S16_C | S16_D2)   // ]
+#define C16_PWR  (S16_L  | S16_N  | S16_S)           // ^
+#define C16_UDS  (S16_D1 | S16_D2)                   // _
+#define C16_DSH  (S16_H)                             // `  
+//97 0x61
+// a...z No defines provided. Just use the Upper case characters again
+//122
+
+//123 0x7B
+#define C16_CBL  (S16_G1 | S16_J  | S16_M  | S16_S)          // {
+#define C16_OR   (S16_J  | S16_M  | S16_S)                   // |
+#define C16_CBR  (S16_G2 | S16_J  | S16_M  | S16_S)          // }
+#define C16_TLD  (S16_B  | S16_E  | S16_G1 | S16_G2 | S16_S) // ~
+#define C16_DEL  (0x0000)
+
+//User Defined Characters (some examples)
+#define UDC16_SANDHR  (S16_A1 | S16_A2 | S16_D1 | S16_D2 | S16_H  | S16_K | S16_L | S16_N | S16_S)  //Sandhour
+#define UDC16_DGR     (S16_A  | S16_B  | S16_F | S16_G)  // degrees
+
+#if(0)
+#define UDC16_WHEEL0  (S16_G1 | S16_G2 | S16_S)  // -
+#define UDC16_WHEEL1  (S16_H  | S16_L  | S16_S)  /* \ */
+#define UDC16_WHEEL2  (S16_J  | S16_M  | S16_S)  // |
+#define UDC16_WHEEL3  (S16_K  | S16_N  | S16_S)  // /
+#define UDC16_WHEEL4  (S16_G1 | S16_G2 | S16_S)  // -
+#define UDC16_WHEEL5  (S16_H  | S16_L  | S16_S)  /* \ */
+#define UDC16_WHEEL6  (S16_J  | S16_M  | S16_S)  // |
+#define UDC16_WHEEL7  (S16_K  | S16_N  | S16_S)  // /
+#else
+#define UDC16_WHEEL0  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_G1 | S16_G2 | S16_S)  // -
+#define UDC16_WHEEL1  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_H  | S16_L  | S16_S)  /* \ */
+#define UDC16_WHEEL2  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_J  | S16_M  | S16_S)  // |
+#define UDC16_WHEEL3  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_K  | S16_N  | S16_S)  // /
+#define UDC16_WHEEL4  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_G1 | S16_G2 | S16_S)  // -
+#define UDC16_WHEEL5  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_H  | S16_L  | S16_S)  /* \ */
+#define UDC16_WHEEL6  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_J  | S16_M  | S16_S)  // |
+#define UDC16_WHEEL7  (S16_A1 | S16_A2 | S16_B | S16_C | S16_D1 | S16_D2 | S16_E | S16_F | S16_K  | S16_N  | S16_S)  // /
+#endif
+
+// Font data selection for transmission to PT6311 memory
+#define LO(x)  ( x & 0xFF)
+#define MD(x)  ((x >>  8) & 0xFF)
+#define HI(x)  ((x >> 16) & 0xFF)
+
+// ASCII Font definition table
+//
+#define FONT_16S_START     0x20
+#define FONT_16S_END       0x7F
+//#define FONT_16S16_LR_CHARS (FONT_16S16_END - FONT_16S16_START + 1)
+extern const short FONT_16S[]; 
+
+
+// Wheel animation definition table
+extern const int WHEEL_ANI[]; 
+#endif                         
\ No newline at end of file