99// Connect a momentary push button to pin 12 to use as the
1010// transmit trigger. Get fancy by adding your own code to trigger
1111// off of the time from a GPS or your PC via virtual serial.
12- //
13- // Original code based on Feld Hell beacon for Arduino by Mark
14- // Vandewettering K6HX, adapted for the Si5351A by Robert
12+ //
13+ // Original code based on Feld Hell beacon for Arduino by Mark
14+ // Vandewettering K6HX, adapted for the Si5351A by Robert
1515// Liesenfeld AK6L <[email protected] >.16- //
16+ //
1717// Permission is hereby granted, free of charge, to any person obtaining
1818// a copy of this software and associated documentation files (the
1919// "Software"), to deal in the Software without restriction, including
2020// without limitation the rights to use, copy, modify, merge, publish,
2121// distribute, sublicense, and/or sell copies of the Software, and to
2222// permit persons to whom the Software is furnished to do so, subject
2323// to the following conditions:
24- //
24+ //
2525// The above copyright notice and this permission notice shall be
2626// included in all copies or substantial portions of the Software.
27- //
27+ //
2828// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2929// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3030// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
5151#define JT9_CTC 9000 // CTC value for JT9-1
5252#define JT65_CTC 5812 // CTC value for JT65A
5353#define JT4_CTC 3578 // CTC value for JT4
54- #define WSPR_CTC 10672 // CTC value for WSPR
54+ #define WSPR_CTC 10672 // CTC value for WSPR
5555
5656#define JT9_DEFAULT_FREQ 14078600UL
5757#define JT65_DEFAULT_FREQ 14077500UL
@@ -92,15 +92,15 @@ ISR(TIMER1_COMPA_vect)
9292{
9393 proceed = true ;
9494}
95-
95+
9696// Loop through the string, transmitting one character at a time.
9797void encode ()
9898{
9999 uint8_t i;
100-
100+
101101 // Clear out the old transmit buffer
102102 memset (tx_buffer, 0 , 255 );
103-
103+
104104 // Set the proper frequency and timer CTC depending on mode
105105 switch (cur_mode)
106106 {
@@ -117,25 +117,25 @@ void encode()
117117 jtencode.wspr_encode (call, loc, dbm, tx_buffer);
118118 break ;
119119 }
120-
120+
121121 // Reset the tone to the base frequency and turn on the output
122122 si5351.output_enable (SI5351_CLK0, 1 );
123123 digitalWrite (LED_PIN, HIGH);
124-
124+
125125 // Now transmit the channel symbols
126126 for (i = 0 ; i < symbol_count; i++)
127127 {
128128 si5351.set_freq ((freq * 100 ) + (tx_buffer[i] * tone_spacing), 0 , SI5351_CLK0);
129129 proceed = false ;
130130 while (!proceed);
131131 }
132-
132+
133133 // Turn off the output
134134 si5351.output_enable (SI5351_CLK0, 0 );
135135 digitalWrite (LED_PIN, LOW);
136136}
137137
138-
138+
139139void setup ()
140140{
141141 // Use the Arduino's on-board LED as a keying indicator.
@@ -144,10 +144,10 @@ void setup()
144144
145145 // Use a button connected to pin 12 as a transmit trigger
146146 pinMode (BUTTON, INPUT_PULLUP);
147-
147+
148148 // Serial.begin(57600);
149149
150- // Set the proper frequency, tone spacing, symbol count, and
150+ // Set the proper frequency, tone spacing, symbol count, and
151151 // timer CTC depending on mode
152152 switch (cur_mode)
153153 {
@@ -176,18 +176,18 @@ void setup()
176176 tone_spacing = WSPR_TONE_SPACING;
177177 break ;
178178 }
179-
179+
180180 // Initialize the Si5351
181181 // Change the 2nd parameter in init if using a ref osc other
182182 // than 25 MHz
183- si5351.init (SI5351_VARIANT_A3, SI5351_CRYSTAL_LOAD_8PF, 0 );
183+ si5351.init (SI5351_CRYSTAL_LOAD_8PF, 0 );
184184
185185 // Set CLK0 output
186186 si5351.set_correction (0 );
187187 si5351.set_freq (freq * 100 , 0 , SI5351_CLK0);
188188 si5351.drive_strength (SI5351_CLK0, SI5351_DRIVE_8MA); // Set for max power if desired
189189 si5351.output_enable (SI5351_CLK0, 0 ); // Disable the clock initially
190-
190+
191191 // Set up Timer1 for interrupts every symbol period.
192192 noInterrupts (); // Turn off interrupts.
193193 TCCR1A = 0 ; // Set entire TCCR1A register to 0; disconnects
@@ -202,7 +202,7 @@ void setup()
202202 OCR1A = ctc; // Set up interrupt trigger count;
203203 interrupts (); // Re-enable interrupts.
204204}
205-
205+
206206void loop ()
207207{
208208 // Debounce the button and trigger TX on push
@@ -212,7 +212,7 @@ void loop()
212212 if (digitalRead (BUTTON) == LOW)
213213 {
214214 encode ();
215-
215+
216216 delay (50 ); // delay to avoid extra triggers
217217 }
218218 }
0 commit comments