diff options
| author | WarmCat <32871908+WarmCatUK@users.noreply.github.com> | 2018-05-10 16:28:58 +0100 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-05-10 08:28:58 -0700 |
| commit | 933842067df08e7d0515049509bdd3fa73b334e1 (patch) | |
| tree | 0e777c72e7f357ec45c9f294d80bda3f5915302e | |
| parent | c5264d6d89899f19bdeeaf9e2daeb90531617a48 (diff) | |
| download | qmk_firmware-933842067df08e7d0515049509bdd3fa73b334e1.tar.gz qmk_firmware-933842067df08e7d0515049509bdd3fa73b334e1.zip | |
Backlight and RGB now working for JJ50 (#2929)
* Added support for JJ50 from KPRepublic, no rgb or backlight control yet. Added as a layout of ymd96 at the moment (same microprocessor). Basic keymap with three layers to get started.
* Added support for JJ50
* Tidied up jj50 code, backlight and RGB is now working.
* Renaming "KEYMAP" to "LAYOUT" to adhere to the new QMK standards.
| -rw-r--r-- | keyboards/jj50/README.md | 6 | ||||
| -rw-r--r-- | keyboards/jj50/backlight.c | 212 | ||||
| -rw-r--r-- | keyboards/jj50/backlight_custom.h | 15 | ||||
| -rw-r--r-- | keyboards/jj50/breathing_custom.h | 140 | ||||
| -rw-r--r-- | keyboards/jj50/config.h | 8 | ||||
| -rw-r--r-- | keyboards/jj50/jj50.c | 61 | ||||
| -rw-r--r-- | keyboards/jj50/jj50.h | 5 | ||||
| -rw-r--r-- | keyboards/jj50/keymaps/default/keymap.c | 75 | ||||
| -rw-r--r-- | keyboards/jj50/matrix.c | 13 | ||||
| -rw-r--r-- | keyboards/jj50/rules.mk | 20 | ||||
| -rw-r--r-- | keyboards/jj50/usbconfig.h | 8 | ||||
| -rw-r--r-- | keyboards/ymd96/keymaps/JJ50/keymap.c | 6 | ||||
| -rw-r--r-- | keyboards/ymd96/ymd96.h | 2 |
13 files changed, 525 insertions, 46 deletions
diff --git a/keyboards/jj50/README.md b/keyboards/jj50/README.md index 39cfc69ca..4c208bcbe 100644 --- a/keyboards/jj50/README.md +++ b/keyboards/jj50/README.md | |||
| @@ -13,6 +13,8 @@ USB report options are supported. | |||
| 13 | Hardware Supported: JJ50 with the ATmega32a chip. | 13 | Hardware Supported: JJ50 with the ATmega32a chip. |
| 14 | Hardware Availability: The JJ50 PCB is available from kprepublic on AliExpress and suchlike. | 14 | Hardware Availability: The JJ50 PCB is available from kprepublic on AliExpress and suchlike. |
| 15 | 15 | ||
| 16 | This version by Wayne K Jones (github.com/WarmCatUK) | ||
| 17 | |||
| 16 | 18 | ||
| 17 | ## Installing and Building | 19 | ## Installing and Building |
| 18 | 20 | ||
| @@ -70,8 +72,10 @@ And flash the compiled hex file with `HIDBootFlash`. Simply put the board in fla | |||
| 70 | 1. Try plugging the board in while pressing `Backspace` (`Key below the top right key`). This will force it to boot only the bootloader without loading the firmware. Once this is done, just reflash the board with the original firmware. | 72 | 1. Try plugging the board in while pressing `Backspace` (`Key below the top right key`). This will force it to boot only the bootloader without loading the firmware. Once this is done, just reflash the board with the original firmware. |
| 71 | 2. Sometimes USB hubs can act weird, so try connecting the board directly to your computer or plugging/unplugging the USB hub. | 73 | 2. Sometimes USB hubs can act weird, so try connecting the board directly to your computer or plugging/unplugging the USB hub. |
| 72 | 3. If you get an error such as "Resource Unavailable" when attemting to flash on Linux, you may want to compile and run `tools/usb_detach.c`. See `tools/README.md` for more info. | 74 | 3. If you get an error such as "Resource Unavailable" when attemting to flash on Linux, you may want to compile and run `tools/usb_detach.c`. See `tools/README.md` for more info. |
| 73 | 4. I was occasionally finding that I wasn't flashing changes that I was making to my keymap. If that happens, simply force rebuild by making with: | 75 | 4. I was occasionally finding that I wasn't flashing changes that I was making to my keymap. If that happens, remove the previous build and simply force rebuild by making with: |
| 74 | ``` | 76 | ``` |
| 77 | $ rm jj50_default.hex | ||
| 78 | $ make -B jj50:default | ||
| 75 | $ make -B jj50:default:program | 79 | $ make -B jj50:default:program |
| 76 | ``` | 80 | ``` |
| 77 | 81 | ||
diff --git a/keyboards/jj50/backlight.c b/keyboards/jj50/backlight.c new file mode 100644 index 000000000..079c410ff --- /dev/null +++ b/keyboards/jj50/backlight.c | |||
| @@ -0,0 +1,212 @@ | |||
| 1 | /** | ||
| 2 | * Backlighting code for PS2AVRGB boards (ATMEGA32A) | ||
| 3 | * Kenneth A. (github.com/krusli | krusli.me) | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include "backlight.h" | ||
| 7 | #include "quantum.h" | ||
| 8 | |||
| 9 | #include <avr/pgmspace.h> | ||
| 10 | #include <avr/interrupt.h> | ||
| 11 | |||
| 12 | #include "backlight_custom.h" | ||
| 13 | #include "breathing_custom.h" | ||
| 14 | |||
| 15 | // DEBUG | ||
| 16 | #include <stdlib.h> | ||
| 17 | #include <stdio.h> | ||
| 18 | |||
| 19 | // Port D: digital pins of the AVR chipset | ||
| 20 | #define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital) | ||
| 21 | #define CAPSLOCK_PORT (1 << 2) // 2nd pin | ||
| 22 | #define BACKLIGHT_PORT (1 << 4) // 4th pin | ||
| 23 | #define SCROLLLOCK_PORT (1 << 6) // 6th pin | ||
| 24 | |||
| 25 | #define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 | ||
| 26 | #define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default | ||
| 27 | |||
| 28 | #define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask | ||
| 29 | |||
| 30 | #define PWM_MAX 0xFF | ||
| 31 | #define TIMER_TOP 255 // 8 bit PWM | ||
| 32 | |||
| 33 | extern backlight_config_t backlight_config; | ||
| 34 | |||
| 35 | /** | ||
| 36 | * References | ||
| 37 | * Port Registers: https://www.arduino.cc/en/Reference/PortManipulation | ||
| 38 | * TCCR1A: https://electronics.stackexchange.com/questions/92350/what-is-the-difference-between-tccr1a-and-tccr1b | ||
| 39 | * Timers: http://www.avrbeginners.net/architecture/timers/timers.html | ||
| 40 | * 16-bit timer setup: http://sculland.com/ATmega168/Interrupts-And-Timers/16-Bit-Timer-Setup/ | ||
| 41 | * PS2AVRGB firmware: https://github.com/showjean/ps2avrU/tree/master/firmware | ||
| 42 | */ | ||
| 43 | |||
| 44 | // @Override | ||
| 45 | // turn LEDs on and off depending on USB caps/num/scroll lock states. | ||
| 46 | void led_set_user(uint8_t usb_led) { | ||
| 47 | if (usb_led & (1 << USB_LED_NUM_LOCK)) { | ||
| 48 | // turn on | ||
| 49 | DDRD |= NUMLOCK_PORT; | ||
| 50 | PORTD |= NUMLOCK_PORT; | ||
| 51 | } else { | ||
| 52 | // turn off | ||
| 53 | DDRD &= ~NUMLOCK_PORT; | ||
| 54 | PORTD &= ~NUMLOCK_PORT; | ||
| 55 | } | ||
| 56 | |||
| 57 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | ||
| 58 | DDRD |= CAPSLOCK_PORT; | ||
| 59 | PORTD |= CAPSLOCK_PORT; | ||
| 60 | } else { | ||
| 61 | DDRD &= ~CAPSLOCK_PORT; | ||
| 62 | PORTD &= ~CAPSLOCK_PORT; | ||
| 63 | } | ||
| 64 | |||
| 65 | if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { | ||
| 66 | DDRD |= SCROLLLOCK_PORT; | ||
| 67 | PORTD |= SCROLLLOCK_PORT; | ||
| 68 | } else { | ||
| 69 | DDRD &= ~SCROLLLOCK_PORT; | ||
| 70 | PORTD &= ~SCROLLLOCK_PORT; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | #ifdef BACKLIGHT_ENABLE | ||
| 75 | |||
| 76 | // sets up Timer 1 for 8-bit PWM | ||
| 77 | void timer1PWMSetup(void) { // NOTE ONLY CALL THIS ONCE | ||
| 78 | // default 8 bit mode | ||
| 79 | TCCR1A &= ~(1 << 1); // cbi(TCCR1A,PWM11); <- set PWM11 bit to HIGH | ||
| 80 | TCCR1A |= (1 << 0); // sbi(TCCR1A,PWM10); <- set PWM10 bit to LOW | ||
| 81 | |||
| 82 | // clear output compare value A | ||
| 83 | // outb(OCR1AH, 0); | ||
| 84 | // outb(OCR1AL, 0); | ||
| 85 | |||
| 86 | // clear output comparator registers for B | ||
| 87 | OCR1BH = 0; // outb(OCR1BH, 0); | ||
| 88 | OCR1BL = 0; // outb(OCR1BL, 0); | ||
| 89 | } | ||
| 90 | |||
| 91 | bool is_init = false; | ||
| 92 | void timer1Init(void) { | ||
| 93 | // timer1SetPrescaler(TIMER1PRESCALE) | ||
| 94 | // set to DIV/64 | ||
| 95 | (TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | TIMER1PRESCALE; | ||
| 96 | |||
| 97 | // reset TCNT1 | ||
| 98 | TCNT1H = 0; // outb(TCNT1H, 0); | ||
| 99 | TCNT1L = 0; // outb(TCNT1L, 0); | ||
| 100 | |||
| 101 | // TOIE1: Timer Overflow Interrupt Enable (Timer 1); | ||
| 102 | TIMSK |= _BV(TOIE1); // sbi(TIMSK, TOIE1); | ||
| 103 | |||
| 104 | is_init = true; | ||
| 105 | } | ||
| 106 | |||
| 107 | void timer1UnInit(void) { | ||
| 108 | // set prescaler back to NONE | ||
| 109 | (TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | 0x00; // TIMERRTC_CLK_STOP | ||
| 110 | |||
| 111 | // disable timer overflow interrupt | ||
| 112 | TIMSK &= ~_BV(TOIE1); // overflow bit? | ||
| 113 | |||
| 114 | setPWM(0); | ||
| 115 | |||
| 116 | is_init = false; | ||
| 117 | } | ||
| 118 | |||
| 119 | |||
| 120 | // handle TCNT1 overflow | ||
| 121 | //! Interrupt handler for tcnt1 overflow interrupt | ||
| 122 | ISR(TIMER1_OVF_vect, ISR_NOBLOCK) | ||
| 123 | { | ||
| 124 | // sei(); | ||
| 125 | // handle breathing here | ||
| 126 | #ifdef BACKLIGHT_BREATHING | ||
| 127 | if (is_breathing()) { | ||
| 128 | custom_breathing_handler(); | ||
| 129 | } | ||
| 130 | #endif | ||
| 131 | |||
| 132 | // TODO call user defined function | ||
| 133 | } | ||
| 134 | |||
| 135 | // enable timer 1 PWM | ||
| 136 | // timer1PWMBOn() | ||
| 137 | void timer1PWMBEnable(void) { | ||
| 138 | // turn on channel B (OC1B) PWM output | ||
| 139 | // set OC1B as non-inverted PWM | ||
| 140 | TCCR1A |= _BV(COM1B1); | ||
| 141 | TCCR1A &= ~_BV(COM1B0); | ||
| 142 | } | ||
| 143 | |||
| 144 | // disable timer 1 PWM | ||
| 145 | // timer1PWMBOff() | ||
| 146 | void timer1PWMBDisable(void) { | ||
| 147 | TCCR1A &= ~_BV(COM1B1); | ||
| 148 | TCCR1A &= ~_BV(COM1B0); | ||
| 149 | } | ||
| 150 | |||
| 151 | void enableBacklight(void) { | ||
| 152 | DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output | ||
| 153 | PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high | ||
| 154 | } | ||
| 155 | |||
| 156 | void disableBacklight(void) { | ||
| 157 | // DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input | ||
| 158 | PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low | ||
| 159 | } | ||
| 160 | |||
| 161 | void startPWM(void) { | ||
| 162 | timer1Init(); | ||
| 163 | timer1PWMBEnable(); | ||
| 164 | enableBacklight(); | ||
| 165 | } | ||
| 166 | |||
| 167 | void stopPWM(void) { | ||
| 168 | timer1UnInit(); | ||
| 169 | disableBacklight(); | ||
| 170 | timer1PWMBDisable(); | ||
| 171 | } | ||
| 172 | |||
| 173 | void b_led_init_ports(void) { | ||
| 174 | /* turn backlight on/off depending on user preference */ | ||
| 175 | #if BACKLIGHT_ON_STATE == 0 | ||
| 176 | // DDRx register: sets the direction of Port D | ||
| 177 | // DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input | ||
| 178 | PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low | ||
| 179 | #else | ||
| 180 | DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output | ||
| 181 | PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high | ||
| 182 | #endif | ||
| 183 | |||
| 184 | timer1PWMSetup(); | ||
| 185 | startPWM(); | ||
| 186 | |||
| 187 | #ifdef BACKLIGHT_BREATHING | ||
| 188 | breathing_enable(); | ||
| 189 | #endif | ||
| 190 | } | ||
| 191 | |||
| 192 | void b_led_set(uint8_t level) { | ||
| 193 | if (level > BACKLIGHT_LEVELS) { | ||
| 194 | level = BACKLIGHT_LEVELS; | ||
| 195 | } | ||
| 196 | |||
| 197 | setPWM((int)(TIMER_TOP * (float) level / BACKLIGHT_LEVELS)); | ||
| 198 | } | ||
| 199 | |||
| 200 | // called every matrix scan | ||
| 201 | void b_led_task(void) { | ||
| 202 | // do nothing for now | ||
| 203 | } | ||
| 204 | |||
| 205 | void setPWM(uint16_t xValue) { | ||
| 206 | if (xValue > TIMER_TOP) { | ||
| 207 | xValue = TIMER_TOP; | ||
| 208 | } | ||
| 209 | OCR1B = xValue; // timer1PWMBSet(xValue); | ||
| 210 | } | ||
| 211 | |||
| 212 | #endif // BACKLIGHT_ENABLE | ||
diff --git a/keyboards/jj50/backlight_custom.h b/keyboards/jj50/backlight_custom.h new file mode 100644 index 000000000..7210be840 --- /dev/null +++ b/keyboards/jj50/backlight_custom.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | /** | ||
| 2 | * Backlighting code for PS2AVRGB boards (ATMEGA32A) | ||
| 3 | * Kenneth A. (github.com/krusli | krusli.me) | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef BACKLIGHT_CUSTOM_H | ||
| 7 | #define BACKLIGHT_CUSTOM_H | ||
| 8 | |||
| 9 | #include <avr/pgmspace.h> | ||
| 10 | void b_led_init_ports(void); | ||
| 11 | void b_led_set(uint8_t level); | ||
| 12 | void b_led_task(void); | ||
| 13 | void setPWM(uint16_t xValue); | ||
| 14 | |||
| 15 | #endif // BACKLIGHT_CUSTOM_H | ||
diff --git a/keyboards/jj50/breathing_custom.h b/keyboards/jj50/breathing_custom.h new file mode 100644 index 000000000..71416b1b4 --- /dev/null +++ b/keyboards/jj50/breathing_custom.h | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /** | ||
| 2 | * Breathing effect code for PS2AVRGB boards (ATMEGA32A) | ||
| 3 | * Works in conjunction with `backlight.c`. | ||
| 4 | * | ||
| 5 | * Code adapted from `quantum.c` to register with the existing TIMER1 overflow | ||
| 6 | * handler in `backlight.c` instead of setting up its own timer. | ||
| 7 | * Kenneth A. (github.com/krusli | krusli.me) | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifdef BACKLIGHT_ENABLE | ||
| 11 | #ifdef BACKLIGHT_BREATHING | ||
| 12 | |||
| 13 | #include "backlight_custom.h" | ||
| 14 | |||
| 15 | #ifndef BREATHING_PERIOD | ||
| 16 | #define BREATHING_PERIOD 6 | ||
| 17 | #endif | ||
| 18 | |||
| 19 | #define breathing_min() do {breathing_counter = 0;} while (0) | ||
| 20 | #define breathing_max() do {breathing_counter = breathing_period * 244 / 2;} while (0) | ||
| 21 | |||
| 22 | // TODO make this share code with quantum.c | ||
| 23 | |||
| 24 | #define BREATHING_NO_HALT 0 | ||
| 25 | #define BREATHING_HALT_OFF 1 | ||
| 26 | #define BREATHING_HALT_ON 2 | ||
| 27 | #define BREATHING_STEPS 128 | ||
| 28 | |||
| 29 | static uint8_t breathing_period = BREATHING_PERIOD; | ||
| 30 | static uint8_t breathing_halt = BREATHING_NO_HALT; | ||
| 31 | static uint16_t breathing_counter = 0; | ||
| 32 | |||
| 33 | static bool breathing = false; | ||
| 34 | |||
| 35 | bool is_breathing(void) { | ||
| 36 | return breathing; | ||
| 37 | } | ||
| 38 | |||
| 39 | // See http://jared.geek.nz/2013/feb/linear-led-pwm | ||
| 40 | static uint16_t cie_lightness(uint16_t v) { | ||
| 41 | if (v <= 5243) // if below 8% of max | ||
| 42 | return v / 9; // same as dividing by 900% | ||
| 43 | else { | ||
| 44 | uint32_t y = (((uint32_t) v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare | ||
| 45 | // to get a useful result with integer division, we shift left in the expression above | ||
| 46 | // and revert what we've done again after squaring. | ||
| 47 | y = y * y * y >> 8; | ||
| 48 | if (y > 0xFFFFUL) // prevent overflow | ||
| 49 | return 0xFFFFU; | ||
| 50 | else | ||
| 51 | return (uint16_t) y; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | void breathing_enable(void) { | ||
| 56 | breathing = true; | ||
| 57 | breathing_counter = 0; | ||
| 58 | breathing_halt = BREATHING_NO_HALT; | ||
| 59 | // interrupt already registered | ||
| 60 | } | ||
| 61 | |||
| 62 | void breathing_pulse(void) { | ||
| 63 | if (get_backlight_level() == 0) | ||
| 64 | breathing_min(); | ||
| 65 | else | ||
| 66 | breathing_max(); | ||
| 67 | breathing_halt = BREATHING_HALT_ON; | ||
| 68 | // breathing_interrupt_enable(); | ||
| 69 | breathing = true; | ||
| 70 | } | ||
| 71 | |||
| 72 | void breathing_disable(void) { | ||
| 73 | breathing = false; | ||
| 74 | // backlight_set(get_backlight_level()); | ||
| 75 | b_led_set(get_backlight_level()); // custom implementation of backlight_set() | ||
| 76 | } | ||
| 77 | |||
| 78 | void breathing_self_disable(void) | ||
| 79 | { | ||
| 80 | if (get_backlight_level() == 0) | ||
| 81 | breathing_halt = BREATHING_HALT_OFF; | ||
| 82 | else | ||
| 83 | breathing_halt = BREATHING_HALT_ON; | ||
| 84 | } | ||
| 85 | |||
| 86 | void breathing_toggle(void) { | ||
| 87 | if (is_breathing()) | ||
| 88 | breathing_disable(); | ||
| 89 | else | ||
| 90 | breathing_enable(); | ||
| 91 | } | ||
| 92 | |||
| 93 | void breathing_period_set(uint8_t value) | ||
| 94 | { | ||
| 95 | if (!value) | ||
| 96 | value = 1; | ||
| 97 | breathing_period = value; | ||
| 98 | } | ||
| 99 | |||
| 100 | void breathing_period_default(void) { | ||
| 101 | breathing_period_set(BREATHING_PERIOD); | ||
| 102 | } | ||
| 103 | |||
| 104 | void breathing_period_inc(void) | ||
| 105 | { | ||
| 106 | breathing_period_set(breathing_period+1); | ||
| 107 | } | ||
| 108 | |||
| 109 | void breathing_period_dec(void) | ||
| 110 | { | ||
| 111 | breathing_period_set(breathing_period-1); | ||
| 112 | } | ||
| 113 | |||
| 114 | /* To generate breathing curve in python: | ||
| 115 | * from math import sin, pi; [int(sin(x/128.0*pi)**4*255) for x in range(128)] | ||
| 116 | */ | ||
| 117 | static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | ||
| 118 | |||
| 119 | // Use this before the cie_lightness function. | ||
| 120 | static inline uint16_t scale_backlight(uint16_t v) { | ||
| 121 | return v / BACKLIGHT_LEVELS * get_backlight_level(); | ||
| 122 | } | ||
| 123 | |||
| 124 | void custom_breathing_handler(void) { | ||
| 125 | uint16_t interval = (uint16_t) breathing_period * 244 / BREATHING_STEPS; | ||
| 126 | // resetting after one period to prevent ugly reset at overflow. | ||
| 127 | breathing_counter = (breathing_counter + 1) % (breathing_period * 244); | ||
| 128 | uint8_t index = breathing_counter / interval % BREATHING_STEPS; | ||
| 129 | |||
| 130 | if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) || | ||
| 131 | ((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1))) | ||
| 132 | { | ||
| 133 | // breathing_interrupt_disable(); | ||
| 134 | } | ||
| 135 | |||
| 136 | setPWM(cie_lightness(scale_backlight((uint16_t) pgm_read_byte(&breathing_table[index]) * 0x0101U))); | ||
| 137 | } | ||
| 138 | |||
| 139 | #endif // BACKLIGHT_BREATHING | ||
| 140 | #endif // BACKLIGHT_ENABLE | ||
diff --git a/keyboards/jj50/config.h b/keyboards/jj50/config.h index 240732594..6aa762883 100644 --- a/keyboards/jj50/config.h +++ b/keyboards/jj50/config.h | |||
| @@ -35,11 +35,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 35 | #define MATRIX_COLS 15 | 35 | #define MATRIX_COLS 15 |
| 36 | #define DIODE_DIRECTION ROW2COL | 36 | #define DIODE_DIRECTION ROW2COL |
| 37 | 37 | ||
| 38 | #define BACKLIGHT_PIN D4 | 38 | //#define BACKLIGHT_PIN D4 |
| 39 | #define BACKLIGHT_LEVELS 3 | 39 | #define BACKLIGHT_LEVELS 12 |
| 40 | 40 | ||
| 41 | //#define RGB_DI_PIN C0 | 41 | #define RGB_DI_PIN E2 |
| 42 | #define RGBLED_NUM 5 | 42 | #define RGBLED_NUM 12 |
| 43 | #define RGBLIGHT_ANIMATIONS | 43 | #define RGBLIGHT_ANIMATIONS |
| 44 | #define RGBLIGHT_HUE_STEP 12 | 44 | #define RGBLIGHT_HUE_STEP 12 |
| 45 | #define RGBLIGHT_SAT_STEP 15 | 45 | #define RGBLIGHT_SAT_STEP 15 |
diff --git a/keyboards/jj50/jj50.c b/keyboards/jj50/jj50.c index a75b12c4e..d4a70f68d 100644 --- a/keyboards/jj50/jj50.c +++ b/keyboards/jj50/jj50.c | |||
| @@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "jj50.h" | 18 | #include "jj50.h" |
| 19 | #include "rgblight.h" | ||
| 20 | 19 | ||
| 21 | #include <avr/pgmspace.h> | 20 | #include <avr/pgmspace.h> |
| 22 | 21 | ||
| @@ -24,22 +23,72 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 24 | #include "i2c.h" | 23 | #include "i2c.h" |
| 25 | #include "quantum.h" | 24 | #include "quantum.h" |
| 26 | 25 | ||
| 26 | #include "backlight.h" | ||
| 27 | #include "backlight_custom.h" | ||
| 28 | |||
| 29 | // for keyboard subdirectory level init functions | ||
| 30 | // @Override | ||
| 31 | void matrix_init_kb(void) { | ||
| 32 | // call user level keymaps, if any | ||
| 33 | matrix_init_user(); | ||
| 34 | } | ||
| 35 | |||
| 36 | #ifdef BACKLIGHT_ENABLE | ||
| 37 | /// Overrides functions in `quantum.c` | ||
| 38 | void backlight_init_ports(void) { | ||
| 39 | b_led_init_ports(); | ||
| 40 | } | ||
| 41 | |||
| 42 | void backlight_task(void) { | ||
| 43 | b_led_task(); | ||
| 44 | } | ||
| 45 | |||
| 46 | void backlight_set(uint8_t level) { | ||
| 47 | b_led_set(level); | ||
| 48 | } | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #ifdef RGBLIGHT_ENABLE | ||
| 27 | extern rgblight_config_t rgblight_config; | 52 | extern rgblight_config_t rgblight_config; |
| 28 | 53 | ||
| 54 | // custom RGB driver | ||
| 29 | void rgblight_set(void) { | 55 | void rgblight_set(void) { |
| 30 | if (!rgblight_config.enable) { | 56 | if (!rgblight_config.enable) { |
| 31 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { | 57 | for (uint8_t i=0; i<RGBLED_NUM; i++) { |
| 32 | led[i].r = 0; | 58 | led[i].r = 0; |
| 33 | led[i].g = 0; | 59 | led[i].g = 0; |
| 34 | led[i].b = 0; | 60 | led[i].b = 0; |
| 35 | } | 61 | } |
| 36 | } | 62 | } |
| 37 | 63 | ||
| 38 | i2c_init(); | 64 | i2c_init(); |
| 39 | i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); | 65 | i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); |
| 40 | } | 66 | } |
| 41 | 67 | ||
| 42 | __attribute__ ((weak)) | 68 | bool rgb_init = false; |
| 43 | void matrix_scan_user(void) { | 69 | |
| 70 | void matrix_scan_kb(void) { | ||
| 71 | // if LEDs were previously on before poweroff, turn them back on | ||
| 72 | if (rgb_init == false && rgblight_config.enable) { | ||
| 73 | i2c_init(); | ||
| 74 | i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); | ||
| 75 | rgb_init = true; | ||
| 76 | } | ||
| 77 | |||
| 44 | rgblight_task(); | 78 | rgblight_task(); |
| 45 | } | 79 | #else |
| 80 | void matrix_scan_kb(void) { | ||
| 81 | #endif | ||
| 82 | matrix_scan_user(); | ||
| 83 | /* Nothing else for now. */ | ||
| 84 | } | ||
| 85 | |||
| 86 | __attribute__((weak)) // overridable | ||
| 87 | void matrix_init_user(void) { | ||
| 88 | |||
| 89 | } | ||
| 90 | |||
| 91 | __attribute__((weak)) // overridable | ||
| 92 | void matrix_scan_user(void) { | ||
| 93 | |||
| 94 | } | ||
diff --git a/keyboards/jj50/jj50.h b/keyboards/jj50/jj50.h index 09664f77f..f0a2efddd 100644 --- a/keyboards/jj50/jj50.h +++ b/keyboards/jj50/jj50.h | |||
| @@ -20,11 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | #ifndef KEYMAP_COMMON_H | 20 | #ifndef KEYMAP_COMMON_H |
| 21 | #define KEYMAP_COMMON_H | 21 | #define KEYMAP_COMMON_H |
| 22 | 22 | ||
| 23 | #include "quantum.h" | ||
| 23 | #include "quantum_keycodes.h" | 24 | #include "quantum_keycodes.h" |
| 24 | #include "keycode.h" | 25 | #include "keycode.h" |
| 25 | #include "action.h" | 26 | #include "action.h" |
| 26 | 27 | ||
| 27 | #define KEYMAP( \ | 28 | void matrix_init_user(void); |
| 29 | |||
| 30 | #define LAYOUT( \ | ||
| 28 | K011, K010, K009, K008, K004, K005, K006, K007, K003, K002, K201, K000, \ | 31 | K011, K010, K009, K008, K004, K005, K006, K007, K003, K002, K201, K000, \ |
| 29 | K111, K110, K109, K108, K104, K105, K106, K107, K103, K102, K001, K100, \ | 32 | K111, K110, K109, K108, K104, K105, K106, K107, K103, K102, K001, K100, \ |
| 30 | K211, K210, K209, K208, K204, K205, K206, K207, K203, K202, K101, K200, \ | 33 | K211, K210, K209, K208, K204, K205, K206, K207, K203, K202, K101, K200, \ |
diff --git a/keyboards/jj50/keymaps/default/keymap.c b/keyboards/jj50/keymaps/default/keymap.c index 8a32efd0c..9d753eb8e 100644 --- a/keyboards/jj50/keymaps/default/keymap.c +++ b/keyboards/jj50/keymaps/default/keymap.c | |||
| @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public LicensezZZ | |||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include "jj50.h" | 20 | #include QMK_KEYBOARD_H |
| 21 | #include "action_layer.h" | 21 | #include "action_layer.h" |
| 22 | #include "rgblight.h" | 22 | #include "rgblight.h" |
| 23 | 23 | ||
| @@ -25,9 +25,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 25 | #define _DEFLT 0 | 25 | #define _DEFLT 0 |
| 26 | #define _RAISE 1 | 26 | #define _RAISE 1 |
| 27 | #define _LOWER 2 | 27 | #define _LOWER 2 |
| 28 | #define _FN 3 | ||
| 29 | |||
| 30 | enum custom_keycodes { | ||
| 31 | P_MACRO = SAFE_RANGE | ||
| 32 | }; | ||
| 33 | |||
| 34 | // GBP £ Macro (sends alt 156 - windows users only) | ||
| 35 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 36 | if (record->event.pressed) { | ||
| 37 | switch(keycode) { | ||
| 38 | case P_MACRO: | ||
| 39 | SEND_STRING(SS_DOWN(X_LALT)); | ||
| 40 | SEND_STRING(SS_TAP(X_KP_1)); | ||
| 41 | SEND_STRING(SS_TAP(X_KP_5)); | ||
| 42 | SEND_STRING(SS_TAP(X_KP_6)); | ||
| 43 | SEND_STRING(SS_UP(X_LALT)); | ||
| 44 | return false; break; | ||
| 45 | } | ||
| 46 | } | ||
| 47 | return true; | ||
| 48 | }; | ||
| 28 | 49 | ||
| 29 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 50 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 30 | 51 | ||
| 31 | /* Qwerty | 52 | /* Qwerty |
| 32 | * ,-----------------------------------------------------------------------------------. | 53 | * ,-----------------------------------------------------------------------------------. |
| 33 | * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | | 54 | * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | |
| @@ -36,20 +57,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 36 | * |------+------+------+------+------+------+------+------+------+------+------+------| | 57 | * |------+------+------+------+------+------+------+------+------+------+------+------| |
| 37 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | | 58 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | |
| 38 | * |------+------+------+------+------+------+------+------+------+------+------+------| | 59 | * |------+------+------+------+------+------+------+------+------+------+------+------| |
| 39 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | 60 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | (Hold for shift / tap for enter) |
| 40 | * |------+------+------+------+------+------+------+------+------+------+------+------| | 61 | * |------+------+------+------+------+------+------+------+------+------+------+------| |
| 41 | * | | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | 62 | * | _FN | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | |
| 42 | * `-----------------------------------------------------------------------------------' | 63 | * `-----------------------------------------------------------------------------------' |
| 43 | */ | 64 | */ |
| 44 | [_DEFLT] = KEYMAP( \ | 65 | [_DEFLT] = LAYOUT( \ |
| 45 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, \ | 66 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, \ |
| 46 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | 67 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ |
| 47 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | 68 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ |
| 48 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT),\ | 69 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT),\ |
| 49 | BL_TOGG, KC_LCTL, KC_LALT, KC_LGUI, MO(_LOWER), KC_SPC,KC_SPC, MO(_RAISE),KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | 70 | MO(_FN), KC_LCTL, KC_LALT, KC_LGUI, MO(_LOWER),KC_SPC,KC_SPC,MO(_RAISE),KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ |
| 50 | ), | 71 | ), |
| 51 | 72 | ||
| 52 | |||
| 53 | /* Raise | 73 | /* Raise |
| 54 | * ,-----------------------------------------------------------------------------------. | 74 | * ,-----------------------------------------------------------------------------------. |
| 55 | * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | 75 | * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | |
| @@ -63,15 +83,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 63 | * | | | | | | | | Next | Vol- | Vol+ | Play | | 83 | * | | | | | | | | Next | Vol- | Vol+ | Play | |
| 64 | * `-----------------------------------------------------------------------------------' | 84 | * `-----------------------------------------------------------------------------------' |
| 65 | */ | 85 | */ |
| 66 | [_RAISE] = KEYMAP( \ | 86 | |
| 87 | [_RAISE] = LAYOUT( \ | ||
| 67 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | 88 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ |
| 68 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ | 89 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ |
| 69 | RESET, BL_INC, RGB_SAI, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, KC_BSLS, \ | 90 | RESET, BL_INC, RGB_SAI, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, KC_BSLS, \ |
| 70 | _______, BL_DEC, _______, _______, _______, _______, _______, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, \ | 91 | _______, BL_DEC, _______, _______, _______, _______, _______, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, \ |
| 71 | RGB_TOG, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | 92 | RGB_TOG, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ |
| 72 | ), | 93 | ), |
| 73 | 94 | ||
| 74 | |||
| 75 | /* Lower | 95 | /* Lower |
| 76 | * ,-----------------------------------------------------------------------------------. | 96 | * ,-----------------------------------------------------------------------------------. |
| 77 | * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | 97 | * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | |
| @@ -85,12 +105,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 85 | * | | | | | | | | Next | Vol- | Vol+ | Play | | 105 | * | | | | | | | | Next | Vol- | Vol+ | Play | |
| 86 | * `-----------------------------------------------------------------------------------' | 106 | * `-----------------------------------------------------------------------------------' |
| 87 | */ | 107 | */ |
| 88 | [_LOWER] = KEYMAP( \ | 108 | |
| 109 | [_LOWER] = LAYOUT( \ | ||
| 89 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | 110 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ |
| 90 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ | 111 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ |
| 91 | RESET, _______, _______, _______, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, KC_PIPE, \ | 112 | RESET, _______, _______, _______, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, KC_PIPE, \ |
| 92 | _______, _______, _______, _______, _______, _______, _______,S(KC_NUHS),S(KC_NUBS),KC_HOME, KC_END, _______, \ | 113 | _______, _______, _______, _______, _______, _______, _______,S(KC_NUHS),S(KC_NUBS),KC_HOME, KC_END, _______, \ |
| 93 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | 114 | BL_STEP, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ |
| 94 | ) | 115 | ), |
| 95 | 116 | ||
| 117 | /* Fn | ||
| 118 | * ,-----------------------------------------------------------------------------------. | ||
| 119 | * | | | £ | | | | | | | | | | | ||
| 120 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 121 | * | | | | | | | | | | | | | | ||
| 122 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 123 | * | | | | | | | | | | | | | | ||
| 124 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 125 | * | | | | | | | | | | | | | | ||
| 126 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 127 | * | | | | | | | | |BL_OFF|BL_DEC|BL_INC|BL_ON | | ||
| 128 | * `-----------------------------------------------------------------------------------' | ||
| 129 | */ | ||
| 130 | [_FN] = LAYOUT( \ | ||
| 131 | _______, _______, P_MACRO, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 132 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 133 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 134 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 135 | _______, _______, _______, _______, _______, _______, _______, _______, BL_OFF, BL_DEC, BL_INC, BL_ON \ | ||
| 136 | ) | ||
| 96 | }; | 137 | }; |
diff --git a/keyboards/jj50/matrix.c b/keyboards/jj50/matrix.c index 8f9c67fe4..95c6057e7 100644 --- a/keyboards/jj50/matrix.c +++ b/keyboards/jj50/matrix.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> | 2 | Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> |
| 3 | Modified 2018 by Wayne K Jones <github.com/WarmCatUK> | ||
| 3 | 4 | ||
| 4 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
| @@ -36,17 +37,20 @@ void matrix_init(void) { | |||
| 36 | // all inputs for columns | 37 | // all inputs for columns |
| 37 | DDRA = 0x00; | 38 | DDRA = 0x00; |
| 38 | DDRC &= ~(0x111111<<2); | 39 | DDRC &= ~(0x111111<<2); |
| 39 | DDRD &= ~(1<<PIND7); | 40 | //----> DDRD &= ~(1<<PIND7); |
| 41 | // Port D not used on this keyboard | ||
| 40 | // all columns are pulled-up | 42 | // all columns are pulled-up |
| 41 | PORTA = 0xFF; | 43 | PORTA = 0xFF; |
| 42 | PORTC |= (0b111111<<2); | 44 | PORTC |= (0b111111<<2); |
| 43 | //PORTD |= (1<<PIND7); | 45 | //PORTD |= (1<<PIND7); |
| 46 | // Port D not used on this keyboard | ||
| 44 | 47 | ||
| 45 | // initialize matrix state: all keys off | 48 | // initialize matrix state: all keys off |
| 46 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | 49 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { |
| 47 | matrix[row] = 0x00; | 50 | matrix[row] = 0x00; |
| 48 | matrix_debouncing[row] = 0x00; | 51 | matrix_debouncing[row] = 0x00; |
| 49 | } | 52 | } |
| 53 | matrix_init_quantum(); // missing from original port by Luiz | ||
| 50 | } | 54 | } |
| 51 | 55 | ||
| 52 | void matrix_set_row_status(uint8_t row) { | 56 | void matrix_set_row_status(uint8_t row) { |
| @@ -72,9 +76,6 @@ uint8_t matrix_scan(void) { | |||
| 72 | ) | ( | 76 | ) | ( |
| 73 | // cols 8..13, PORTC 7 -> 0 | 77 | // cols 8..13, PORTC 7 -> 0 |
| 74 | bit_reverse((~PINC) & 0xFF) << 8 | 78 | bit_reverse((~PINC) & 0xFF) << 8 |
| 75 | ) | ( | ||
| 76 | // col 14, PORTD 7 | ||
| 77 | ((~PIND) & (1 << PIND7)) << 7 | ||
| 78 | ); | 79 | ); |
| 79 | 80 | ||
| 80 | if (matrix_debouncing[row] != cols) { | 81 | if (matrix_debouncing[row] != cols) { |
| @@ -92,8 +93,8 @@ uint8_t matrix_scan(void) { | |||
| 92 | } | 93 | } |
| 93 | } | 94 | } |
| 94 | } | 95 | } |
| 95 | 96 | matrix_scan_quantum(); // also missing in original PS2AVRGB implementation | |
| 96 | matrix_scan_user(); | 97 | //matrix_scan_user(); |
| 97 | 98 | ||
| 98 | return 1; | 99 | return 1; |
| 99 | } | 100 | } |
diff --git a/keyboards/jj50/rules.mk b/keyboards/jj50/rules.mk index 1b7826e50..13e813148 100644 --- a/keyboards/jj50/rules.mk +++ b/keyboards/jj50/rules.mk | |||
| @@ -36,16 +36,30 @@ BOOTMAGIC_ENABLE = yes | |||
| 36 | MOUSEKEY_ENABLE = no | 36 | MOUSEKEY_ENABLE = no |
| 37 | EXTRAKEY_ENABLE = yes | 37 | EXTRAKEY_ENABLE = yes |
| 38 | CONSOLE_ENABLE = no | 38 | CONSOLE_ENABLE = no |
| 39 | COMMAND_ENABLE = no | 39 | COMMAND_ENABLE = yes |
| 40 | BACKLIGHT_ENABLE = yes | 40 | BACKLIGHT_ENABLE = yes |
| 41 | RGBLIGHT_ENABLE = yes | 41 | RGBLIGHT_ENABLE = yes |
| 42 | RGBLIGHT_CUSTOM_DRIVER = yes | 42 | RGBLIGHT_CUSTOM_DRIVER = yes |
| 43 | NKRO_ENABLE = no | ||
| 44 | # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 43 | 45 | ||
| 44 | OPT_DEFS = -DDEBUG_LEVEL=0 | 46 | |
| 47 | DISABLE_WS2812 = no | ||
| 48 | |||
| 49 | KEY_LOCK_ENABLE = yes | ||
| 50 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 51 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 52 | |||
| 53 | |||
| 54 | #OPT_DEFS = -DDEBUG_LEVEL=0 | ||
| 45 | 55 | ||
| 46 | # custom matrix setup | 56 | # custom matrix setup |
| 47 | CUSTOM_MATRIX = yes | 57 | CUSTOM_MATRIX = yes |
| 48 | SRC = matrix.c i2c.c | 58 | SRC = matrix.c i2c.c backlight.c |
| 59 | |||
| 60 | ifndef QUANTUM_DIR | ||
| 61 | include ../../../../Makefile | ||
| 62 | endif | ||
| 49 | 63 | ||
| 50 | # programming options | 64 | # programming options |
| 51 | PROGRAM_CMD = ./keyboards/ps2avrGB/program $(TARGET).hex | 65 | PROGRAM_CMD = ./keyboards/ps2avrGB/program $(TARGET).hex |
diff --git a/keyboards/jj50/usbconfig.h b/keyboards/jj50/usbconfig.h index d2d848fcd..59f29d04d 100644 --- a/keyboards/jj50/usbconfig.h +++ b/keyboards/jj50/usbconfig.h | |||
| @@ -241,8 +241,8 @@ section at the end of this file). | |||
| 241 | #define USB_CFG_DEVICE_VERSION 0x00, 0x02 | 241 | #define USB_CFG_DEVICE_VERSION 0x00, 0x02 |
| 242 | /* Version number of the device: Minor number first, then major number. | 242 | /* Version number of the device: Minor number first, then major number. |
| 243 | */ | 243 | */ |
| 244 | #define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r' | 244 | #define USB_CFG_VENDOR_NAME 'K', 'P', 'R', 'e', 'p', 'u', 'b', 'l', 'i', 'c' |
| 245 | #define USB_CFG_VENDOR_NAME_LEN 13 | 245 | #define USB_CFG_VENDOR_NAME_LEN 10 |
| 246 | /* These two values define the vendor name returned by the USB device. The name | 246 | /* These two values define the vendor name returned by the USB device. The name |
| 247 | * must be given as a list of characters under single quotes. The characters | 247 | * must be given as a list of characters under single quotes. The characters |
| 248 | * are interpreted as Unicode (UTF-16) entities. | 248 | * are interpreted as Unicode (UTF-16) entities. |
| @@ -251,8 +251,8 @@ section at the end of this file). | |||
| 251 | * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for | 251 | * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for |
| 252 | * details. | 252 | * details. |
| 253 | */ | 253 | */ |
| 254 | #define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B' | 254 | #define USB_CFG_DEVICE_NAME 'J','J','5','0',' ','K','e','y','b','o','a','r','d' |
| 255 | #define USB_CFG_DEVICE_NAME_LEN 8 | 255 | #define USB_CFG_DEVICE_NAME_LEN 13 |
| 256 | /* Same as above for the device name. If you don't want a device name, undefine | 256 | /* Same as above for the device name. If you don't want a device name, undefine |
| 257 | * the macros. See the file USB-IDs-for-free.txt before you assign a name if | 257 | * the macros. See the file USB-IDs-for-free.txt before you assign a name if |
| 258 | * you use a shared VID/PID. | 258 | * you use a shared VID/PID. |
diff --git a/keyboards/ymd96/keymaps/JJ50/keymap.c b/keyboards/ymd96/keymaps/JJ50/keymap.c index f59950d44..b70433ee1 100644 --- a/keyboards/ymd96/keymaps/JJ50/keymap.c +++ b/keyboards/ymd96/keymaps/JJ50/keymap.c | |||
| @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 41 | * | | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | 41 | * | | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | |
| 42 | * `-----------------------------------------------------------------------------------' | 42 | * `-----------------------------------------------------------------------------------' |
| 43 | */ | 43 | */ |
| 44 | [_DEFLT] = KEYMAP_JJ50( \ | 44 | [_DEFLT] = LAYOUT_jj50( \ |
| 45 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, \ | 45 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, \ |
| 46 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | 46 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ |
| 47 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | 47 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ |
| @@ -63,7 +63,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 63 | * | | | | | | | | Next | Vol- | Vol+ | Play | | 63 | * | | | | | | | | Next | Vol- | Vol+ | Play | |
| 64 | * `-----------------------------------------------------------------------------------' | 64 | * `-----------------------------------------------------------------------------------' |
| 65 | */ | 65 | */ |
| 66 | [_RAISE] = KEYMAP_JJ50( \ | 66 | [_RAISE] = LAYOUT_jj50( \ |
| 67 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | 67 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ |
| 68 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ | 68 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ |
| 69 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, KC_BSLS, \ | 69 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, KC_BSLS, \ |
| @@ -85,7 +85,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 85 | * | | | | | | | | Next | Vol- | Vol+ | Play | | 85 | * | | | | | | | | Next | Vol- | Vol+ | Play | |
| 86 | * `-----------------------------------------------------------------------------------' | 86 | * `-----------------------------------------------------------------------------------' |
| 87 | */ | 87 | */ |
| 88 | [_LOWER] = KEYMAP_JJ50( \ | 88 | [_LOWER] = LAYOUT_jj50( \ |
| 89 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | 89 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ |
| 90 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ | 90 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ |
| 91 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, KC_PIPE, \ | 91 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, KC_PIPE, \ |
diff --git a/keyboards/ymd96/ymd96.h b/keyboards/ymd96/ymd96.h index 541ebeb19..221e390ab 100644 --- a/keyboards/ymd96/ymd96.h +++ b/keyboards/ymd96/ymd96.h | |||
| @@ -41,7 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 41 | { K700, K701, K702, K703, K704, K705, K706, KC_NO, K708, K709, K710, K711, K712, K713, K714 } \ | 41 | { K700, K701, K702, K703, K704, K705, K706, KC_NO, K708, K709, K710, K711, K712, K713, K714 } \ |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | #define KEYMAP_JJ50( \ | 44 | #define LAYOUT_jj50( \ |
| 45 | K011, K010, K009, K008, K004, K005, K006, K007, K003, K002, K201, K000, \ | 45 | K011, K010, K009, K008, K004, K005, K006, K007, K003, K002, K201, K000, \ |
| 46 | K111, K110, K109, K108, K104, K105, K106, K107, K103, K102, K001, K100, \ | 46 | K111, K110, K109, K108, K104, K105, K106, K107, K103, K102, K001, K100, \ |
| 47 | K211, K210, K209, K208, K204, K205, K206, K207, K203, K202, K101, K200, \ | 47 | K211, K210, K209, K208, K204, K205, K206, K207, K203, K202, K101, K200, \ |
