]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Merge branch 'master' of github.com:jackhumbert/qmk_firmware
authorJack Humbert <jack.humb@gmail.com>
Tue, 20 Dec 2016 02:01:27 +0000 (21:01 -0500)
committerJack Humbert <jack.humb@gmail.com>
Tue, 20 Dec 2016 02:01:27 +0000 (21:01 -0500)
keyboards/ergodox/ez/config.h
keyboards/planck/keymaps/default/Makefile
keyboards/planck/rules.mk
keyboards/preonic/rules.mk
quantum/api.c
quantum/audio/audio.c
quantum/audio/voices.c
quantum/audio/voices.h
quantum/light_ws2812.h

index a3dc5bf152ad1a09ca2186ea3a013346119e7c29..2e273eb9733aedb9e9e49446b3d991433886a258 100644 (file)
@@ -52,6 +52,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define RGB_MIDI
 #define RGBW_BB_TWI
 
+#define RGBW 1
 
 /* Set 0 if debouncing isn't needed */
 #define DEBOUNCE    5
index 17487ebbfc8fd64692d15608eb6021d57417b054..457a3d01d4a4f6d3a66baaac45d37543aacf7888 100644 (file)
@@ -1,25 +1,3 @@
-
-
-# Build Options
-#   change to "no" to disable the options, or define them in the Makefile in 
-#   the appropriate keymap folder that will get included automatically
-#
-BOOTMAGIC_ENABLE = no       # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = no       # Mouse keys(+4700)
-EXTRAKEY_ENABLE = yes       # Audio control and System control(+450)
-CONSOLE_ENABLE = no         # Console for debug(+400)
-COMMAND_ENABLE = no        # Commands for debug and configuration
-NKRO_ENABLE = yes            # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-BACKLIGHT_ENABLE = no      # Enable keyboard backlight functionality
-MIDI_ENABLE = yes            # MIDI controls
-AUDIO_ENABLE = yes           # Audio output on port C6
-UNICODE_ENABLE = no         # Unicode
-BLUETOOTH_ENABLE = no       # Enable Bluetooth with the Adafruit EZ-Key HID
-RGBLIGHT_ENABLE = no        # Enable WS2812 RGB underlight
-
-# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
-SLEEP_LED_ENABLE = no    # Breathing sleep LED during USB suspend
-
 ifndef QUANTUM_DIR
        include ../../../../Makefile
 endif
index fb24e823540a1901b3f5c91d228b9c4871121b8b..4423d422f6f5a6f92b531e840495ecd55672a86b 100644 (file)
@@ -51,17 +51,17 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 #   the appropriate keymap folder that will get included automatically
 #
 BOOTMAGIC_ENABLE ?= no       # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE ?= yes       # Mouse keys(+4700)
+MOUSEKEY_ENABLE ?= no       # Mouse keys(+4700)
 EXTRAKEY_ENABLE ?= yes       # Audio control and System control(+450)
 CONSOLE_ENABLE ?= no         # Console for debug(+400)
-COMMAND_ENABLE ?= yes        # Commands for debug and configuration
+COMMAND_ENABLE ?= no        # Commands for debug and configuration
 NKRO_ENABLE ?= no            # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-BACKLIGHT_ENABLE ?= yes      # Enable keyboard backlight functionality
-MIDI_ENABLE ?= no            # MIDI controls
-AUDIO_ENABLE ?= no           # Audio output on port C6
+BACKLIGHT_ENABLE ?= no      # Enable keyboard backlight functionality
+MIDI_ENABLE ?= yes            # MIDI controls
+AUDIO_ENABLE ?= yes           # Audio output on port C6
 UNICODE_ENABLE ?= no         # Unicode
 BLUETOOTH_ENABLE ?= no       # Enable Bluetooth with the Adafruit EZ-Key HID
-RGBLIGHT_ENABLE ?= no        # Enable WS2812 RGB underlight.  Do not enable this with audio at the same time.
+RGBLIGHT_ENABLE ?= no        # Enable WS2812 RGB underlight.
 API_SYSEX_ENABLE = yes
 
 # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
index 071bfdc7fe7f18bba9793b26f14d599234d246df..62473e3564a994a95f876c79196df2b202e52078 100644 (file)
@@ -58,12 +58,12 @@ EXTRAKEY_ENABLE ?= yes       # Audio control and System control(+450)
 CONSOLE_ENABLE ?= no         # Console for debug(+400)
 COMMAND_ENABLE ?= no        # Commands for debug and configuration
 NKRO_ENABLE ?= no            # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-BACKLIGHT_ENABLE ?= yes      # Enable keyboard backlight functionality
