Sensor Watch  0.0.0
A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
watch_private_display.h
1 /*
2  * MIT License
3  *
4  * Copyright (c) 2020 Joey Castillo
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef _WATCH_PRIVATE_DISPLAY_H_INCLUDED
25 #define _WATCH_PRIVATE_DISPLAY_H_INCLUDED
26 
27 #include "hpl_slcd_config.h"
28 #include "driver_init.h"
29 
30 static const uint8_t Character_Set[] =
31 {
32  0b00000000, //
33  0b01100000, // ! (L in the top half for positions 4 and 6)
34  0b00100010, // "
35  0b01100011, // # (degree symbol, hash mark doesn't fit)
36  0b00000000, // $ (unused)
37  0b00000000, // % (unused)
38  0b01000100, // & ("lowercase 7" for positions 4 and 6)
39  0b00100000, // '
40  0b00111001, // (
41  0b00001111, // )
42  0b00000000, // * (unused)
43  0b11000000, // + (only works in position 0)
44  0b00000100, // ,
45  0b01000000, // -
46  0b01000000, // . (same as -, semantically most useful)
47  0b00010010, // /
48  0b00111111, // 0
49  0b00000110, // 1
50  0b01011011, // 2
51  0b01001111, // 3
52  0b01100110, // 4
53  0b01101101, // 5
54  0b01111101, // 6
55  0b00000111, // 7
56  0b01111111, // 8
57  0b01101111, // 9
58  0b00000000, // : (unused)
59  0b00000000, // ; (unused)
60  0b01011000, // <
61  0b01001000, // =
62  0b01001100, // >
63  0b01010011, // ?
64  0b11111111, // @ (all segments on)
65  0b01110111, // A
66  0b01111111, // B
67  0b00111001, // C
68  0b00111111, // D
69  0b01111001, // E
70  0b01110001, // F
71  0b00111101, // G
72  0b01110110, // H
73  0b10001001, // I (only works in position 0)
74  0b00001110, // J
75  0b01110101, // K
76  0b00111000, // L
77  0b10110111, // M (only works in position 0)
78  0b00110111, // N
79  0b00111111, // O
80  0b01110011, // P
81  0b01100111, // Q
82  0b11110111, // R (only works in position 1)
83  0b01101101, // S
84  0b10000001, // T (only works in position 0; set (1, 12) to make it work in position 1)
85  0b00111110, // U
86  0b00111110, // V
87  0b10111110, // W (only works in position 0)
88  0b01111110, // X
89  0b01101110, // Y
90  0b00011011, // Z
91  0b00111001, // [
92  0b00100100, // backslash
93  0b00001111, // ]
94  0b00100011, // ^
95  0b00001000, // _
96  0b00000010, // `
97  0b01011111, // a
98  0b01111100, // b
99  0b01011000, // c
100  0b01011110, // d
101  0b01111011, // e
102  0b01110001, // f
103  0b01101111, // g
104  0b01110100, // h
105  0b00010000, // i
106  0b01000010, // j (appears as superscript to work in more positions)
107  0b01110101, // k
108  0b00110000, // l
109  0b10110111, // m (only works in position 0)
110  0b01010100, // n
111  0b01011100, // o
112  0b01110011, // p
113  0b01100111, // q
114  0b01010000, // r
115  0b01101101, // s
116  0b01111000, // t
117  0b01100010, // u (appears in (u)pper half to work in more positions)
118  0b00011100, // v (looks like u but in the lower half)
119  0b10111110, // w (only works in position 0)
120  0b01111110, // x
121  0b01101110, // y
122  0b00011011, // z
123  0b00111001, // {
124  0b00110000, // |
125  0b00001111, // }
126  0b00000001, // ~
127 };
128 
129 static const uint64_t Segment_Map[] = {
130  0x4e4f0e8e8f8d4d0d, // Position 0, mode
131  0xc8c4c4c8b4b4b0b, // Position 1, mode (Segments B and C shared, as are segments E and F)
132  0xc049c00a49890949, // Position 2, day of month (Segments A, D, G shared; missing segment F)
133  0xc048088886874707, // Position 3, day of month
134  0xc053921252139352, // Position 4, clock hours (Segments A and D shared)
135  0xc054511415559594, // Position 5, clock hours
136  0xc057965616179716, // Position 6, clock minutes (Segments A and D shared)
137  0xc041804000018a81, // Position 7, clock minutes
138  0xc043420203048382, // Position 8, clock seconds
139  0xc045440506468584, // Position 9, clock seconds
140 };
141 
142 static const uint8_t Num_Chars = 10;
143 
144 void watch_display_character(uint8_t character, uint8_t position);
145 
146 #endif