-
Notifications
You must be signed in to change notification settings - Fork 1
/
macros.h
399 lines (353 loc) · 9.12 KB
/
macros.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
/*
* macros.h
*
* Created on: 26.05.2012
*****************************************************************************
* MCmega - Firmware for the Motorola MC micro radio
* to use it as an Amateur-Radio transceiver
*
* Copyright (C) 2013 Felix Erckenbrecht, DG1YFE
*
* ( AVR port of "MC70"
* Copyright (C) 2004 - 2013 Felix Erckenbrecht, DG1YFE)
*
* This file is part of MCmega.
*
* MCmega is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MCmega is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MCmega. If not, see <http://www.gnu.org/licenses/>.
*
****************************************************************************
*/
#ifndef MACROS_H_
#define MACROS_H_
#include "regmem.h"
#define EZA9
//#define BAND_2M
//#define BAND_70CM
// Timing
// Frequency of crystal in EVA5
#define XTAL F_CPU
// no scaling
#define SYSCLK XTAL
#define MENUTIMEOUT 40 // 4 sek Eingabetimeout
#define PLLCHKTIMEOUT 2 // 200ms Timeout für PLL Check
#define PTT_DEBOUNCE_VAL 20
#define TX_TO_RX_TIME 5 // 5 ms TX -> RX Umschaltung
#define RX_TO_TX_TIME 5 // 5 ms RX -> TX Umschaltung
#define DEFAULT_RF_PWR 0 // Hi Power (1) / Lo Power (0), only EVA9/EZA9
//************************
// Frequenzkram
//
//
#define RXZF UINT32_C(21400000)// 21,4 MHz IF (RX VCO has to be 21,4MHz below RX frequency)
#define FREF UINT32_C(14400000)// 14,4 MHz reference frequency
#define FOFF0 UINT32_C( 0)// Offset0
#define FOFF06 UINT32_C( 600000)// Offset1
#define FOFF76 UINT32_C( 7600000)// Offset2
#define FSTEP UINT32_C( 12500)// Schrittweite !> 3,5 kHz fuer f<458,3MHz
//( muss groesser sein als Frequenz/(Vorteiler*1023) )
//
#define PLLREF FREF/FSTEP
#define PLLLOCKWAIT 200 // Maximale Wartezeit in ms f�r PLL um einzurasten
//#define FSTEP 6250 // Schrittweite !> 3,5 kHz f�r f<458,3MHz ( mu� gr��er sein als Frequenz/(128*1023) )
//#define PLLREF 1152
//#define PLLREF 2304
#ifdef BAND_70CM
#define FBASE UINT32_C(430000000)// lowest frequency (for eeprom storage) = 140MHz (430 MHz with 70 cm)
#define FBASE_MEM_RECALL UINT32_C(400000000)
#define FDEF UINT32_C(433500000)// Default Frequency
#define FTXOFF FOFF76 // Default Offset = 7.6 MHz
#define PRESCALER 127 // PLL Prescaler (40 for 2m, 127 for 70cm)
#endif
#ifdef BAND_2M
#define FBASE UINT32_C(140000000)// lowest frequency (for eeprom storage) = 140MHz (430 MHz with 70 cm)
#define FBASE_MEM_RECALL UINT32_C(140000000)
#define FDEF UINT32_C(145500000)// Default Frequency
#define FTXOFF FOFF06 // Default Offset = 0.6 MHz
#define PRESCALER 40 // PLL Prescaler (40 for 2m, 127 for 70cm)
#endif
#if !defined BAND_2M && !defined BAND_70CM
#error No frequency band defined, define one in macros.h
#endif
//
//************************
// Squelch
//
#define SQL_HYST 10 // define squelch hysteresis in 5 ms steps
#define SQL_INTERVAL 150 // update squelch state every 150 ms
//
#define LCDDELAY 45 // 42 ms
//************************
//Clock toggle
// **************************************************************
#define YEL_LED 0x31
#define GRN_LED 0x32
#define RED_LED 0x33
#define LED_OFF 0
#define LED_ON 4
#define LED_BLINK 8
#define LED_INVERT 128
#define ARROW 0x6D
#define A_OFF 0
#define A_ON 1
#define A_BLINK 2
//******************************************************************
#define P_SIGIN 1
//******************************************************************
// Blink Char
#define CHR_BLINK 0x80
// non printable chars
#define semikolon 0x3B
#define komma 0x2C
#define backslash 0x5C
//***********************
//
// Character Stuff
//
#define LCD_A 0x4A
#define LCD_ULINE 0x4B
#define LCD_SPACE 0x4C
//
//
// "segment type""pos hor""pos. vert""diagonal"
#define seg15left 0x4D
#define seg15right 0x4E
#define seg7 0x4E
#define segblink 0x10
#define seg15o 0x10
#define seg15lo 0x20
#define seg15lod 0x02
#define seg15lu 0x40
#define seg15u 0x01
#define seg15lud 0x08
#define seg15lm 0x04
#define seg15mo 0x20
#define seg15mu 0x40
#define seg15rod 0x04
#define seg15ro 0x01
#define seg15ru 0x02
#define seg15rud 0x10
#define seg15rm 0x08
#define seg7o 0x04
#define seg7m 0x08
#define seg7u 0x10
#define seg7lo 0x20
#define seg7lu 0x40
#define seg7ro 0x01
#define seg7ru 0x02
//4D - solid:
//5D - blink:
//Cursor bleibt stehen nach 0x4D/0x5D zur Ergänzung des Zeichens mit 0x4E/0x5E
//15Seg:
// 1010
//20 02 __ __ __
//20 02____ __
// 0404 ____
//40 08____ __
//40 08 __ __ __
// 0101
//4E - solid:
//5E - blink:
//Segment Codes
//7Seg:
// 04
//20 01
// 08
//40 02
// 10
//15Seg:
// ____
//__ __ 20 04 01
//__ __2004 01
// ____ 0808
//__ __4010 02
//__ __ 40 10 02
// ____
//
// Tastencodes - Dx = Taste unter Display, Nx=numerische Tasten
//
#define D1 0x01
#define D2 0x02
#define D3 0x03
#define D4 0x04
#define D5 0x05
#define D6 0x06
#define D7 0x07
#define D8 0x08
#define CLEAR 0x14
#define N1 0x11
#define N2 0x0D
#define N3 0x09
#define N4 0x12
#define N5 0x0E
#define N6 0x0A
#define N7 0x13
#define N8 0x0F
#define N9 0x0B
#define STERN 0x14
#define N0 0x10
#define RAUTE 0x0C
#define KC_NONE 0xff
#define KC_D1 0x11
#define KC_D2 0x12
#define KC_D3 0x13
#define KC_D4 0x14
#define KC_D5 0x15
#define KC_D6 0x16
#define KC_D7 0x17
#define KC_D8 0x18
#define KC_ENTER 0x10
#define KC_EXIT 0x19
#define KC_NON_NUMERIC 0x10
#define KC_STAR 0x19
#define KC_HASH 0x10
/*
* Control Head definitions, used for key convert table
*/
#define CONTROL_HEAD3 0
#define CONTROL_HEAD2 1
/*
* ;****************************************************************************
;
; MC70 - Firmware for the Motorola MC micro trunking radio
; to use it as an Amateur-Radio transceiver
;
; Copyright (C) 2004 - 2011 Felix Erckenbrecht, DG1YFE
;
; This file is part of MC70.
;
; MC70 is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; MC70 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with MC70. If not, see <http://www.gnu.org/licenses/>.
;
;
;
;****************************************************************************
#DEFINE EVA5
;#DEFINE EVA9
;#DEFINE 2M
;#DEFINE 70CM
;******************************************************************
; Blink Char
#DEFINE CHR_BLINK $80
; non printable chars
#DEFINE semikolon $3B
#DEFINE komma $2C
#DEFINE backslash $5C
#DEFINE WAIT(ms) pshx \ ldx #ms \ jsr wait_ms \ pulx
#DEFINE LCDDELAY 42 ; 41ms
#DEFINE PCHAR(cmd) ldaa #'c' \ ldab #cmd \ jsr putchar
#DEFINE PUTCHAR ldaa #'c' \ jsr putchar
#DEFINE PINT(cmd) ldaa #'u' \ ldab #cmd \ jsr putchar
#DEFINE PHEX(cmd) ldaa #'x' \ ldab #cmd \ jsr putchar
#DEFINE PPLAIN(cmd) psha \ ldaa #'p' \ ldab #cmd \ jsr putchar \ pula
#DEFINE PRINTF(cmd) pshx \ ldx #cmd \ jsr printf \ pulx
;***********************
;
; Character Stuff
;
#DEFINE LCD_A $4A
#DEFINE LCD_ULINE $4B
#DEFINE LCD_SPACE $4C
;
;
; "segment type""pos hor""pos. vert""diagonal"
#DEFINE seg15left $4D
#DEFINE seg15right $4E
#DEFINE seg7 $4E
#DEFINE segblink $10
#DEFINE seg15o $10
#DEFINE seg15lo $20
#DEFINE seg15lod $02
#DEFINE seg15lu $40
#DEFINE seg15u $01
#DEFINE seg15lud $08
#DEFINE seg15lm $04
#DEFINE seg15mo $20
#DEFINE seg15mu $40
#DEFINE seg15rod $04
#DEFINE seg15ro $01
#DEFINE seg15ru $02
#DEFINE seg15rud $10
#DEFINE seg15rm $08
#DEFINE seg7o $04
#DEFINE seg7m $08
#DEFINE seg7u $10
#DEFINE seg7lo $20
#DEFINE seg7lu $40
#DEFINE seg7ro $01
#DEFINE seg7ru $02
;4D - solid:
;5D - blink:
;Cursor bleibt stehen nach $xD zur Erg�nzung des Zeichens mit $xE
;15Seg:
; 1010
;20 02 __ __ __
;20 02____ __
; 0404 ____
;40 08____ __
;40 08 __ __ __
; 0101
;4E - solid:
;5E - blink:
;Segment Codes
;7Seg:
; 04
;20 01
; 08
;40 02
; 10
;15Seg:
; ____
;__ __ 20 04 01
;__ __2004 01
; ____ 0808
;__ __4010 02
;__ __ 40 10 02
; ____
;
; Tastencodes - Dx = Taste unter Display, Nx=numerische Tasten
;
#DEFINE D1 $01
#DEFINE D2 $02
#DEFINE D3 $03
#DEFINE D4 $04
#DEFINE D5 $05
#DEFINE D6 $06
#DEFINE D7 $07
#DEFINE D8 $08
#DEFINE CLEAR $14
#DEFINE N1 $11
#DEFINE N2 $0D
#DEFINE N3 $09
#DEFINE N4 $12
#DEFINE N5 $0E
#DEFINE N6 $0A
#DEFINE N7 $13
#DEFINE N8 $0F
#DEFINE N9 $0B
#DEFINE STERN $14
#DEFINE N0 $10
#DEFINE RAUTE $0C
*
*/
#endif /* MACROS_H_ */