From 1dcee07eaba6de71211322fb8be327cc4d1069e2 Mon Sep 17 00:00:00 2001 From: Rob Rogers Date: Mon, 17 Oct 2016 08:04:29 -0500 Subject: Move hand_swap_config to ez.c, removes error for infinity --- keyboards/ergodox/ez/ez.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/ez.c b/keyboards/ergodox/ez/ez.c index e7afc9859..1052e2fbb 100644 --- a/keyboards/ergodox/ez/ez.c +++ b/keyboards/ergodox/ez/ez.c @@ -83,3 +83,25 @@ out: } +#ifdef ONEHAND_ENABLE +__attribute__ ((weak)) +// swap-hands action needs a matrix to define the swap +const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + /* Left hand, matrix positions */ + {{0,13}, {1,13}, {2,13}, {3,13}, {4,13}, {5,13}}, + {{0,12}, {1,12}, {2,12}, {3,12}, {4,12}, {5,12}}, + {{0,11}, {1,11}, {2,11}, {3,11}, {4,11}, {5,11}}, + {{0,10}, {1,10}, {2,10}, {3,10}, {4,10}, {5,10}}, + {{0,9}, {1,9}, {2,9}, {3,9}, {4,9}, {5,9}}, + {{0,8}, {1,8}, {2,8}, {3,8}, {4,8}, {5,8}}, + {{0,7}, {1,7}, {2,7}, {3,7}, {4,7}, {5,7}}, + /* Right hand, matrix positions */ + {{0,6}, {1,6}, {2,6}, {3,6}, {4,6}, {5,6}}, + {{0,5}, {1,5}, {2,5}, {3,5}, {4,5}, {5,5}}, + {{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}}, + {{0,3}, {1,3}, {2,3}, {3,3}, {4,3}, {5,3}}, + {{0,2}, {1,2}, {2,2}, {3,2}, {4,2}, {5,2}}, + {{0,1}, {1,1}, {2,1}, {3,1}, {4,1}, {5,1}}, + {{0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}}, +}; +#endif -- cgit v1.2.3 From 75ea142d01a92345c43c5ac776cc61ec805c8869 Mon Sep 17 00:00:00 2001 From: Rob Rogers Date: Tue, 18 Oct 2016 13:59:19 -0500 Subject: Update ez.c --- keyboards/ergodox/ez/ez.c | 1 - 1 file changed, 1 deletion(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/ez.c b/keyboards/ergodox/ez/ez.c index 1052e2fbb..ddb8ff0cf 100644 --- a/keyboards/ergodox/ez/ez.c +++ b/keyboards/ergodox/ez/ez.c @@ -82,7 +82,6 @@ out: return mcp23018_status; } - #ifdef ONEHAND_ENABLE __attribute__ ((weak)) // swap-hands action needs a matrix to define the swap -- cgit v1.2.3 From e9f748751808de2f1e85cf7fb670d78773bd5e76 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sun, 13 Nov 2016 23:02:38 -0500 Subject: mostly working --- keyboards/ergodox/ez/ez.c | 10 +++- keyboards/ergodox/ez/matrix.c | 2 +- keyboards/ergodox/keymaps/jack/Makefile | 1 + keyboards/ergodox/keymaps/jack/config.h | 4 +- quantum/light_ws2812.c | 21 ++++--- quantum/light_ws2812.h | 14 ++++- quantum/quantum.c | 1 + quantum/rgblight.c | 101 ++++++++++++++++---------------- quantum/rgblight.h | 10 ++-- tmk_core/protocol/lufa/lufa.c | 33 ++++++++++- 10 files changed, 125 insertions(+), 72 deletions(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/ez.c b/keyboards/ergodox/ez/ez.c index ddb8ff0cf..039e4c6bb 100644 --- a/keyboards/ergodox/ez/ez.c +++ b/keyboards/ergodox/ez/ez.c @@ -16,10 +16,10 @@ void matrix_init_kb(void) { // unused pins - C7, D4, D5, D7, E6 // set as input with internal pull-ip enabled DDRC &= ~(1<<7); - DDRD &= ~(1<<7 | 1<<5 | 1<<4); + DDRD &= ~(1<<5 | 1<<4); DDRE &= ~(1<<6); PORTC |= (1<<7); - PORTD |= (1<<7 | 1<<5 | 1<<4); + PORTD |= (1<<5 | 1<<4); PORTE |= (1<<6); ergodox_blink_all_leds(); @@ -51,6 +51,10 @@ uint8_t init_mcp23018(void) { mcp23018_status = 0x20; // I2C subsystem + + uint8_t sreg_prev; + sreg_prev=SREG; + cli(); if (i2c_initialized == 0) { i2c_init(); // on pins D(1,0) i2c_initialized++; @@ -79,6 +83,8 @@ uint8_t init_mcp23018(void) { out: i2c_stop(); + SREG=sreg_prev; + return mcp23018_status; } diff --git a/keyboards/ergodox/ez/matrix.c b/keyboards/ergodox/ez/matrix.c index a19bab90b..43f515259 100644 --- a/keyboards/ergodox/ez/matrix.c +++ b/keyboards/ergodox/ez/matrix.c @@ -121,7 +121,7 @@ void matrix_init(void) matrix_scan_count = 0; #endif - matrix_init_kb(); + matrix_init_quantum(); } diff --git a/keyboards/ergodox/keymaps/jack/Makefile b/keyboards/ergodox/keymaps/jack/Makefile index 1e5761278..7c257af50 100644 --- a/keyboards/ergodox/keymaps/jack/Makefile +++ b/keyboards/ergodox/keymaps/jack/Makefile @@ -1,4 +1,5 @@ RGBLIGHT_ENABLE = yes +MIDI_ENABLE = yes ifndef QUANTUM_DIR include ../../../../Makefile diff --git a/keyboards/ergodox/keymaps/jack/config.h b/keyboards/ergodox/keymaps/jack/config.h index 1781563b8..5bf109c18 100644 --- a/keyboards/ergodox/keymaps/jack/config.h +++ b/keyboards/ergodox/keymaps/jack/config.h @@ -5,10 +5,12 @@ /* ws2812 RGB LED */ #define RGB_DI_PIN D7 -// #define RGBLIGHT_TIMER +#define RGBLIGHT_TIMER #define RGBLED_NUM 15 // Number of LEDs #define RGBLIGHT_HUE_STEP 12 #define RGBLIGHT_SAT_STEP 255 #define RGBLIGHT_VAL_STEP 12 +#define RGB_MIDI + #endif \ No newline at end of file diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c index 497543339..6edbc0f2b 100755 --- a/quantum/light_ws2812.c +++ b/quantum/light_ws2812.c @@ -133,13 +133,13 @@ unsigned char I2C_Write(unsigned char c) #endif // Setleds for standard RGB -void inline ws2812_setleds(struct cRGB *ledarray, uint16_t leds) +void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) { // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF)); } -void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pinmask) +void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) { // ws2812_DDRREG |= pinmask; // Enable DDR // new universal format (DDR) @@ -150,12 +150,15 @@ void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pin } // Setleds for SK6812RGBW -void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds) +void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) { #ifdef RGBW_BB_TWI + uint8_t sreg_prev, twcr_prev; + sreg_prev=SREG; + twcr_prev=TWCR; cli(); - TWCR = 0; + TWCR &= ~(1<> 8) & 0xff; - OCR3AL = RGBLED_TIMER_TOP & 0xff; - SREG = sreg; + // static uint8_t rgblight_timer_is_init = 0; + // if (rgblight_timer_is_init) { + // return; + // } + // rgblight_timer_is_init = 1; + // /* Timer 3 setup */ + // TCCR3B = _BV(WGM32) // CTC mode OCR3A as TOP + // | _BV(CS30); // Clock selelct: clk/1 + // /* Set TOP value */ + // uint8_t sreg = SREG; + // cli(); + // OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff; + // OCR3AL = RGBLED_TIMER_TOP & 0xff; + // SREG = sreg; + + rgblight_timer_enabled = true; } void rgblight_timer_enable(void) { - TIMSK3 |= _BV(OCIE3A); + rgblight_timer_enabled = true; dprintf("TIMER3 enabled.\n"); } void rgblight_timer_disable(void) { - TIMSK3 &= ~_BV(OCIE3A); + rgblight_timer_enabled = false; dprintf("TIMER3 disabled.\n"); } void rgblight_timer_toggle(void) { - TIMSK3 ^= _BV(OCIE3A); + rgblight_timer_enabled ^= rgblight_timer_enabled; dprintf("TIMER3 toggled.\n"); } -ISR(TIMER3_COMPA_vect) { - // mode = 1, static light, do nothing here - if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { - // mode = 2 to 5, breathing mode - rgblight_effect_breathing(rgblight_config.mode - 2); - } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) { - // mode = 6 to 8, rainbow mood mod - rgblight_effect_rainbow_mood(rgblight_config.mode - 6); - } else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) { - // mode = 9 to 14, rainbow swirl mode - rgblight_effect_rainbow_swirl(rgblight_config.mode - 9); - } else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) { - // mode = 15 to 20, snake mode - rgblight_effect_snake(rgblight_config.mode - 15); - } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { - // mode = 21 to 23, knight mode - rgblight_effect_knight(rgblight_config.mode - 21); +void rgblight_task(void) { + if (rgblight_timer_enabled) { + // mode = 1, static light, do nothing here + if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { + // mode = 2 to 5, breathing mode + rgblight_effect_breathing(rgblight_config.mode - 2); + } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) { + // mode = 6 to 8, rainbow mood mod + rgblight_effect_rainbow_mood(rgblight_config.mode - 6); + } else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) { + // mode = 9 to 14, rainbow swirl mode + rgblight_effect_rainbow_swirl(rgblight_config.mode - 9); + } else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) { + // mode = 15 to 20, snake mode + rgblight_effect_snake(rgblight_config.mode - 15); + } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { + // mode = 21 to 23, knight mode + rgblight_effect_knight(rgblight_config.mode - 21); + } } } @@ -461,7 +462,7 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) { last_timer = timer_read(); for (i = 0; i < RGBLED_NUM; i++) { hue = (360 / RGBLED_NUM * i + current_hue) % 360; - sethsv(hue, rgblight_config.sat, rgblight_config.val, &led[i]); + sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); } rgblight_set(); @@ -498,7 +499,7 @@ void rgblight_effect_snake(uint8_t interval) { k = k + RGBLED_NUM; } if (i == k) { - sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), &led[i]); + sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), (LED_TYPE *)&led[i]); } } } @@ -518,7 +519,7 @@ void rgblight_effect_knight(uint8_t interval) { static uint16_t last_timer = 0; uint8_t i, j, cur; int8_t k; - struct cRGB preled[RGBLED_NUM]; + LED_TYPE preled[RGBLED_NUM]; static int8_t increment = -1; if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) { return; @@ -537,7 +538,7 @@ void rgblight_effect_knight(uint8_t interval) { k = RGBLED_NUM - 1; } if (i == k) { - sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, &preled[i]); + sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&preled[i]); } } } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index efc685f31..d16ba24e5 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -1,8 +1,6 @@ #ifndef RGBLIGHT_H #define RGBLIGHT_H -#define RGBW 1 - #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) #define RGBLIGHT_MODES 23 #else @@ -35,6 +33,7 @@ #endif #define RGBLED_TIMER_TOP F_CPU/(256*64) +// #define RGBLED_TIMER_TOP 0xFF10 #include #include @@ -79,10 +78,13 @@ void eeconfig_update_rgblight(uint32_t val); void eeconfig_update_rgblight_default(void); void eeconfig_debug_rgblight(void); -void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1); -void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1); +void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); +void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); + +void rgblight_task(void); + void rgblight_timer_init(void); void rgblight_timer_enable(void); void rgblight_timer_disable(void); diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 01c0e45b0..fe466f604 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -71,6 +71,10 @@ #include "virtser.h" #endif +#ifdef RGB_MIDI + #include "rgblight.h" +#endif + uint8_t keyboard_idle = 0; /* 0: Boot Protocol, 1: Report Protocol(default) */ uint8_t keyboard_protocol = 1; @@ -1045,6 +1049,10 @@ int main(void) #endif keyboard_task(); +#ifdef RGBLIGHT_ENABLE + rgblight_task(); +#endif + #ifdef VIRTSER_ENABLE virtser_task(); CDC_Device_USBTask(&cdc_device); @@ -1077,15 +1085,34 @@ void fallthrough_callback(MidiDevice * device, #endif } +#ifdef RGB_MIDI + rgblight_config_t rgblight_config; +#endif + void cc_callback(MidiDevice * device, uint8_t chan, uint8_t num, uint8_t val) { //sending it back on the next channel - midi_send_cc(device, (chan + 1) % 16, num, val); + // midi_send_cc(device, (chan + 1) % 16, num, val); + #ifdef RGB_MIDI + rgblight_config.raw = eeconfig_read_rgblight(); + switch (num) { + case 14: + rgblight_config.hue = val * 360 / 127; + break; + case 15: + rgblight_config.sat = val << 1; + break; + case 16: + rgblight_config.val = val << 1; + break; + } + rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); + #endif } void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data) { - for (int i = 0; i < length; i++) - midi_send_cc(device, 15, 0x7F & data[i], 0x7F & (start + i)); + // for (int i = 0; i < length; i++) + // midi_send_cc(device, 15, 0x7F & data[i], 0x7F & (start + i)); } #endif -- cgit v1.2.3 From 06a2677b7eedbf58532fa1a673ba1277e756174d Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 21 Nov 2016 20:17:32 -0500 Subject: fix infinity --- keyboards/ergodox/config.h | 2 -- keyboards/ergodox/ez/config.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/config.h b/keyboards/ergodox/config.h index 049c707a5..edc60caae 100644 --- a/keyboards/ergodox/config.h +++ b/keyboards/ergodox/config.h @@ -1,8 +1,6 @@ #ifndef KEYBOARDS_ERGODOX_CONFIG_H_ #define KEYBOARDS_ERGODOX_CONFIG_H_ -#include "config_common.h" - #define MOUSEKEY_DELAY 100 #define MOUSEKEY_INTERVAL 20 #define MOUSEKEY_MAX_SPEED 3 diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index 084a044ee..67a856e51 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -21,6 +21,8 @@ along with this program. If not, see . #include "../config.h" +#include "config_common.h" + /* USB Device descriptor parameter */ #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x1307 -- cgit v1.2.3 From 2d0ada01902a0103dc4f4f54a416f0666c641b5b Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Mon, 28 Nov 2016 07:55:02 -0500 Subject: Pulls LED config into common config for EZ --- keyboards/ergodox/ez/config.h | 11 +++++++++++ keyboards/ergodox/keymaps/erez_experimental/config.h | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index 67a856e51..0b7e8b2ee 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -45,6 +45,17 @@ along with this program. If not, see . /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 +/* ws2812 RGB LED */ +#define RGB_DI_PIN D7 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 15 // Number of LEDs +#define RGBLIGHT_HUE_STEP 12 +#define RGBLIGHT_SAT_STEP 255 +#define RGBLIGHT_VAL_STEP 12 + +#define RGB_MIDI +#define RGBW_BB_TWI + /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/ergodox/keymaps/erez_experimental/config.h b/keyboards/ergodox/keymaps/erez_experimental/config.h index fbd12ab79..4da18c65a 100644 --- a/keyboards/ergodox/keymaps/erez_experimental/config.h +++ b/keyboards/ergodox/keymaps/erez_experimental/config.h @@ -9,15 +9,5 @@ #undef LEADER_TIMEOUT #define LEADER_TIMEOUT 300 -/* ws2812 RGB LED */ -#define RGB_DI_PIN D7 -#define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 15 // Number of LEDs -#define RGBLIGHT_HUE_STEP 12 -#define RGBLIGHT_SAT_STEP 255 -#define RGBLIGHT_VAL_STEP 12 - -#define RGB_MIDI -#define RGBW_BB_TWI #endif -- cgit v1.2.3 From 9caf866618840ca38f4ceb1166ad679174c752c3 Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Mon, 28 Nov 2016 07:59:01 -0500 Subject: Tweaks EZ Makefile --- keyboards/ergodox/ez/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/Makefile b/keyboards/ergodox/ez/Makefile index 191c6bb66..9b6121e2c 100644 --- a/keyboards/ergodox/ez/Makefile +++ b/keyboards/ergodox/ez/Makefile @@ -1,3 +1,8 @@ +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +COMMAND_ENABLE = no # Commands for debug and configuration +RGBLIGHT_ENABLE ?= yes +MIDI_ENABLE ?= yes + ifndef MAKEFILE_INCLUDED include ../../../Makefile -endif \ No newline at end of file +endif -- cgit v1.2.3 From 06f18e95d4670a055ca349da7d653e0bcb37d83a Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 29 Nov 2016 00:06:12 -0500 Subject: enable api sysex for ez --- keyboards/ergodox/ez/rules.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/rules.mk b/keyboards/ergodox/ez/rules.mk index a9715beb8..f570061fe 100644 --- a/keyboards/ergodox/ez/rules.mk +++ b/keyboards/ergodox/ez/rules.mk @@ -72,6 +72,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512 # SLEEP_LED_ENABLE = no +API_SYSEX_ENABLE ?= yes ifndef QUANTUM_DIR include ../../../Makefile -- cgit v1.2.3 From d0cefef946660865dae80877886fcce610920a27 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 29 Nov 2016 00:09:56 -0500 Subject: enable rgblight by default for ez --- keyboards/ergodox/ez/config.h | 11 +++++++++++ keyboards/ergodox/ez/rules.mk | 1 + 2 files changed, 12 insertions(+) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index 67a856e51..c2750a321 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -41,6 +41,17 @@ along with this program. If not, see . #define LED_BRIGHTNESS_LO 15 #define LED_BRIGHTNESS_HI 255 +/* ws2812 RGB LED */ +#define RGB_DI_PIN D7 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 15 // Number of LEDs +#define RGBLIGHT_HUE_STEP 12 +#define RGBLIGHT_SAT_STEP 255 +#define RGBLIGHT_VAL_STEP 12 + +#define RGB_MIDI +#define RGBW_BB_TWI + /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 diff --git a/keyboards/ergodox/ez/rules.mk b/keyboards/ergodox/ez/rules.mk index f570061fe..893cfa7a8 100644 --- a/keyboards/ergodox/ez/rules.mk +++ b/keyboards/ergodox/ez/rules.mk @@ -73,6 +73,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512 SLEEP_LED_ENABLE = no API_SYSEX_ENABLE ?= yes +RGBLIGHT_ENABLE ?= yes ifndef QUANTUM_DIR include ../../../Makefile -- cgit v1.2.3 From f946d830f98da0161753d37da9659caa7469cf4f Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 29 Nov 2016 00:11:11 -0500 Subject: guess i didnt pull --- keyboards/ergodox/ez/config.h | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index f3e1020bd..c2750a321 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -56,17 +56,6 @@ along with this program. If not, see . /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 -/* ws2812 RGB LED */ -#define RGB_DI_PIN D7 -#define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 15 // Number of LEDs -#define RGBLIGHT_HUE_STEP 12 -#define RGBLIGHT_SAT_STEP 255 -#define RGBLIGHT_VAL_STEP 12 - -#define RGB_MIDI -#define RGBW_BB_TWI - /* * Feature disable options * These options are also useful to firmware size reduction. -- cgit v1.2.3 From 83e613ad239459582ae28f78b6c81535b9b138d7 Mon Sep 17 00:00:00 2001 From: Kyle Smith Date: Wed, 14 Dec 2016 23:24:40 -0500 Subject: Allow power consumption to be set per-keyboard. --- keyboards/ergodox/ez/config.h | 2 ++ tmk_core/protocol/lufa/descriptor.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index c2750a321..a3dc5bf15 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -56,6 +56,8 @@ along with this program. If not, see . /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 +#define USB_MAX_POWER_CONSUMPTION 50 + /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c index bf47787d2..14d99b50b 100644 --- a/tmk_core/protocol/lufa/descriptor.c +++ b/tmk_core/protocol/lufa/descriptor.c @@ -40,6 +40,9 @@ #include "report.h" #include "descriptor.h" +#ifndef USB_MAX_POWER_CONSUMPTION +#define USB_MAX_POWER_CONSUMPTION 500 +#endif /******************************************************************************* * HID Report Descriptors @@ -294,7 +297,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_REMOTEWAKEUP), - .MaxPowerConsumption = USB_CONFIG_POWER_MA(500) + .MaxPowerConsumption = USB_CONFIG_POWER_MA(USB_MAX_POWER_CONSUMPTION) }, /* -- cgit v1.2.3 From 29731588b74d9a3416d42bc292b47b3634c772d7 Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Mon, 19 Dec 2016 08:27:05 -0500 Subject: Flips off MIDI and API_SYSEX --- keyboards/ergodox/ez/Makefile | 2 +- keyboards/ergodox/ez/rules.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/Makefile b/keyboards/ergodox/ez/Makefile index 9b6121e2c..1098332b8 100644 --- a/keyboards/ergodox/ez/Makefile +++ b/keyboards/ergodox/ez/Makefile @@ -1,7 +1,7 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend COMMAND_ENABLE = no # Commands for debug and configuration RGBLIGHT_ENABLE ?= yes -MIDI_ENABLE ?= yes +MIDI_ENABLE ?= no ifndef MAKEFILE_INCLUDED include ../../../Makefile diff --git a/keyboards/ergodox/ez/rules.mk b/keyboards/ergodox/ez/rules.mk index 893cfa7a8..64b2db815 100644 --- a/keyboards/ergodox/ez/rules.mk +++ b/keyboards/ergodox/ez/rules.mk @@ -72,7 +72,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512 # SLEEP_LED_ENABLE = no -API_SYSEX_ENABLE ?= yes +API_SYSEX_ENABLE ?= no RGBLIGHT_ENABLE ?= yes ifndef QUANTUM_DIR -- cgit v1.2.3 From 06c64bbff3e228df542149acde64eadaf59b9b0f Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 19 Dec 2016 11:18:18 -0500 Subject: rgb clean-up, api clean-up --- keyboards/ergodox/ez/config.h | 1 + quantum/api.c | 43 +++++++++++++++++++++-------------------- quantum/audio/audio.c | 15 ++++++++++----- quantum/audio/voices.c | 45 +++++++++++++++++++++++++++++++++++++++++-- quantum/audio/voices.h | 1 + quantum/light_ws2812.h | 7 ------- 6 files changed, 77 insertions(+), 35 deletions(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index c2750a321..f532b2d5a 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -52,6 +52,7 @@ along with this program. If not, see . #define RGB_MIDI #define RGBW_BB_TWI +#define RGBW 1 /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 diff --git a/quantum/api.c b/quantum/api.c index 4ca3b9676..6a7c0a433 100644 --- a/quantum/api.c +++ b/quantum/api.c @@ -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; } diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index ead5fbf3e..2a315fd16 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c @@ -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) { diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 19f7b646e..06ff275ba 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -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 diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h index b43def3d7..72f139e9c 100644 --- a/quantum/audio/voices.h +++ b/quantum/audio/voices.h @@ -12,6 +12,7 @@ float voice_envelope(float frequency); typedef enum { default_voice, something, + drums, butts_fader, octave_crunch, duty_osc, diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h index 9498e550e..2f78c20fc 100755 --- a/quantum/light_ws2812.h +++ b/quantum/light_ws2812.h @@ -18,13 +18,6 @@ //#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 -- cgit v1.2.3 From ffc1d97672bcfcf9d7b687025cb70e284c75fd67 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 2 Jan 2017 09:57:39 -0500 Subject: Update config.h --- keyboards/ergodox/ez/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards/ergodox/ez') diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index 2e273eb97..6a8c66d7d 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -57,7 +57,7 @@ along with this program. If not, see . /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 -#define USB_MAX_POWER_CONSUMPTION 50 +#define USB_MAX_POWER_CONSUMPTION 500 /* * Feature disable options -- cgit v1.2.3