Skip to content

Commit

Permalink
Update to work with Feather etc
Browse files Browse the repository at this point in the history
  • Loading branch information
TMRh20 committed Apr 2, 2024
1 parent f41d0f5 commit e5e1caa
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions src/NRF52840/AutoAnalogAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
#define PIN_LRCK 14//(15)
#define PIN_SDOUT (5)
#define DEFAULT_PWM_PIN 5

#ifndef PIN_PDM_DIN
#define PIN_PDM_DIN 1
#define PIN_PDM_CLK 2
#define PIN_PDM_PWR 3
#define DEFAULT_PDM_GAIN 20
#define PDM_IRQ_PRIORITY 1
#endif

/****************************************************************************/
/* Public Functions */
/****************************************************************************/
Expand Down Expand Up @@ -288,6 +297,8 @@ void AutoAnalog::begin(bool enADC, bool enDAC){
NRF_PWM0->SEQ[0].REFRESH = 0;
NRF_PWM0->SEQ[0].ENDDELAY = 0;

//NRF_PWM0->INTENSET = PWM_INTENSET_SEQEND0_Enabled << PWM_INTENSET_SEQEND0_Pos;
//NVIC_EnableIRQ(PWM0_IRQn);
NRF_PWM0->TASKS_SEQSTART[0] = 1;
#endif //USE_I2s
}
Expand Down Expand Up @@ -578,15 +589,27 @@ void AutoAnalog::set_callback(void(*function)(uint16_t *buf, uint32_t buf_len)){
_onReceive = function;
}

void DACC_Handler();

void AutoAnalog::adcCallback(uint16_t *buf, uint32_t buf_len){

for(uint32_t i=0; i < buf_len; i++){
adcBuffer16[i] = buf[i];
}
DACC_Handler();
adcReady = true;
}

extern "C" {
__attribute__((__used__)) void PWM0_IRQHandler(void){

//AutoAnalog::sampleCounter++;

}


}




#endif
#endif //#if defined (ARDUINO_ARCH_SAM)
#endif //#if defined (ARDUINO_ARCH_SAM)

0 comments on commit e5e1caa

Please sign in to comment.