diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index e58c07c..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..8127619 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +ArduinoSynth +============ + +This is a fork of Illutron's ArduinoSynth repo. + +__Arduino MEGA__ boards: Pin __10__ +__Arduino ATmega328/168 based__ boards (Duemilanove, Uno, etc.): Pin __6__ + +__Implemented features:__ +-Compatibility with Arduino MEGA(2560) boards + + +__What's to be added is:__ +-Basic documentation +-Choosing output pin manually, although only PWM (originally fixed to pin 6) diff --git a/synthOriginal/the_synth.h b/synthOriginal/the_synth.h index 28a484c..50e64ff 100644 --- a/synthOriginal/the_synth.h +++ b/synthOriginal/the_synth.h @@ -116,8 +116,12 @@ SIGNAL(TIMER1_COMPA_vect) //------------------------------- // Synthesizer/audio mixer //------------------------------- - + + #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //Arduino MEGA(2560) boards + OCR2A=127+ + #else //Arduino ATmega168/328 based boards OCR0A=127+ + #endif (( (((signed char)pgm_read_byte(wavs[0]+((PCW[0]+=FTW[0])>>8))*AMP[0])>>8)+ (((signed char)pgm_read_byte(wavs[1]+((PCW[1]+=FTW[1])>>8))*AMP[1])>>8)+ @@ -282,10 +286,17 @@ void initSynth() SET(TIMSK1,OCIE1A); // | sei(); //-+ + #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //Arduino MEGA(2560) boards + TCCR2A=0x83; //-8 bit audio PWM + TCCR2B=0x01; // | + OCR2A=127; //-+ + SET(DDRB,4); //-PWM pin + #else //Arduino ATmega328/168 based boards TCCR0A=0x83; //-8 bit audio PWM TCCR0B=0x01; // | OCR0A=127; //-+ SET(DDRD,6); //-PWM pin + #endif /* UCSR0A=0x02; //-Set up serial port 31250 UCSR0B=0x18; // |