Skip to content

Commit

Permalink
Merged changes for both ZUMspot duplex and dualband boards to master …
Browse files Browse the repository at this point in the history
…branch
  • Loading branch information
Abad-Vera committed Sep 20, 2019
2 parents 06e02d5 + c34f5d5 commit 8967348
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 42 deletions.
46 changes: 35 additions & 11 deletions IO.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
* Copyright (C) 2017 by Danilo DB4PLE
* Copyright (C) 2017 by Danilo DB4PLE
* This program 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 2 of the License, or
Expand Down Expand Up @@ -105,9 +105,9 @@ void CIO::process()
uint8_t bit;
uint32_t scantime;
uint8_t control;

m_ledCount++;

if (m_started) {
// Two seconds timeout
if (m_watchdog >= 19200U) {
Expand Down Expand Up @@ -194,7 +194,7 @@ void CIO::process()

if (m_rxBuffer.getData() >= 1U) {
m_rxBuffer.get(bit, control);

switch (m_modemState_prev) {
case STATE_DSTAR:
dstarRX.databit(bit);
Expand Down Expand Up @@ -229,9 +229,9 @@ void CIO::process()
}

void CIO::start()
{
{
m_TotalModes = 0U;

if(m_dstarEnable) {
m_Modes[m_TotalModes] = STATE_DSTAR;
m_TotalModes++;
Expand All @@ -252,7 +252,7 @@ void CIO::start()
m_Modes[m_TotalModes] = STATE_NXDN;
m_TotalModes++;
}

#if defined(ENABLE_SCAN_MODE)
if(m_TotalModes > 1U)
m_scanEnable = true;
Expand All @@ -267,9 +267,9 @@ void CIO::start()

if (m_started)
return;

startInt();

m_started = true;
}

Expand All @@ -284,7 +284,7 @@ void CIO::write(uint8_t* data, uint16_t length, const uint8_t* control)
else
m_txBuffer.put(data[i], control[i]);
}

// Switch the transmitter on if needed
if (!m_tx) {
setTX();
Expand Down Expand Up @@ -338,6 +338,30 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po
return 4U;
#endif

// Check if we have a single, dualband or duplex board
#if defined (ZUMSPOT_ADF7021)
if (!(io.hasSingleADF7021())) {
// There are two ADF7021s on the board
if (io.isDualBand()) {
// Dual band
if ((frequency_tx <= VHF2_MAX) && (frequency_rx <= VHF2_MAX)) {
// Turn on VHF side
io.setBandVHF(true);
} else if ((frequency_tx >= UHF1_MIN) && (frequency_rx >= UHF1_MIN)) {
// Turn on UHF side
io.setBandVHF(false);
}
} else if (!io.isDualBand()) {
// Duplex board
if ((frequency_tx < UHF1_MIN) || (frequency_rx < UHF1_MIN)) {
// Reject VHF frequencies
return 4U;
}
}
}

#endif

// Configure frequency
m_frequency_rx = frequency_rx;
m_frequency_tx = frequency_tx;
Expand Down
9 changes: 6 additions & 3 deletions IO.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
* Copyright (C) 2017 by Danilo DB4PLE
* Copyright (C) 2017 by Danilo DB4PLE
* This program 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 2 of the License, or
Expand Down Expand Up @@ -124,6 +124,9 @@ class CIO {
uint32_t getWatchdog(void);
void getIntCounter(uint16_t &int1, uint16_t &int2);
void selfTest(void);
void setBandVHF(bool vhf_on);
bool hasSingleADF7021(void);
bool isDualBand(void);

// RF interface API
void setTX(void);
Expand Down Expand Up @@ -164,7 +167,7 @@ class CIO {
uint16_t m_RX_F_divider;
uint8_t m_TX_N_divider;
uint16_t m_TX_F_divider;

bool m_started;
CBitRB m_rxBuffer;
CBitRB m_txBuffer;
Expand Down
Loading

0 comments on commit 8967348

Please sign in to comment.