2023-11-14 23:55:18 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Roman Piksaykin [piksaykin@gmail.com], R2BDY
|
|
|
|
// https://www.qrz.com/db/r2bdy
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
//
|
2023-11-16 20:47:53 +00:00
|
|
|
// main.c - The project entry point.
|
2023-11-14 23:55:18 +00:00
|
|
|
//
|
|
|
|
// DESCRIPTION
|
2023-11-16 20:47:53 +00:00
|
|
|
// The pico-WSPR-tx project provides WSPR beacon function using only
|
|
|
|
// Pi Pico board. *NO* additional hardware such as freq.synth required.
|
2023-11-30 09:54:27 +00:00
|
|
|
// External GPS receiver is optional and serves a purpose of holding
|
|
|
|
// WSPR time window order and accurate frequancy drift compensation.
|
2023-11-14 23:55:18 +00:00
|
|
|
//
|
|
|
|
// HOWTOSTART
|
2023-11-30 09:54:27 +00:00
|
|
|
// ./build.sh; cp ./build/*.uf2 /media/Pico_Board/
|
2023-11-14 23:55:18 +00:00
|
|
|
//
|
|
|
|
// PLATFORM
|
|
|
|
// Raspberry Pi pico.
|
|
|
|
//
|
|
|
|
// REVISION HISTORY
|
|
|
|
// Rev 0.1 18 Nov 2023
|
2023-11-30 09:54:27 +00:00
|
|
|
// Rev 0.5 02 Dec 2023
|
2023-11-14 23:55:18 +00:00
|
|
|
//
|
2023-11-16 20:47:53 +00:00
|
|
|
// PROJECT PAGE
|
|
|
|
// https://github.com/RPiks/pico-WSPR-tx
|
|
|
|
//
|
2023-11-30 09:54:27 +00:00
|
|
|
// SUBMODULE PAGE
|
|
|
|
// https://github.com/RPiks/pico-hf-oscillator
|
|
|
|
//
|
2023-11-14 23:55:18 +00:00
|
|
|
// LICENCE
|
|
|
|
// MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
|
|
//
|
|
|
|
// Copyright (c) 2023 by Roman Piksaykin
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge,to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the Software), to deal
|
|
|
|
// in the Software without restriction,including without limitation the rights
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
// THE SOFTWARE.
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include <string.h>
|
2023-11-15 23:52:44 +00:00
|
|
|
#include <stdio.h>
|
2023-11-14 23:55:18 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "pico/multicore.h"
|
|
|
|
#include "pico-hf-oscillator/lib/assert.h"
|
2023-11-15 23:52:44 +00:00
|
|
|
#include "pico-hf-oscillator/defines.h"
|
2023-11-30 09:54:27 +00:00
|
|
|
#include <defines.h>
|
2023-11-15 23:52:44 +00:00
|
|
|
#include <piodco.h>
|
|
|
|
#include <WSPRbeacon.h>
|
2023-11-30 09:54:27 +00:00
|
|
|
#include <logutils.h>
|
|
|
|
#include <protos.h>
|
2023-11-14 23:55:18 +00:00
|
|
|
|
2023-11-28 00:10:01 +00:00
|
|
|
WSPRbeaconContext *pWSPR;
|
|
|
|
|
2023-11-14 14:33:55 +00:00
|
|
|
int main()
|
|
|
|
{
|
2023-11-28 00:10:01 +00:00
|
|
|
StampPrintf("\n");
|
|
|
|
sleep_ms(5000);
|
|
|
|
StampPrintf("R2BDY Pico-WSPR-tx start.");
|
2023-11-14 14:33:55 +00:00
|
|
|
|
2023-11-16 18:08:18 +00:00
|
|
|
InitPicoHW();
|
|
|
|
|
2023-11-28 21:06:38 +00:00
|
|
|
PioDco DCO = {0};
|
|
|
|
|
2023-11-28 00:10:01 +00:00
|
|
|
StampPrintf("WSPR beacon init...");
|
|
|
|
|
|
|
|
WSPRbeaconContext *pWB = WSPRbeaconInit(
|
|
|
|
"R2BDY", /* the Callsign. */
|
|
|
|
"KO85", /* the QTH locator. */
|
2023-11-30 16:18:09 +00:00
|
|
|
16, /* Tx power, dbm. */
|
2023-11-28 00:10:01 +00:00
|
|
|
&DCO, /* the PioDCO object. */
|
|
|
|
7040000UL, /* the dial frequency. */
|
|
|
|
55UL, /* the carrier freq. shift relative to dial freq. */
|
2023-11-30 16:18:09 +00:00
|
|
|
RFOUT_PIN /* RF output GPIO pin. */
|
2023-11-28 00:10:01 +00:00
|
|
|
);
|
|
|
|
assert_(pWB);
|
|
|
|
pWSPR = pWB;
|
2023-11-28 21:06:38 +00:00
|
|
|
|
2023-11-28 00:10:01 +00:00
|
|
|
pWB->_txSched._u8_tx_GPS_mandatory = YES; /* Send WSPR signals only when GPS solution is active. */
|
2023-11-29 17:08:07 +00:00
|
|
|
pWB->_txSched._u8_tx_GPS_past_time = YES; /* ?relying on GPS solution in the past. */
|
|
|
|
pWB->_txSched._u8_tx_slot_skip = 2; /* 1 slot tx, 1 slot idle, etc. */
|
2023-11-28 00:10:01 +00:00
|
|
|
pWB->_txSched._u8_tx_heating_pause_min = 1; /* Give 1 minute pre-heating ere first transmition. */
|
|
|
|
|
|
|
|
multicore_launch_core1(Core1Entry);
|
2023-11-28 21:06:38 +00:00
|
|
|
StampPrintf("RF oscillator started.");
|
|
|
|
|
|
|
|
DCO._pGPStime = GPStimeInit(0, 9600, GPS_PPS_PIN);
|
|
|
|
assert_(DCO._pGPStime);
|
2023-11-28 00:10:01 +00:00
|
|
|
|
2023-11-29 17:08:07 +00:00
|
|
|
int tick = 0;
|
2023-11-28 00:10:01 +00:00
|
|
|
for(;;)
|
|
|
|
{
|
|
|
|
WSPRbeaconTxScheduler(pWB, YES);
|
2023-11-30 09:54:27 +00:00
|
|
|
|
|
|
|
gpio_put(PICO_DEFAULT_LED_PIN, 1);
|
|
|
|
sleep_ms(100);
|
|
|
|
gpio_put(PICO_DEFAULT_LED_PIN, 0);
|
2023-11-28 00:10:01 +00:00
|
|
|
|
2023-11-30 16:18:09 +00:00
|
|
|
#ifdef DEBUG
|
2023-11-30 09:54:27 +00:00
|
|
|
if(0 == ++tick % 60)
|
2023-11-29 17:08:07 +00:00
|
|
|
WSPRbeaconDumpContext(pWB);
|
2023-11-30 16:18:09 +00:00
|
|
|
#endif
|
2023-11-30 09:54:27 +00:00
|
|
|
sleep_ms(900);
|
2023-11-28 00:10:01 +00:00
|
|
|
}
|
2023-11-14 14:33:55 +00:00
|
|
|
}
|