| #endif | #endif | ||||
| #include "DMAChannel.h" | #include "DMAChannel.h" | ||||
| #ifndef DMACHANNEL_HAS_BEGIN | |||||
| #if !defined(DMACHANNEL_HAS_BEGIN) || !defined(DMACHANNEL_HAS_BOOLEAN_CTOR) | |||||
| #error "You need to update DMAChannel.h & DMAChannel.cpp" | #error "You need to update DMAChannel.h & DMAChannel.cpp" | ||||
| #error "https://github.com/PaulStoffregen/cores/blob/master/teensy3/DMAChannel.h" | #error "https://github.com/PaulStoffregen/cores/blob/master/teensy3/DMAChannel.h" | ||||
| #error "https://github.com/PaulStoffregen/cores/blob/master/teensy3/DMAChannel.cpp" | #error "https://github.com/PaulStoffregen/cores/blob/master/teensy3/DMAChannel.cpp" | 
| // Do nothing here. The Audio flows automatically | // Do nothing here. The Audio flows automatically | ||||
| // When AudioInputAnalog is running, analogRead() must NOT be used. | // When AudioInputAnalog is running, analogRead() must NOT be used. | ||||
| delay(200); | |||||
| Serial.print("PDB: SC="); | |||||
| Serial.print(PDB0_SC, HEX); | |||||
| Serial.print(", CONFIG="); | |||||
| Serial.print(PDB_CONFIG, HEX); | |||||
| Serial.print(", MOD="); | |||||
| Serial.print(PDB0_MOD); | |||||
| Serial.print(", IDLY="); | |||||
| Serial.print(PDB0_IDLY); | |||||
| Serial.print(", CH0C1="); | |||||
| Serial.print(PDB0_CH0C1); | |||||
| Serial.print(", DMA: "); | |||||
| Serial.print(dma_channel_allocated_mask, HEX); | |||||
| Serial.println(); | |||||
| } | } | ||||
| audio_block_t * AudioInputAnalog::block_left = NULL; | audio_block_t * AudioInputAnalog::block_left = NULL; | ||||
| uint16_t AudioInputAnalog::block_offset = 0; | uint16_t AudioInputAnalog::block_offset = 0; | ||||
| bool AudioInputAnalog::update_responsibility = false; | bool AudioInputAnalog::update_responsibility = false; | ||||
| DMAChannel AudioInputAnalog::dma; | |||||
| DMAChannel AudioInputAnalog::dma(false); | |||||
| AudioInputAnalog::AudioInputAnalog() : AudioStream(0, NULL) | AudioInputAnalog::AudioInputAnalog() : AudioStream(0, NULL) | 
| audio_block_t * AudioInputI2S::block_right = NULL; | audio_block_t * AudioInputI2S::block_right = NULL; | ||||
| uint16_t AudioInputI2S::block_offset = 0; | uint16_t AudioInputI2S::block_offset = 0; | ||||
| bool AudioInputI2S::update_responsibility = false; | bool AudioInputI2S::update_responsibility = false; | ||||
| DMAChannel AudioInputI2S::dma; | |||||
| DMAChannel AudioInputI2S::dma(false); | |||||
| void AudioInputI2S::begin(void) | void AudioInputI2S::begin(void) | 
| audio_block_t * AudioOutputAnalog::block_left_1st = NULL; | audio_block_t * AudioOutputAnalog::block_left_1st = NULL; | ||||
| audio_block_t * AudioOutputAnalog::block_left_2nd = NULL; | audio_block_t * AudioOutputAnalog::block_left_2nd = NULL; | ||||
| bool AudioOutputAnalog::update_responsibility = false; | bool AudioOutputAnalog::update_responsibility = false; | ||||
| DMAChannel AudioOutputAnalog::dma; | |||||
| DMAChannel AudioOutputAnalog::dma(false); | |||||
| void AudioOutputAnalog::begin(void) | void AudioOutputAnalog::begin(void) | ||||
| { | { | 
| uint16_t AudioOutputI2S::block_right_offset = 0; | uint16_t AudioOutputI2S::block_right_offset = 0; | ||||
| bool AudioOutputI2S::update_responsibility = false; | bool AudioOutputI2S::update_responsibility = false; | ||||
| DMAMEM static uint32_t i2s_tx_buffer[AUDIO_BLOCK_SAMPLES]; | DMAMEM static uint32_t i2s_tx_buffer[AUDIO_BLOCK_SAMPLES]; | ||||
| DMAChannel AudioOutputI2S::dma; | |||||
| DMAChannel AudioOutputI2S::dma(false); | |||||
| void AudioOutputI2S::begin(void) | void AudioOutputI2S::begin(void) | ||||
| { | { | 
| uint8_t AudioOutputPWM::interrupt_count = 0; | uint8_t AudioOutputPWM::interrupt_count = 0; | ||||
| DMAMEM uint32_t pwm_dma_buffer[AUDIO_BLOCK_SAMPLES*2]; | DMAMEM uint32_t pwm_dma_buffer[AUDIO_BLOCK_SAMPLES*2]; | ||||
| DMAChannel AudioOutputPWM::dma; | |||||
| DMAChannel AudioOutputPWM::dma(false); | |||||
| // TODO: this code assumes F_BUS is 48 MHz. | // TODO: this code assumes F_BUS is 48 MHz. | ||||
| // supporting other speeds is not easy, but should be done someday | // supporting other speeds is not easy, but should be done someday |