Clean up the Due's interrupt handler.

48kHz
Jonathan Naylor 2016-11-07 21:25:25 +00:00
parent 2a5149180d
commit ee44fd81ef
1 changed files with 11 additions and 10 deletions

View File

@ -73,8 +73,7 @@ const uint16_t DC_OFFSET = 2048U;
extern "C" { extern "C" {
void ADC_Handler() void ADC_Handler()
{ {
if (ADC->ADC_ISR & ADC_ISR_EOC_Chan) // Ensure there was an End-of-Conversion and we read the ISR reg io.interrupt();
io.interrupt();
} }
} }
@ -160,18 +159,20 @@ void CIO::startInt()
void CIO::interrupt() void CIO::interrupt()
{ {
uint8_t control = MARK_NONE; if (ADC->ADC_ISR & ADC_ISR_EOC_Chan) { // Ensure there was an End-of-Conversion and we read the ISR reg
uint16_t sample = DC_OFFSET; uint8_t control = MARK_NONE;
uint16_t sample = DC_OFFSET;
m_txBuffer.get(sample, control); m_txBuffer.get(sample, control);
DACC->DACC_CDR = sample;
DACC->DACC_CDR = sample; sample = ADC->ADC_CDR[ADC_CDR_Chan];
sample = ADC->ADC_CDR[ADC_CDR_Chan]; m_rxBuffer.put(sample, control);
m_rxBuffer.put(sample, control); m_rssiBuffer.put(0U);
m_rssiBuffer.put(0U);
m_watchdog++; m_watchdog++;
}
} }
bool CIO::getCOSInt() bool CIO::getCOSInt()