Start building the Teensy support.

This commit is contained in:
Jonathan Naylor 2016-11-07 21:02:09 +00:00
parent c6e36f81fc
commit 2a5149180d
1 changed files with 19 additions and 11 deletions

View File

@ -79,7 +79,6 @@ void CIO::startInt()
// Setup PDB for ADC1 at 24 kHz // Setup PDB for ADC1 at 24 kHz
#if defined(SEND_RSSI_DATA) #if defined(SEND_RSSI_DATA)
// Initialise ADC2 conversion to be triggered by the PDB // Initialise ADC2 conversion to be triggered by the PDB
@ -99,22 +98,31 @@ void CIO::startInt()
void CIO::interrupt() void CIO::interrupt()
{ {
if ((ADC0_SC1A & ADC_SC1_COCO) == ADC_SC1_COCO) {
uint8_t control = MARK_NONE; uint8_t control = MARK_NONE;
uint16_t sample = DC_OFFSET; uint16_t sample = DC_OFFSET;
m_txBuffer.get(sample, control); m_txBuffer.get(sample, control);
*(int16_t *)&(DAC0_DAT0L) = sample;
DAC0_DAT0L = (sample >> 0) & 0xFFU; sample = ADC0_RA;
DAC0_DATH = (sample >> 8) & 0xFFU;
// sample =
m_rxBuffer.put(sample, control); m_rxBuffer.put(sample, control);
#if !defined(SEND_RSSI_DATA)
m_rssiBuffer.put(0U); m_rssiBuffer.put(0U);
#endif
m_watchdog++; m_watchdog++;
} }
#if defined(SEND_RSSI_DATA)
if ((ADC1_SC1A & ADC_SC1_COCO) == ADC_SC1_COCO) {
uint16_t rssi = ADC1_RA;
m_rssiBuffer.put(rssi);
}
#endif
}
bool CIO::getCOSInt() bool CIO::getCOSInt()
{ {
return digitalRead(PIN_COS) == HIGH; return digitalRead(PIN_COS) == HIGH;