void speaker_playShoot(void) { count = 0; period = SPEAKER_SHOOT_PERIOD; speaker_pause(); speaker_setPeriod(SPEAKER_SHOOT_PERIOD); speaker_attachInterrupt(SPEAKER_CHANNEL, speaker_shoot); speaker_refresh(); speaker_resume(); }
void speaker_start(void) { gpio_set_mode(SPEAKER_PORT, SPEAKER_PIN, GPIO_OUTPUT_PP); timer_init(SPEAKER_TIMER); speaker_pause(); speaker_setMode(SPEAKER_CHANNEL, TIMER_OUTPUT_COMPARE); speaker_setCompare(SPEAKER_CHANNEL, SPEAKER_COMPARE); speaker_refresh(); }
void speaker_playHit(void){ gps_disableInterrupt(); speaker_count = 0; speaker_period = SPEAKER_HIT_PERIOD; speaker_pause(); speaker_setPeriod(SPEAKER_HIT_PERIOD); speaker_attachInterrupt(SPEAKER_CHANNEL, speaker_hit); speaker_refresh(); speaker_resume(); }
void speaker_shoot(void) { count++; speaker_toggle(); if(count > MAX_COUNT_SHOOT) { speaker_pause(); speaker_detachInterrupt(SPEAKER_CHANNEL); gpio_write_bit(SPEAKER_PORT, SPEAKER_PIN, 0); } else if( count % SPEAKER_SHOOT_MOD == 0 ) { period += SPEAKER_SHOOT_INCREASE; speaker_setPeriod(period); speaker_refresh(); } }
void speaker_hit(void){ speaker_count++; speaker_toggle(); if(speaker_count >= MAX_COUNT_HIT){ speaker_pause(); speaker_detachInterrupt(SPEAKER_CHANNEL); gpio_write_bit(SPEAKER_PORT, SPEAKER_PIN, 0); gps_enableInterrupt(); } else if( speaker_count % SPEAKER_HIT_MOD == 0 ){ speaker_period += SPEAKER_HIT_INCREASE; speaker_setPeriod(speaker_period); speaker_refresh(); } }