+BACKLIGHT_ENABLE ?= no      # Enable keyboard backlight functionality
 MIDI_ENABLE ?= yes            # MIDI controls
 AUDIO_ENABLE ?= yes           # Audio output on port C6
 UNICODE_ENABLE ?= no         # Unicode
 BLUETOOTH_ENABLE ?= no       # Enable Bluetooth with the Adafruit EZ-Key HID
-RGBLIGHT_ENABLE ?= no        # Enable WS2812 RGB underlight.  Do not enable this with audio at the same time.
+RGBLIGHT_ENABLE ?= no        # Enable WS2812 RGB underlight.
 API_SYSEX_ENABLE ?= yes
 
 # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
index 4ca3b96762dd3a44cf8bb31d79e25910abb5e5bc..6a7c0a4332a3e0789db430a8e3a7d97fb410e788 100644 (file)
@@ -116,28 +116,29 @@ void process_api(uint16_t length, uint8_t * data) {
                     MT_GET_DATA_ACK(DT_KEYMAP_SIZE, keymap_size, 2);
                     break;
                 }
-                case DT_KEYMAP: {
-                    uint8_t keymap_data[MATRIX_ROWS * MATRIX_COLS * 4 + 3];
-                    keymap_data[0] = data[2];
-                    keymap_data[1] = MATRIX_ROWS;
-                    keymap_data[2] = MATRIX_COLS;
-                    for (int i = 0; i < MATRIX_ROWS; i++) {
-                        for (int j = 0; j < MATRIX_COLS; j++) {
-                            keymap_data[3 + (i*MATRIX_COLS*2) + (j*2)] = pgm_read_word(&keymaps[data[2]][i][j]) >> 8;
-                            keymap_data[3 + (i*MATRIX_COLS*2) + (j*2) + 1] = pgm_read_word(&keymaps[data[2]][i][j]) & 0xFF;
-                        }
-                    }
-                    MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, MATRIX_ROWS * MATRIX_COLS * 4 + 3);
-                    // uint8_t keymap_data[5];
-                    // keymap_data[0] = data[2];
-                    // keymap_data[1] = data[3];
-                    // keymap_data[2] = data[4];
-                    // keymap_data[3] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) >> 8;
-                    // keymap_data[4] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) & 0xFF;
+                // This may be too much
+                // case DT_KEYMAP: {
+                //     uint8_t keymap_data[MATRIX_ROWS * MATRIX_COLS * 4 + 3];
+                //     keymap_data[0] = data[2];
+                //     keymap_data[1] = MATRIX_ROWS;
+                //     keymap_data[2] = MATRIX_COLS;
+                //     for (int i = 0; i < MATRIX_ROWS; i++) {
+                //         for (int j = 0; j < MATRIX_COLS; j++) {
+                //             keymap_data[3 + (i*MATRIX_COLS*2) + (j*2)] = pgm_read_word(&keymaps[data[2]][i][j]) >> 8;
+                //             keymap_data[3 + (i*MATRIX_COLS*2) + (j*2) + 1] = pgm_read_word(&keymaps[data[2]][i][j]) & 0xFF;
+                //         }
+                //     }
+                //     MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, MATRIX_ROWS * MATRIX_COLS * 4 + 3);
+                //     // uint8_t keymap_data[5];
+                //     // keymap_data[0] = data[2];
+                //     // keymap_data[1] = data[3];
+                //     // keymap_data[2] = data[4];
+                //     // keymap_data[3] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) >> 8;
+                //     // keymap_data[4] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) & 0xFF;
 
-                    // MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, 5);
-                    break;
-                }
+                //     // MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, 5);
+                //     break;
+                // }
                 default:
                     break;
             }
index ead5fbf3e9e595d0d341c8531a237043735817ac..2a315fd1688de7d0a4c61a23a66274c5006afb4d 100644 (file)
@@ -77,6 +77,7 @@ static bool audio_initialized = false;
 audio_config_t audio_config;
 
 uint16_t envelope_index = 0;
