forked from echox/Hacklace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
executable file
·125 lines (106 loc) · 5.14 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* config.h
*
*/
/**********************************************************************************
Description: Configuration file for Hacklace
Author: Frank Andre
License: This software is distributed under the creative commons license
CC-BY-NC-SA.
Disclaimer: This software is provided by the copyright holder "as is" and any
express or implied warranties, including, but not limited to, the
implied warranties of merchantability and fitness for a particular
purpose are disclaimed. In no event shall the copyright owner or
contributors be liable for any direct, indirect, incidental,
special, exemplary, or consequential damages (including, but not
limited to, procurement of substitute goods or services; loss of
use, data, or profits; or business interruption) however caused
and on any theory of liability, whether in contract, strict
liability, or tort (including negligence or otherwise) arising
in any way out of the use of this software, even if advised of
the possibility of such damage.
**********************************************************************************/
#ifndef CONFIG_H_
#define CONFIG_H_
/*************
* constants *
*************/
// processor clock frequency
#ifndef F_CPU
#define F_CPU 4000000
#endif
// timing
#define COLUMN_FREQ 1000 // display column frequency [Hz]
#define SYS_TIMER_FREQ 100 // system timer frequency [Hz]
#define OCR0A_CYCLE_TIME (uint8_t)(F_CPU / 1024.0 / COLUMN_FREQ + 0.5);
#define OCR0B_CYCLE_TIME (uint8_t)(F_CPU / 1024.0 / SYS_TIMER_FREQ + 0.5);
// raw display mode
#define ENABLE_RAW_DISP_MODE
// push button
#define PB_PORT PORTD
#define PB_PIN PIND
#define PB_BIT 6 // bit number of the pin where the push button is connected
#define PB_LONGPRESS_DELAY 100 // number of system timer cycles after which a longpress event is issued
// bit masks for push button events (do not change)
#define PB_PRESS (1<<0) // 1 = pressed, 0 = released
#define PB_RELEASE (0<<0)
#define PB_LONG (1<<1) // 1 = long press, 0 = short press
#define PB_ACK (1<<7) // 1 = key event has been processed
#define PB_LONGPRESS (PB_PRESS|PB_LONG)
#define PB_MASK (1<<PB_BIT) // mask to extract button state
// bit masks for scrolling mode (do not change)
#define MODE_BIDIR 0x80 // bidirectional scrolling
#define MODE_FRAME 0x08 // frame-by-frame scrolling (inc = +5)
#define MODE_DELAY 0x70 // delay between two scrolling cycles
#define MODE_SPEED 0x07 // scrolling speed
// messages in EEPROM
#define MSG_SIZE 256 // number of EEPROM bytes reserved for messages
// character font
// Uncomment the following line if you want the zero character to display with a diagonal line
// which makes it better distinguishable from the letter "O"
//#define ZERO_WITH_SLASH
// default message data
// A message is either a text or an animation to be displayed on the dot matrix.
// Note: In text-mode (inc = 1) a space of 1 column is inserted between each two characters.
// 0x20 = normal space (3+1 columns)
// 0x7F = short space (0+1 column)
// 0x9D = long space (5+1 columns), may be used as the last frame of an animation
const uint8_t messages[MSG_SIZE] EEMEM = {
0x54, 'H', 'a', 'c', 'k', 'l', 'a', 'c', 'e', ' ', '^', 'P', 0x00,
0x54, ' ', 'L', 'ö', 't', 's', 'p', 'a', 'ß', ' ', 'f', 'ü', 'r', ' ', 'a', 'l', 'l', 'e', '!', 0x9D, 0x00,
0x65, ' ', 'I', ' ', '^', 'R', ' ', 'R', 'a', 'u', 'm', 'Z', 'e', 'i', 't', 'L', 'a', 'b', 'o', 'r', 0x9D, 0x00,
0xC4, 0x8B, ' ', 0x8C, ' ', 0x8E, ' ', 0x8D, 0x00, // Monster
0x44, ' ', '^', 'm', ' ', '+', ' ', '^', 'n', ' ', '=', ' ', '^', 'R', 0x00,
0x0B, 0xA3, 0x9D, 0xA5, 0x9D, 0xA6, 0x9D, 0xA0, 0x9D, 0x00, // break-dance
0x04, ' ', '^', 'S', '^', 'S', '^', 'S', 0x9D, 0x00, // turn left
0x04, ' ', 0x94, 0x95, 0x95, ' ', 0x94, ' ', 0x95, 0x7F, 0x94, 0x9D, 0x00, // music
0x95, ' ', '|', ' ', 0x00, // scan
0x6C, '~', 'A', 0x00, // arrow
0x0D, '~', 'B', 0x00, // fire
0x4B, '~', 'C', 0x9D, 0x00, // bounce
0x44, 0x9D, 'B', 'e', 'r', 'g', 'e', ' ', '~', 'D', 0x00,
0x4A, '~', 'E', 0x00, // snow
0x3D, '~', 'F', 0x9D, 0x00, // tunnel
0x5A, '~', 'G', 0x00, // wink
0x34, '~', 'H', 0x00, // ecg
0x0E, '~', 'I', 0x00, // crazy checkers
0x4A, 0x91, 0x9D, 0x91, 0x9D, 0x00, // heartbeat
0x49, '~', 'J', 0x00, // tetris
0x5B, '~', 'K', 0x00, // glider
0x8B, '~', 'L', 0x9D, 0x00, // hop
0x6B, '~', 'M', 0x00, // pong
0x38, 0x9D, 0x9D, '~', 'N', 0x00, // house
0x6B, '~', 'O', 0x9D, 0x00, // rocket
0x64, 0x9D, '~', 'P', 0x9D, 0x00, // train
0x5B, '~', 'Q', 0x9D, 0x00, // explode
0x6C, '~', 'R', 0x00, // droplet
0x0E, '~', 'S', 0x00, // psycho
0x7D, '~', 'T', 0x9D, 0x00, // TV off
0x0D, '~', 'U', 0x00, // clock
0x00
};
// speed and delay conversion
// Convert speed / delay parameters from mode byte (range 0..7) to actual speed / delay values.
const uint8_t dly_conv[] PROGMEM = {0, 1, 2, 3, 5, 8, 13, 21};
const uint8_t spd_conv[] PROGMEM = {50, 30, 18, 11, 7, 5, 3, 2};
#endif /* CONFIG_H_ */