void matrix_scan_quantum() { #if defined(AUDIO_ENABLE) && !defined(NO_MUSIC_MODE) matrix_scan_music(); #endif #ifdef TAP_DANCE_ENABLE matrix_scan_tap_dance(); #endif #ifdef COMBO_ENABLE matrix_scan_combo(); #endif #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN) backlight_task(); #endif #ifdef RGB_MATRIX_ENABLE rgb_matrix_task(); if (rgb_matrix_task_counter == 0) { rgb_matrix_update_pwm_buffers(); } rgb_matrix_task_counter = ((rgb_matrix_task_counter + 1) % (RGB_MATRIX_SKIP_FRAMES + 1)); #endif matrix_scan_kb(); }
void matrix_scan_kb(void) { // Looping keyboard code goes here // This runs every cycle (a lot) matrix_scan_user(); #ifdef BACKLIGHT_ENABLE backlight_task(); #endif };
void matrix_scan_quantum() { #ifdef AUDIO_ENABLE matrix_scan_music(); #endif #ifdef TAP_DANCE_ENABLE matrix_scan_tap_dance(); #endif #ifdef COMBO_ENABLE matrix_scan_combo(); #endif #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN) backlight_task(); #endif matrix_scan_kb(); }
int main(void) { memset( spectrum, 0, sizeof(spectrum) ); memset( spectrum_history, 0, sizeof(spectrum) ); init(); uint16_t cycles_till_reset_x = LCD_RESET_ADDR_CYCLES; while(1) { if( sleeping ) { sleepcycles++; if( backlight_task_scaler++ >= 75 ) { backlight_task(-1); backlight_task_scaler = 0; } if( sleeping == 3 ) go_to_sleep(); else if( sleeping == 2 ) wake_up(); else // sleeping == 1 { SMCR = _BV(SM0) | _BV(SE); asm volatile( "sleep\n\t" ); } } else { backlight_task_scaler = 0; backlight_task(-1); // Apply window function and store in butterfly array fft_input( capture, bfly ); // Execute forier transform fft_execute( bfly ); // Bit reversal algorithm from butterfly array to output array fft_output( bfly, spectrum ); // Do exponential/FIR filtering with history data exp_average( spectrum, spectrum_history ); #ifdef DISPLAY_TEST_PATTERN uint8_t *sp = spectrum; uint8_t v = 5; uint8_t k = sizeof(spectrum)/sizeof(uint8_t); while( k-- ) { *sp = v; v++; if( v > 38 ) v = 5; sp++; } long t = 100000; while(t--) { asm volatile("nop"); } #else #ifdef BLANK_LEFT_TWO_BARS spectrum[0] = spectrum[1] = 0; #endif #endif avc_task( spectrum ); if( --cycles_till_reset_x <= 0 ) { cycles_till_reset_x = LCD_RESET_ADDR_CYCLES; lcd_write_instruction( LCD_ADDR | 0, CHIP1 ); lcd_write_instruction( LCD_ADDR | 0, CHIP2 ); } fastlcd( spectrum ); loopnum++; } }