Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Font_7Seg.h@0:27f32a087e5a, 2015-11-21 (annotated)
- Committer:
- wim
- Date:
- Sat Nov 21 16:43:15 2015 +0000
- Revision:
- 0:27f32a087e5a
- Child:
- 1:1adf993a3e34
First version
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| wim | 0:27f32a087e5a | 1 | /* mbed LED Font Library, for Princeton PT6964 controller as used in DVD538A |
| wim | 0:27f32a087e5a | 2 | * Copyright (c) 2015, v01: WH, Initial version |
| wim | 0:27f32a087e5a | 3 | * |
| wim | 0:27f32a087e5a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| wim | 0:27f32a087e5a | 5 | * of this software and associated documentation files (the "Software"), to deal |
| wim | 0:27f32a087e5a | 6 | * in the Software without restriction, including without limitation the rights |
| wim | 0:27f32a087e5a | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| wim | 0:27f32a087e5a | 8 | * copies of the Software, and to permit persons to whom the Software is |
| wim | 0:27f32a087e5a | 9 | * furnished to do so, subject to the following conditions: |
| wim | 0:27f32a087e5a | 10 | * |
| wim | 0:27f32a087e5a | 11 | * The above copyright notice and this permission notice shall be included in |
| wim | 0:27f32a087e5a | 12 | * all copies or substantial portions of the Software. |
| wim | 0:27f32a087e5a | 13 | * |
| wim | 0:27f32a087e5a | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| wim | 0:27f32a087e5a | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| wim | 0:27f32a087e5a | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| wim | 0:27f32a087e5a | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| wim | 0:27f32a087e5a | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| wim | 0:27f32a087e5a | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| wim | 0:27f32a087e5a | 20 | * THE SOFTWARE. |
| wim | 0:27f32a087e5a | 21 | */ |
| wim | 0:27f32a087e5a | 22 | #ifndef MBED_FONT_7SEG_H |
| wim | 0:27f32a087e5a | 23 | #define MBED_FONT_7SEG_H |
| wim | 0:27f32a087e5a | 24 | |
| wim | 0:27f32a087e5a | 25 | // Segment bit positions for 7 Segment display using the DVD538A mapping for PT6964 |
| wim | 0:27f32a087e5a | 26 | // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below |
| wim | 0:27f32a087e5a | 27 | // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment |
| wim | 0:27f32a087e5a | 28 | // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers. |
| wim | 0:27f32a087e5a | 29 | // |
| wim | 0:27f32a087e5a | 30 | #define S_D 0x0008 |
| wim | 0:27f32a087e5a | 31 | #define S_C 0x0010 |
| wim | 0:27f32a087e5a | 32 | #define S_B 0x0020 |
| wim | 0:27f32a087e5a | 33 | #define S_A 0x0040 |
| wim | 0:27f32a087e5a | 34 | #define S_E 0x0080 |
| wim | 0:27f32a087e5a | 35 | #define S_F 0x0100 |
| wim | 0:27f32a087e5a | 36 | #define S_G 0x0200 |
| wim | 0:27f32a087e5a | 37 | |
| wim | 0:27f32a087e5a | 38 | #define S_LD2 0x0001 |
| wim | 0:27f32a087e5a | 39 | #define S_LD1 0x0002 |
| wim | 0:27f32a087e5a | 40 | #define S_CD 0x0008 |
| wim | 0:27f32a087e5a | 41 | #define S_DVD 0x0010 |
| wim | 0:27f32a087e5a | 42 | #define S_PSE 0x0020 |
| wim | 0:27f32a087e5a | 43 | #define S_PLY 0x0040 |
| wim | 0:27f32a087e5a | 44 | #define S_COL 0x0080 |
| wim | 0:27f32a087e5a | 45 | #define S_MP4 0x0100 |
| wim | 0:27f32a087e5a | 46 | #define S_MP3 0x0200 |
| wim | 0:27f32a087e5a | 47 | |
| wim | 0:27f32a087e5a | 48 | //Mask for blending out and restoring Icons |
| wim | 0:27f32a087e5a | 49 | //One mask pattern will be sufficient assuming that all digits use the same mapping. |
| wim | 0:27f32a087e5a | 50 | #define S_ICON_MSK (0x0000) |
| wim | 0:27f32a087e5a | 51 | |
| wim | 0:27f32a087e5a | 52 | |
| wim | 0:27f32a087e5a | 53 | // ASCII Font definitions for segments in each character |
| wim | 0:27f32a087e5a | 54 | // |
| wim | 0:27f32a087e5a | 55 | //48 0x30 digits |
| wim | 0:27f32a087e5a | 56 | #define C_0 (S_A | S_B | S_C | S_D | S_E | S_F) |
| wim | 0:27f32a087e5a | 57 | #define C_1 (S_B | S_C) |
| wim | 0:27f32a087e5a | 58 | #define C_2 (S_A | S_B | S_D | S_E | S_G) |
| wim | 0:27f32a087e5a | 59 | #define C_3 (S_A | S_B | S_C | S_D | S_G) |
| wim | 0:27f32a087e5a | 60 | #define C_4 (S_B | S_C | S_F | S_G) |
| wim | 0:27f32a087e5a | 61 | #define C_5 (S_A | S_C | S_D | S_F | S_G) |
| wim | 0:27f32a087e5a | 62 | #define C_6 (S_A | S_C | S_D | S_E | S_F | S_G) |
| wim | 0:27f32a087e5a | 63 | #define C_7 (S_A | S_B | S_C) |
| wim | 0:27f32a087e5a | 64 | #define C_8 (S_A | S_B | S_C | S_D | S_E | S_F | S_G) |
| wim | 0:27f32a087e5a | 65 | #define C_9 (S_A | S_B | S_C | S_D | S_F | S_G) |
| wim | 0:27f32a087e5a | 66 | //64 0x40 |
| wim | 0:27f32a087e5a | 67 | #define C_A (S_A | S_B | S_C | S_E | S_F | S_G ) // Upper case alphabet |
| wim | 0:27f32a087e5a | 68 | #define C_B (S_C | S_D | S_E | S_F | S_G) |
| wim | 0:27f32a087e5a | 69 | #define C_C (S_A | S_D | S_E | S_F) |
| wim | 0:27f32a087e5a | 70 | #define C_D (S_B | S_C | S_D | S_E | S_G) |
| wim | 0:27f32a087e5a | 71 | #define C_E (S_A | S_D | S_E | S_F | S_G) |
| wim | 0:27f32a087e5a | 72 | #define C_F (S_A | S_E | S_F | S_G) |
| wim | 0:27f32a087e5a | 73 | //97 0x61 |
| wim | 0:27f32a087e5a | 74 | #define C_a (S_A | S_B | S_C | S_E | S_F | S_G ) // Lower case alphabet |
| wim | 0:27f32a087e5a | 75 | #define C_b (S_C | S_D | S_E | S_F | S_G) |
| wim | 0:27f32a087e5a | 76 | #define C_c (S_A | S_D | S_E | S_F) |
| wim | 0:27f32a087e5a | 77 | #define C_d (S_B | S_C | S_D | S_E | S_G) |
| wim | 0:27f32a087e5a | 78 | #define C_e (S_A | S_D | S_E | S_F | S_G) |
| wim | 0:27f32a087e5a | 79 | #define C_f (S_A | S_E | S_F | S_G) |
| wim | 0:27f32a087e5a | 80 | |
| wim | 0:27f32a087e5a | 81 | // Font data selection for transmission to PT6964 memory |
| wim | 0:27f32a087e5a | 82 | #define LO(x) ( x & 0xFF) |
| wim | 0:27f32a087e5a | 83 | #define HI(x) ((x >> 8) & 0xFF) |
| wim | 0:27f32a087e5a | 84 | |
| wim | 0:27f32a087e5a | 85 | |
| wim | 0:27f32a087e5a | 86 | // ASCII Font definition table |
| wim | 0:27f32a087e5a | 87 | // |
| wim | 0:27f32a087e5a | 88 | //#define FONT_7S_START 0x20 |
| wim | 0:27f32a087e5a | 89 | //#define FONT_7S_END 0x7F |
| wim | 0:27f32a087e5a | 90 | //#define FONT_7S_NR_CHARS (FONT_7S_END - FONT_7S_START + 1) |
| wim | 0:27f32a087e5a | 91 | extern const char FONT_7S[][2]; |
| wim | 0:27f32a087e5a | 92 | |
| wim | 0:27f32a087e5a | 93 | #endif |
PT6964 LED controller (70 LEDs max), Keyboard scan (20 keys max)