+bool glissando = true;
 
 void audio_init()
 {
@@ -205,13 +206,17 @@ ISR(TIMER3_COMPA_vect)
                                        freq = frequencies[voice_place];
                                #endif
                        } else {
-                               if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
-                                       frequency = frequency * pow(2, 440/frequency/12/2);
-                               } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
-                                       frequency = frequency * pow(2, -440/frequency/12/2);
+                               if (glissando) {
+                                       if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
+                                               frequency = frequency * pow(2, 440/frequency/12/2);
+                                       } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
+                                               frequency = frequency * pow(2, -440/frequency/12/2);
+                                       } else {
+                                               frequency = frequencies[voices - 1];
+                                       }
                                } else {
                                        frequency = frequencies[voices - 1];
-                               }
+                               }                               
 
                                #ifdef VIBRATO_ENABLE
                                        if (vibrato_strength > 0) {
index 19f7b646ef8eb2a71304e4bb9a5b612283da27c5..06ff275ba43b985739b74e737a392865ccab9914 100644 (file)
@@ -6,6 +6,7 @@
 extern uint16_t envelope_index;
 extern float note_timbre;
 extern float polyphony_rate;
+extern bool glissando;
 
 voice_type voice = default_voice;
 
@@ -27,11 +28,13 @@ float voice_envelope(float frequency) {
 
     switch (voice) {
         case default_voice:
+            glissando = true;
             note_timbre = TIMBRE_50;
             polyphony_rate = 0;
                break;
 
         case something:
+            glissando = false;
             polyphony_rate = 0;
             switch (compensated_index) {
                 case 0 ... 9:
@@ -43,16 +46,51 @@ float voice_envelope(float frequency) {
                     break;
 
                 case 20 ... 200:
-                    note_timbre = .25 + .125 + pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
+                    note_timbre = .125 + .125;
                     break;
 
                 default:
-                    note_timbre = .25;
+                    note_timbre = .125;
                     break;
             }
             break;
 
+        case drums:
+            glissando = false;
+            polyphony_rate = 0;
+                note_timbre = 0;
+                switch (envelope_index) {
+                    case 0 ... 20:
+                        note_timbre = 0.5;
+                    default:
+                        frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8);
+                        break;
+                }
+            // if (frequency < 80.0) {
+            //     switch (envelope_index % 4) {
+            //         case 0:
+            //             frequency = 348.0;
+            //         case 1:
+            //             frequency = 53.0;
+            //         case 2:
+            //             frequency = 128.0;
+            //         case 3:
+            //             frequency = 934.0;
+            //         default:
+            //             break;
+            //     }
+            // } else if (frequency < 160.0) {
+
+            // } else if (frequency < 320.0) {
+
+            // } else if (frequency < 640.0) {
+
+            // } else if (frequency < 1280.0) {
+
+            // }
+            break;
         case butts_fader:
+            glissando = true;
             polyphony_rate = 0;
             switch (compensated_index) {
                 case 0 ... 9:
@@ -100,6 +138,7 @@ float voice_envelope(float frequency) {
 
         case duty_osc:
             // This slows the loop down a substantial amount, so higher notes may freeze
+            glissando = true;
             polyphony_rate = 0;
             switch (compensated_index) {
                 default:
@@ -114,6 +153,7 @@ float voice_envelope(float frequency) {
                break;
 
         case duty_octave_down:
+            glissando = true;
             polyphony_rate = 0;
             note_timbre = (envelope_index % 2) * .125 + .375 * 2;
             if ((envelope_index % 4) == 0)
@@ -122,6 +162,7 @@ float voice_envelope(float frequency) {
                 note_timbre = 0;
             break;
         case delayed_vibrato:
+            glissando = true;
             polyphony_rate = 0;
             note_timbre = TIMBRE_50;
             #define VOICE_VIBRATO_DELAY 150
index b43def3d7d03c30f0912e2f71ecfd289d03d1f75..72f139e9cd10f40e1a1886fa4e84e54e1093def1 100644 (file)
@@ -12,6 +12,7 @@ float voice_envelope(float frequency);
 typedef enum {
     default_voice,
     something,
+    drums,
     butts_fader,
     octave_crunch,
     duty_osc,
index 9498e550e97fddb6a7456e1bc0bc004c246fa8bf..2f78c20fc1cc8e1916d516d1200a9f112af61cc8 100755 (executable)
 //#include "ws2812_config.h"
 //#include "i2cmaster.h"
 
-#define LIGHT_I2C 1
-#define LIGHT_I2C_ADDR        0x84
-#define LIGHT_I2C_ADDR_WRITE  ( (LIGHT_I2C_ADDR<<1) | I2C_WRITE )
-#define LIGHT_I2C_ADDR_READ   ( (LIGHT_I2C_ADDR<<1) | I2C_READ  )
-
-#define RGBW 1
-
 #ifdef RGBW
   #define LED_TYPE struct cRGBW
 #else