From 44625de59a72e69d4bf2948dfc04cc283664a292 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sun, 6 Sep 2015 18:57:23 -0400 Subject: beeps in an if --- keyboard/planck/beeps.c | 62 ++++++++++++++++++------------------------------- 1 file changed, 23 insertions(+), 39 deletions(-) (limited to 'keyboard/planck/beeps.c') diff --git a/keyboard/planck/beeps.c b/keyboard/planck/beeps.c index a1e697be40..8d1f81f210 100644 --- a/keyboard/planck/beeps.c +++ b/keyboard/planck/beeps.c @@ -183,22 +183,6 @@ ISR(TIMER3_COMPA_vect) { // // PORTC |= (1<<6); } -void loop() { -} -// ISR(TIMER1_COMPA_vect) -// { -// // if (i<(sizeof(wave)/sizeof(int))) //don't exceed ends of vector... sizeof(wave) -// if (i 0) { @@ -236,27 +220,27 @@ void play_note(double freq, int vol) { // TCCR3B = 0; } -void note(int x, float length) { - DDRC |= (1<<6); - int t = (int)(440*pow(2,-x/12.0)); // starting note - for (int y = 0; y < length*1000/t; y++) { // note length - PORTC |= (1<<6); - delay_us(t); - PORTC &= ~(1<<6); - delay_us(t); - } - PORTC &= ~(1<<6); -} +// void note(int x, float length) { +// DDRC |= (1<<6); +// int t = (int)(440*pow(2,-x/12.0)); // starting note +// for (int y = 0; y < length*1000/t; y++) { // note length +// PORTC |= (1<<6); +// delay_us(t); +// PORTC &= ~(1<<6); +// delay_us(t); +// } +// PORTC &= ~(1<<6); +// } -void true_note(float x, float y, float length) { - for (uint32_t i = 0; i < length * 50; i++) { - uint32_t v = (uint32_t) (round(sin(PI*2*i*640000*pow(2, x/12.0))*.5+1 + sin(PI*2*i*640000*pow(2, y/12.0))*.5+1) / 2 * pow(2, 8)); - for (int u = 0; u < 8; u++) { - if (v & (1 << u) && !(PORTC&(1<<6))) - PORTC |= (1<<6); - else if (PORTC&(1<<6)) - PORTC &= ~(1<<6); - } - } - PORTC &= ~(1<<6); -} \ No newline at end of file +// void true_note(float x, float y, float length) { +// for (uint32_t i = 0; i < length * 50; i++) { +// uint32_t v = (uint32_t) (round(sin(PI*2*i*640000*pow(2, x/12.0))*.5+1 + sin(PI*2*i*640000*pow(2, y/12.0))*.5+1) / 2 * pow(2, 8)); +// for (int u = 0; u < 8; u++) { +// if (v & (1 << u) && !(PORTC&(1<<6))) +// PORTC |= (1<<6); +// else if (PORTC&(1<<6)) +// PORTC &= ~(1<<6); +// } +// } +// PORTC &= ~(1<<6); +// } \ No newline at end of file -- cgit v1.2.3