kopia lustrzana https://github.com/RPiks/pico-WSPR-tx
Pre-merge commit.
rodzic
d28d20062a
commit
d9bac8da61
|
@ -22,7 +22,7 @@ project(pico-wspr-tx C CXX ASM)
|
||||||
|
|
||||||
pico_sdk_init()
|
pico_sdk_init()
|
||||||
add_executable(pico-wspr-tx)
|
add_executable(pico-wspr-tx)
|
||||||
pico_generate_pio_header(pico-wspr-tx ${CMAKE_CURRENT_LIST_DIR}/pico-hf-oscillator/piodco/dco.pio)
|
pico_generate_pio_header(pico-wspr-tx ${CMAKE_CURRENT_LIST_DIR}/pico-hf-oscillator/piodco/dco2.pio)
|
||||||
|
|
||||||
target_sources(pico-wspr-tx PUBLIC
|
target_sources(pico-wspr-tx PUBLIC
|
||||||
${CMAKE_CURRENT_LIST_DIR}/pico-hf-oscillator/lib/assert.c
|
${CMAKE_CURRENT_LIST_DIR}/pico-hf-oscillator/lib/assert.c
|
||||||
|
|
|
@ -113,7 +113,7 @@ TxChannelContext *TxChannelInit(const uint32_t bit_period_us, uint8_t timer_alar
|
||||||
/// @return A count of bytes.
|
/// @return A count of bytes.
|
||||||
uint8_t TxChannelPending(TxChannelContext *pctx)
|
uint8_t TxChannelPending(TxChannelContext *pctx)
|
||||||
{
|
{
|
||||||
return 256 + pctx->_ix_input - pctx->_ix_output;
|
return 256L + (int)pctx->_ix_input - (int)pctx->_ix_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Push a number of bytes to the output FIFO.
|
/// @brief Push a number of bytes to the output FIFO.
|
||||||
|
@ -154,14 +154,3 @@ void TxChannelClear(TxChannelContext *pctx)
|
||||||
{
|
{
|
||||||
pctx->_ix_input = pctx->_ix_output = 0;
|
pctx->_ix_input = pctx->_ix_output = 0;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void TxChannelStart(TxChannelContext *pctx)
|
|
||||||
{
|
|
||||||
pctx->_b_allowtx = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TxChannelStop(TxChannelContext *pctx)
|
|
||||||
{
|
|
||||||
pctx->_b_allowtx = NO;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ int WSPRbeaconSendPacket(const WSPRbeaconContext *pctx)
|
||||||
{
|
{
|
||||||
assert_(pctx);
|
assert_(pctx);
|
||||||
assert_(pctx->_pTX);
|
assert_(pctx->_pTX);
|
||||||
assert_(pctx->_pTX->_u32_dialfreqhz > 1100 * kHz);
|
assert_(pctx->_pTX->_u32_dialfreqhz > 500 * kHz);
|
||||||
|
|
||||||
TxChannelClear(pctx->_pTX);
|
TxChannelClear(pctx->_pTX);
|
||||||
|
|
||||||
|
|
5
core1.c
5
core1.c
|
@ -65,7 +65,6 @@ void Core1Entry()
|
||||||
assert_(pWSPR);
|
assert_(pWSPR);
|
||||||
|
|
||||||
const uint32_t clkhz = PLL_SYS_MHZ * MHz;
|
const uint32_t clkhz = PLL_SYS_MHZ * MHz;
|
||||||
const uint32_t freq_hz = pWSPR->_pTX->_u32_dialfreqhz;
|
|
||||||
|
|
||||||
PioDco *p = pWSPR->_pTX->_p_oscillator;
|
PioDco *p = pWSPR->_pTX->_p_oscillator;
|
||||||
assert_(p);
|
assert_(p);
|
||||||
|
@ -74,8 +73,8 @@ void Core1Entry()
|
||||||
assert_(0 == PioDCOInit(p, pWSPR->_pTX->_i_tx_gpio, clkhz));
|
assert_(0 == PioDCOInit(p, pWSPR->_pTX->_i_tx_gpio, clkhz));
|
||||||
|
|
||||||
/* Set initial freq. */
|
/* Set initial freq. */
|
||||||
assert_(0 == PioDCOSetFreq(p, freq_hz, 0U));
|
assert_(0 == PioDCOSetFreq(p, pWSPR->_pTX->_u32_dialfreqhz, 0U));
|
||||||
|
|
||||||
/* Run the main DCO algorithm. It spins forever. */
|
/* Run the main DCO algorithm. It spins forever. */
|
||||||
PioDCOWorker(p);
|
PioDCOWorker2(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#ifndef DEFINESWSPR_H
|
#ifndef DEFINESWSPR_H
|
||||||
#define DEFINESWSPR_H
|
#define DEFINESWSPR_H
|
||||||
|
|
||||||
//#define DEBUG
|
#define DEBUG
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define DEBUGPRINTF(x) StampPrintf(x);
|
#define DEBUGPRINTF(x) StampPrintf(x);
|
||||||
|
|
51
main.c
51
main.c
|
@ -66,6 +66,13 @@
|
||||||
#include <logutils.h>
|
#include <logutils.h>
|
||||||
#include <protos.h>
|
#include <protos.h>
|
||||||
|
|
||||||
|
#define CONFIG_GPS_SOLUTION_IS_MANDATORY NO
|
||||||
|
#define CONFIG_GPS_RELY_ON_PAST_SOLUTION NO
|
||||||
|
#define CONFIG_SCHEDULE_SKIP_SLOT_COUNT 5
|
||||||
|
#define CONFIG_WSPR_DIAL_FREQUENCY 24926000UL // 28126000UL //7040000UL
|
||||||
|
#define CONFIG_CALLSIGN "R2BDY"
|
||||||
|
#define CONFIG_LOCATOR4 "KO85"
|
||||||
|
|
||||||
WSPRbeaconContext *pWSPR;
|
WSPRbeaconContext *pWSPR;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -81,21 +88,20 @@ int main()
|
||||||
StampPrintf("WSPR beacon init...");
|
StampPrintf("WSPR beacon init...");
|
||||||
|
|
||||||
WSPRbeaconContext *pWB = WSPRbeaconInit(
|
WSPRbeaconContext *pWB = WSPRbeaconInit(
|
||||||
"R2BDY", /* the Callsign. */
|
CONFIG_CALLSIGN,/* the Callsign. */
|
||||||
"KO85", /* the default QTH locator if GPS isn't used. */
|
CONFIG_LOCATOR4,/* the default QTH locator if GPS isn't used. */
|
||||||
16, /* Tx power, dbm. */
|
12, /* Tx power, dbm. */
|
||||||
&DCO, /* the PioDCO object. */
|
&DCO, /* the PioDCO object. */
|
||||||
7040000UL, /* the dial frequency. */
|
CONFIG_WSPR_DIAL_FREQUENCY,
|
||||||
55UL, /* the carrier freq. shift relative to dial freq. */
|
55UL, /* the carrier freq. shift relative to dial freq. */
|
||||||
RFOUT_PIN /* RF output GPIO pin. */
|
RFOUT_PIN /* RF output GPIO pin. */
|
||||||
);
|
);
|
||||||
assert_(pWB);
|
assert_(pWB);
|
||||||
pWSPR = pWB;
|
pWSPR = pWB;
|
||||||
|
|
||||||
pWB->_txSched._u8_tx_GPS_mandatory = YES; /* Send WSPR signals only when GPS solution is active. */
|
pWB->_txSched._u8_tx_GPS_mandatory = CONFIG_GPS_SOLUTION_IS_MANDATORY;
|
||||||
pWB->_txSched._u8_tx_GPS_past_time = YES; /* ?relying on GPS solution in the past. */
|
pWB->_txSched._u8_tx_GPS_past_time = CONFIG_GPS_RELY_ON_PAST_SOLUTION;
|
||||||
pWB->_txSched._u8_tx_slot_skip = 5; /* 1 slot tx, 1 slot idle, etc. */
|
pWB->_txSched._u8_tx_slot_skip = CONFIG_SCHEDULE_SKIP_SLOT_COUNT;
|
||||||
//pWB->_txSched._u8_tx_heating_pause_min = 1; /* Give 1 minute pre-heating ere first transmition. */
|
|
||||||
|
|
||||||
multicore_launch_core1(Core1Entry);
|
multicore_launch_core1(Core1Entry);
|
||||||
StampPrintf("RF oscillator started.");
|
StampPrintf("RF oscillator started.");
|
||||||
|
@ -106,6 +112,7 @@ int main()
|
||||||
int tick = 0;
|
int tick = 0;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if(WSPRbeaconIsGPSsolutionActive(pWB))
|
if(WSPRbeaconIsGPSsolutionActive(pWB))
|
||||||
{
|
{
|
||||||
const char *pgps_qth = WSPRbeaconGetLastQTHLocator(pWB);
|
const char *pgps_qth = WSPRbeaconGetLastQTHLocator(pWB);
|
||||||
|
@ -115,8 +122,32 @@ int main()
|
||||||
pWB->_pu8_locator[5] = 0x00;
|
pWB->_pu8_locator[5] = 0x00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
WSPRbeaconTxScheduler(pWB, YES);
|
|
||||||
|
if(pWB->_txSched._u8_tx_GPS_mandatory)
|
||||||
|
{
|
||||||
|
WSPRbeaconTxScheduler(pWB, YES);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StampPrintf("Omitting GPS solution, start tx now.");
|
||||||
|
PioDCOStart(pWB->_pTX->_p_oscillator);
|
||||||
|
WSPRbeaconCreatePacket(pWB);
|
||||||
|
sleep_ms(100);
|
||||||
|
WSPRbeaconSendPacket(pWB);
|
||||||
|
StampPrintf("The system will be halted when tx is completed.");
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
if(!TxChannelPending(pWB->_pTX))
|
||||||
|
{
|
||||||
|
PioDCOStop(pWB->_pTX->_p_oscillator);
|
||||||
|
StampPrintf("System halted.");
|
||||||
|
}
|
||||||
|
gpio_put(PICO_DEFAULT_LED_PIN, 1);
|
||||||
|
sleep_ms(500);
|
||||||
|
gpio_put(PICO_DEFAULT_LED_PIN, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gpio_put(PICO_DEFAULT_LED_PIN, 1);
|
gpio_put(PICO_DEFAULT_LED_PIN, 1);
|
||||||
sleep_ms(100);
|
sleep_ms(100);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 01dbdefbaf1964246bfb66383ceeccea63aa6c60
|
Subproject commit 9fbd9fa407423c89af9c4878340e71446c948f66
|
Ładowanie…
Reference in New Issue