Merge remote-tracking branch 'g4klx/master'

48kHz
Andy CA6JAU 2016-11-18 00:02:07 -03:00
commit c612813975
7 changed files with 13 additions and 18 deletions

View File

@ -86,6 +86,7 @@ extern bool m_p25Enable;
extern bool m_duplex;
extern bool m_tx;
extern bool m_dcd;
extern uint32_t m_sampleCount;
extern bool m_sampleInsert;

1
IO.cpp
View File

@ -61,7 +61,6 @@ m_ysfTXLevel(128 * 128),
m_p25TXLevel(128 * 128),
m_ledCount(0U),
m_ledValue(true),
m_dcd(false),
m_detect(false),
m_adcOverflow(0U),
m_dacOverflow(0U),

1
IO.h
View File

@ -76,7 +76,6 @@ private:
uint32_t m_ledCount;
bool m_ledValue;
bool m_dcd;
bool m_detect;
uint16_t m_adcOverflow;

View File

@ -108,7 +108,7 @@ void CIO::startInt()
ADC1_CFG1 = ADC_CFG1_ADIV(1) | ADC_CFG1_ADICLK(1) | // Single-ended 12 bits, long sample time
ADC_CFG1_MODE(1) | ADC_CFG1_ADLSMP;
ADC1_CFG2 = ADC_CFG2_MUXSEL | ADC_CFG2_ADLSTS(2); // Select channels ADxxxb
ADC1_SC2 = ADC_SC2_REFSEL(1) | ADC_SC2_ADTRG; // Voltage ref internal, hardware trigger
ADC1_SC2 = ADC_SC2_REFSEL(1); // Voltage ref internal, software trigger
ADC1_SC3 = ADC_SC3_CAL | ADC_SC3_AVGE | ADC_SC3_AVGS(0); // Enable averaging, 4 samples
while ((ADC1_SC3 & ADC_SC3_CAL) == ADC_SC3_CAL) // Wait for calibration
@ -119,7 +119,6 @@ void CIO::startInt()
sum1 = (sum1 / 2U) | 0x8000U;
ADC1_PG = sum1;
ADC1_SC1A = ADC_SC1_AIEN | PIN_RSSI; // Enable ADC interrupt, use A2
NVIC_ENABLE_IRQ(IRQ_ADC1);
#endif
@ -137,12 +136,7 @@ void CIO::startInt()
SIM_SOPT7 |= SIM_SOPT7_ADC0ALTTRGEN |
!SIM_SOPT7_ADC0PRETRGSEL |
SIM_SOPT7_ADC0TRGSEL(14);
#if defined(SEND_RSSI_DATA)
// Set ADC1 to trigger from the LPTMR
SIM_SOPT7 |= SIM_SOPT7_ADC1ALTTRGEN |
!SIM_SOPT7_ADC1PRETRGSEL |
SIM_SOPT7_ADC1TRGSEL(14);
#endif
NVIC_ENABLE_IRQ(IRQ_LPTMR);
#else
// Setup PDB for ADC0 (and ADC1) at 24 kHz
@ -150,9 +144,6 @@ void CIO::startInt()
PDB0_MOD = F_BUS / 24000; // Timer period
PDB0_IDLY = 0; // Interrupt delay
PDB0_CH0C1 = PDB_CHnC1_TOS | PDB_CHnC1_EN; // Enable pre-trigger for ADC0
#if defined(SEND_RSSI_DATA)
PDB0_CH1C1 = PDB_CHnC1_TOS | PDB_CHnC1_EN; // Enable pre-trigger for ADC1
#endif
PDB0_SC = PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | // SW trigger, enable interrupts, continuous mode
PDB_SC_PDBIE | PDB_SC_CONT | PDB_SC_LDOK; // No prescaling
PDB0_SC |= PDB_SC_SWTRIG; // Software trigger (reset and restart counter)
@ -181,7 +172,9 @@ void CIO::interrupt(uint8_t source)
sample = ADC0_RA;
m_rxBuffer.put(sample, control);
#if !defined(SEND_RSSI_DATA)
#if defined(SEND_RSSI_DATA)
ADC1_SC1A = ADC_SC1_AIEN | PIN_RSSI;
#else
m_rssiBuffer.put(0U);
#endif
}

View File

@ -33,7 +33,8 @@ bool m_p25Enable = true;
bool m_duplex = true;
bool m_tx = false;
bool m_tx = false;
bool m_dcd = false;
uint32_t m_sampleCount = 0U;
bool m_sampleInsert = false;

View File

@ -30,7 +30,8 @@ bool m_p25Enable = true;
bool m_duplex = true;
bool m_tx = false;
bool m_tx = false;
bool m_dcd = false;
uint32_t m_sampleCount = 0U;
bool m_sampleInsert = false;

View File

@ -116,7 +116,7 @@ void CSerialPort::getStatus()
// Send all sorts of interesting internal values
reply[0U] = MMDVM_FRAME_START;
reply[1U] = 10U;
reply[1U] = 11U;
reply[2U] = MMDVM_GET_STATUS;
reply[3U] = 0x00U;
@ -131,7 +131,8 @@ void CSerialPort::getStatus()
reply[4U] = uint8_t(m_modemState);
reply[5U] = m_tx ? 0x01U : 0x00U;
reply[5U] = m_tx ? 0x01U : 0x00U;
reply[5U] |= m_dcd ? 0x02U : 0x00U;
bool adcOverflow;
bool dacOverflow;