void AudioFilter::readValues() { setRST(1); setRST(0); for (uint8_t i = 0; i < 7; i++) { setSTROBE(0); Timing::delayMicroseconds(65); leftBuffer[i] = readAnalog(ADC_Channel_9); rightBuffer[i] = readAnalog(ADC_Channel_8); setSTROBE(1); } }
void MAX3421E::pinInit(void) { INT_DDR &= ~_BV(INT); RST_DDR |= _BV(RST); digitalWrite(MAX_SS,HIGH); setRST(HIGH); }
/* Constructor */ MAX3421E::MAX3421E( void ) { // initialize SPI pins pinMode( SCK_PIN, OUTPUT ); pinMode( MISO_PIN, INPUT ); pinMode( MOSI_PIN, OUTPUT ); pinMode( SS_PIN, OUTPUT ); digitalWrite( SCK_PIN, HIGH ); digitalWrite( MOSI_PIN, HIGH ); digitalWrite( SS_PIN, HIGH ); // initialize pins pinMode( INT_PIN, INPUT ); pinMode( GPX_PIN, INPUT ); pinMode( RST_PIN, OUTPUT ); setRST( HIGH ); if (SPI_SAUxEN == 0) { #ifdef WORKAROUND_READ_MODIFY_WRITE SBI2(SFR2_PER0, SFR2_BIT_SAUxEN); /* supply SAUx clock */ #else SPI_SAUxEN = 1U; /* supply SAUx clock */ #endif NOP(); NOP(); NOP(); NOP(); SPI_SPSx = 0x0001U; } #ifdef WORKAROUND_READ_MODIFY_WRITE SPI_STx |= SPI_CHx; /* disable CSIxx */ CBI(SFR_IFxx, SFR_BIT_CSIIFxx); /* clear INTCSIxx interrupt flag */ SBI(SFR_MKxx, SFR_BIT_CSIMKxx); /* disable INTCSIxx interrupt */ CBI(SFR_PR1xx, SFR_BIT_CSIPR1xx); /* set INTCSIxx high priority */ CBI(SFR_PR0xx, SFR_BIT_CSIPR0xx); #else SPI_STx |= SPI_CHx; /* disable CSIxx */ SPI_CSIIFxx = 0U; /* clear INTCSIxx interrupt flag */ SPI_CSIMKxx = 1U; /* disable INTCSIxx interrupt */ SPI_CSIPR1xx = 0U; /* set INTCSIxx high priority */ SPI_CSIPR0xx = 0U; #endif SPI_SIRxx = 0x0007U; /* clear error flag */ SPI_SMRxx = 0x0020U; SPI_SCRxx = 0xF007U; SPI_SDRxx = 0x0200U; SPI_SOx |= SPI_CHx << 8; /* CSIxx clock initial level */ SPI_SOx &= ~SPI_CHx; /* CSIxx SO initial level */ SPI_SOEx |= SPI_CHx; /* enable CSIxx output */ SPI_SSx |= SPI_CHx; /* enable CSIxx */ }
void MAX3421E::pinInit(void) { //Reset pin mode = OUT setRSTPIN(); // Pull SPI !SS high setSSPIN(); set_SS(1); // Reset setRST(1); }