00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #define KEYDDR DDRB
00027 #define KEYPORT PORTB
00028 #define KEYINP PINB
00029 #define DITPIN 3
00030 #define DAHPIN 4
00031
00032
00033 #define OUTDDR DDRB
00034 #define OUTPORT PORTB
00035 #define OUTPIN 0
00036
00037
00038
00039 #define STDDR DDRB
00040 #define STPORT PORTB
00041 #define STPIN 1
00042
00043
00044 #define BTNDDR DDRB
00045 #define BTNPORT PORTB
00046 #define BTNINP PINB
00047 #define BTNPIN 2
00048
00049
00050
00051
00052
00053
00054 #define NOTUSED1 0b00000001 // Available
00055 #define CONFLOCK 0b00000010 // Configuration locked down
00056 #define MODE 0b00001100 // 2 bits to define keyer mode (see next section)
00057 #define SIDETONE 0b00010000 // Set if the chip must produce a sidetone
00058 #define TXKEY 0b00100000 // Set if the chip keys the transmitter
00059 #define TXINV 0b01000000 // Set if TX key line is active low
00060 #define PDLSWAP 0b10000000 // Set if DIT and DAH are swapped
00061
00062 #define IAMBICA 0b00000000 // IAMBIC A mode
00063 #define IAMBICB 0b00000100 // IAMBIC B mode (default)
00064 #define ULTIMATIC 0b00001000 // Ultimatic Mode
00065 #define DAHPRIO 0b00001100 // Always give DAH priority
00066
00067 #define FLAGDEFAULT IAMBICB | TXKEY | SIDETONE
00068
00069
00070 #define DITLATCH 0b00000001 // Set if DIT contact was closed
00071 #define DAHLATCH 0b00000010 // Set if DAH contact was closed
00072 #define SQUEEZED 0b00000011 // DIT and DAH = squeezed
00073 #define DIRTYFLAG 0b00000100 // Set if cfg data was changed and needs storing
00074 #define CKLATCH 0b00001000 // Set if the command key was pressed at some point
00075 #define VSCOPY 0b00110000 // Copies of Sidetone and TX flags from yackflags
00076
00077
00078
00079
00080
00081
00082
00083 #define YACKBEAT 5
00084 #define YACKSECS(n) (n*(1000/YACKBEAT)) // Beats in n seconds
00085 #define YACKMS(n) (n/YACKBEAT) // Beats in n milliseconds
00086
00087
00088 #define POWERSAVE // Comment this line if no power save mode required
00089 #define PSTIME 30 // 30 seconds until automatic powerdown
00090 #define PWRWAKE ((1<<PCINT3) | (1<<PCINT4) | (1<<PCINT2)) // Dit, Dah or Command wakes us up..
00091
00092
00093 #define MAXWPM 50
00094 #define MINWPM 5
00095 #define DEFWPM 12
00096
00097
00098 #define FARNSWORTH 1
00099 #define WPMSPEED 0
00100 #define MAXFARN 255
00101
00102 #define WPMCALC(n) ((1200/YACKBEAT)/n) // Calculates number of beats in a dot
00103
00104 #define DITLEN 1 // Length of a dot
00105 #define DAHLEN 3 // Length of a dash
00106 #define IEGLEN 1 // Length of inter-element gap
00107 #define ICGLEN 3 // Length of inter-character gap
00108 #define IWGLEN 7 // Length of inter-word gap
00109
00110
00111 #define TUNEDURATION 20 // Duration of tuning keydown (in seconds)
00112 #define DEFTIMEOUT 5 // Default timeout 5 seconds
00113 #define MACTIMEOUT 15 // Timeout after playing back a macro
00114
00115
00116
00117
00118
00119 #define PRESCALE 8
00120 #define CTCVAL(n) ((F_CPU/n/2/PRESCALE)-1) // Defines how to compute CTC setting for
00121
00122
00123
00124 #define DEFFREQ 800 // Default sidetone frequency
00125 #define MAXFREQ 1500 // Maximum frequency
00126 #define MINFREQ 400 // Minimum frequenc
00127
00128 #define MAXCTC CTCVAL(MAXFREQ) // CTC values for the above three values
00129 #define MINCTC CTCVAL(MINFREQ)
00130 #define DEFCTC CTCVAL(DEFFREQ)
00131
00132
00133 #define RBSIZE 100 // Size of each of the two EEPROM buffers
00134
00135 #define MAGPAT 0xA5 // If this number is found in EEPROM, content assumed valid
00136
00137 #define DIT 1
00138 #define DAH 2
00139
00140 #define UP 1
00141 #define DOWN 2
00142
00143 #define ON 1
00144 #define OFF 0
00145
00146 #define RECORD 1
00147 #define PLAY 2
00148
00149 #define READ 1
00150 #define WRITE 2
00151
00152 #define TRUE 1
00153 #define FALSE 0
00154
00155
00156
00157 #define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
00158 #define CLEARBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
00159
00160 typedef uint8_t byte;
00161 typedef uint16_t word;
00162
00163
00164
00165 void yackinit (void);
00166 void yackchar(char c);
00167 void yackstring(const char *p);
00168 char yackiambic(byte ctrl);
00169 void yackpitch (uint8_t dir);
00170 void yacktune (void);
00171 void yackmode (uint8_t mode);
00172 void yackinhibit (uint8_t mode);
00173 void yackerror (void);
00174 void yacktoggle(byte flag);
00175 byte yackflag(byte flag);
00176 void yackbeat(void);
00177 void yackmessage(byte function, byte msgnr);
00178 void yacksave (void);
00179 byte yackctrlkey(byte mode);
00180 void yackreset (void);
00181 word yackuser (byte func, byte nr, word content);
00182 void yacknumber(word n);
00183 word yackwpm(void);
00184 void yackplay(byte i);
00185 void yackdelay(byte n);
00186 void yackfarns(void);
00187 void yackspeed (byte dir, byte mode);
00188
00189 #ifdef POWERSAVE
00190 void yackpower(byte n);
00191 #endif
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205