summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/jj40/config.h9
-rw-r--r--keyboards/jj40/jj40.c32
-rw-r--r--keyboards/jj40/jj40.h2
-rw-r--r--keyboards/jj40/keymaps/fun40/rules.mk6
-rw-r--r--keyboards/jj40/keymaps/krusli/keymap.c85
-rw-r--r--keyboards/jj40/keymaps/krusli/readme.md2
-rw-r--r--keyboards/jj40/rules.mk9
-rw-r--r--keyboards/jj40/usbconfig.h3
-rw-r--r--keyboards/mechmini/config.h7
-rw-r--r--keyboards/mechmini/keymaps/default/keymap.c118
-rw-r--r--keyboards/mechmini/mechmini.c7
-rw-r--r--keyboards/mechmini/usbconfig.h2
12 files changed, 143 insertions, 139 deletions
diff --git a/keyboards/jj40/config.h b/keyboards/jj40/config.h
index 02339a33f7..3152f22beb 100644
--- a/keyboards/jj40/config.h
+++ b/keyboards/jj40/config.h
@@ -15,6 +15,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config_common.h"
+
#ifndef CONFIG_H
#define CONFIG_H
@@ -39,6 +41,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define NO_UART 1
+/* RGB underglow */
+// The RGB_DI_PIN value seems to be shared between all PS2AVRGB boards.
+// The same pin is used on the JJ40, at least.
+#define RGBLED_NUM 5
+#define RGB_DI_PIN E2
+#define RGBLIGHT_ANIMATIONS
+
/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/keyboards/jj40/jj40.c b/keyboards/jj40/jj40.c
index d5add2a6b1..6044e83fdf 100644
--- a/keyboards/jj40/jj40.c
+++ b/keyboards/jj40/jj40.c
@@ -22,19 +22,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_layer.h"
#include "quantum.h"
-__attribute__ ((weak))
-void matrix_scan_user(void) {
- /* Nothing to do here... yet */
+#include "i2c.h"
+
+// custom RGB driver
+extern rgblight_config_t rgblight_config;
+void rgblight_set(void) {
+ if (!rgblight_config.enable) {
+ for (uint8_t i=0; i<RGBLED_NUM; i++) {
+ led[i].r = 0;
+ led[i].g = 0;
+ led[i].b = 0;
+ }
+ }
+
+ i2c_init();
+ i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
}
-void matrix_init_kb(void) {
-
- // Call the keymap level matrix init.
- matrix_init_user();
-
- // Set our LED pins as output
- DDRB |= (1<<6);
+__attribute__ ((weak))
+void matrix_scan_user(void) {
+ rgblight_task();
+ /* Nothing else for now. */
}
-
-void matrix_init_user(void) {
-} \ No newline at end of file
diff --git a/keyboards/jj40/jj40.h b/keyboards/jj40/jj40.h
index 6e90cb972c..6837423f8a 100644
--- a/keyboards/jj40/jj40.h
+++ b/keyboards/jj40/jj40.h
@@ -65,6 +65,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ K312, K311, K310, K39, K35, K36, K3X, KC_NO, K34, K33, K32, K31 } \
}
-#define KEYMAP KEYMAP_OFFSET
+#define KEYMAP KEYMAP_MIT
#endif
diff --git a/keyboards/jj40/keymaps/fun40/rules.mk b/keyboards/jj40/keymaps/fun40/rules.mk
index cd2208edd5..6fe3b05154 100644
--- a/keyboards/jj40/keymaps/fun40/rules.mk
+++ b/keyboards/jj40/keymaps/fun40/rules.mk
@@ -11,7 +11,11 @@ MIDI_ENABLE = no # 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 = yes
+RGBLIGHT_CUSTOM_DRIVER = yes
+DISABLE_WS2812 = yes
+
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
diff --git a/keyboards/jj40/keymaps/krusli/keymap.c b/keyboards/jj40/keymaps/krusli/keymap.c
new file mode 100644
index 0000000000..59e3988e11
--- /dev/null
+++ b/keyboards/jj40/keymaps/krusli/keymap.c
@@ -0,0 +1,85 @@
+/*
+Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "jj40.h"
+#include "action_layer.h"
+
+#define _QWERTY 0
+#define _LOWER 1
+#define _RAISE 2
+
+enum custom_keycodes {
+ QWERTY = SAFE_RANGE,
+ LOWER,
+ RAISE,
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Qwerty
+ * ,-----------------------------------------------------------------------------------.
+ * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | Ctrl | GUI | Alt |Lower | Space |Raise | Left | Down | Up |Right |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_QWERTY] = KEYMAP( \
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
+ KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
+ _______, KC_LCTL, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
+),
+
+/* Lower
+ * ,-----------------------------------------------------------------------------------.
+ * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | Next | Vol- | Vol+ | Play |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_LOWER] = KEYMAP( \
+ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
+ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
+ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,_______, _______, _______, \
+ _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
+),
+
+/* Raise
+ * ,-----------------------------------------------------------------------------------.
+ * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * | | F7 | F8 | F9 | F10 | F11 | F12 | RGB | RGB | RGB | RGB |Enter |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | RGB | RGB | RGB | RGB | | | Next | Vol- | Vol+ | Play |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_RAISE] = KEYMAP( \
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
+ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
+ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RGB_TOG, RGB_MOD, RGB_VAD, RGB_VAI, _______, \
+ _______, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
+)
+};
diff --git a/keyboards/jj40/keymaps/krusli/readme.md b/keyboards/jj40/keymaps/krusli/readme.md
new file mode 100644
index 0000000000..75a84d0e67
--- /dev/null
+++ b/keyboards/jj40/keymaps/krusli/readme.md
@@ -0,0 +1,2 @@
+# krusli
+Default JJ40 keymap, adapted with RGB underglow support. GUI and LAlt is also swapped.
diff --git a/keyboards/jj40/rules.mk b/keyboards/jj40/rules.mk
index c6279a2a51..cdc898c0fa 100644
--- a/keyboards/jj40/rules.mk
+++ b/keyboards/jj40/rules.mk
@@ -26,7 +26,7 @@ F_CPU = 12000000
# Bootloader
# This definition is optional, and if your keyboard supports multiple bootloaders of
-# different sizes, comment this out, and the correct address will be loaded
+# different sizes, comment this out, and the correct address will be loaded
# automatically (+60). See bootloader.mk for all options.
BOOTLOADER = bootloadHID
@@ -37,8 +37,11 @@ EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no
COMMAND_ENABLE = yes
BACKLIGHT_ENABLE = no
-RGBLIGHT_ENABLE = no
-RGBLIGHT_CUSTOM_DRIVER = no
+
+RGBLIGHT_ENABLE = yes
+RGBLIGHT_CUSTOM_DRIVER = yes
+DISABLE_WS2812 = yes # TODO check if this is necessary
+
KEY_LOCK_ENABLE = yes
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
diff --git a/keyboards/jj40/usbconfig.h b/keyboards/jj40/usbconfig.h
index cae839e744..520d08f611 100644
--- a/keyboards/jj40/usbconfig.h
+++ b/keyboards/jj40/usbconfig.h
@@ -118,7 +118,8 @@ section at the end of this file).
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
* device is powered from the USB bus.
*/
-#define USB_CFG_MAX_BUS_POWER 500
+// max power draw with maxed white underglow measured at 120 mA (peaks)
+#define USB_CFG_MAX_BUS_POWER 150
/* Set this variable to the maximum USB bus power consumption of your device.
* The value is in milliamperes. [It will be divided by two since USB
* communicates power requirements in units of 2 mA.]
diff --git a/keyboards/mechmini/config.h b/keyboards/mechmini/config.h
index e7004608e1..6a4523f85e 100644
--- a/keyboards/mechmini/config.h
+++ b/keyboards/mechmini/config.h
@@ -30,12 +30,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 8
#define MATRIX_COLS 15
+#define NO_UART 1
+
+/* RGB underglow */
+// The RGB_DI_PIN value seems to be shared between all PS2AVRGB boards.
+// The same pin is used on the JJ40, at least.
#define RGBLED_NUM 16
#define RGBLIGHT_ANIMATIONS
#define RGB_DI_PIN E2
-#define NO_UART 1
-
/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c
index 5cae1bc815..4a0a4dc0a6 100644
--- a/keyboards/mechmini/keymaps/default/keymap.c
+++ b/keyboards/mechmini/keymaps/default/keymap.c
@@ -14,16 +14,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mechmini.h"
-#include "rgblight.h"
#include "quantum.h"
-#define MAX_BRIGHTNESS 15
-#define MAX_BRIGHTNESS_IOS 5 // max brightness suitable for iOS devices
-
-#define _BL 0
-#define _FN1 1
-#define _FN2 2
-#define _FN3 3
+#define _BL 0 // base layer
+#define _FN1 1 // function layer 1
+#define _FN2 2 // function layer 2
+#define _FN3 3 // function layer 3
#define _____ KC_TRNS
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -52,109 +48,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_____, _____, _____, _____, _____, _____, _____, _____
)
};
-
-/**
- * Blank keymap
- [0] = KEYMAP(
- _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____
- _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____,
- _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____,
- _____, _____, _____, _____, _____, _____, _____, _____
- )
- */
-
-uint8_t current_level = 4;
-int is_on = 0;
-
-uint8_t r = 0xFF;
-uint8_t g = 0xFF;
-uint8_t b = 0xFF;
-
-uint8_t max_brightness = MAX_BRIGHTNESS_IOS;
-
-enum macro_id {
- TOGGLE_RGB,
- BRIGHTNESS_DOWN,
- BRIGHTNESS_UP,
- COLOR_1,
- COLOR_2,
- COLOR_3,
- ENABLE_MAX_BRIGHTNESS
-};
-
-const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
- keyevent_t event = record->event;
-
- switch (id) {
- case TOGGLE_RGB:
- if (event.pressed) {
- if (!is_on) {
- current_level = 4;
- is_on = 1;
- } else {
- is_on = 0;
- }
- }
- case BRIGHTNESS_DOWN:
- if (event.pressed && current_level > 0) {
- current_level--;
- }
- break;
- case BRIGHTNESS_UP:
- if (event.pressed && current_level < max_brightness) {
- current_level++;
- }
- break;
- case COLOR_1: // set to pink
- if (event.pressed) {
- r = 0xFF;
- g = 0x81;
- b = 0xC2;
- }
- break;
- case COLOR_2: // set to cyan
- if (event.pressed) {
- r = 0x00;
- g = 0xE0;
- b = 0xFF;
- }
- break;
- case COLOR_3: // set to white
- if (event.pressed) {
- r = 0xFF;
- g = 0xFF;
- b = 0xFF;
- }
- break;
- case ENABLE_MAX_BRIGHTNESS: // enable all 16 brightness steps
- if (event.pressed) {
- max_brightness = MAX_BRIGHTNESS;
- }
- break;
- }
-
- return MACRO_NONE;
-}
-
-const uint16_t fn_actions[] PROGMEM = {
-};
-
-void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b);
-
-uint8_t dim(uint8_t color, uint8_t opacity) {
- return ((uint16_t) color * opacity / 0xFF) & 0xFF;
-}
-
-void user_setrgb(uint8_t r, uint8_t g, uint8_t b) {
- uint8_t alpha = current_level * 0x11;
- rgblight_setrgb(dim(r, alpha), dim(g, alpha), dim(b, alpha));
-}
-
-void matrix_scan_user(void) {
- if (!is_on) {
- current_level = 0;
- user_setrgb(r, g, b);
- } else {
- user_setrgb(r, g, b);
- }
-}
diff --git a/keyboards/mechmini/mechmini.c b/keyboards/mechmini/mechmini.c
index baa2e03575..9897da099f 100644
--- a/keyboards/mechmini/mechmini.c
+++ b/keyboards/mechmini/mechmini.c
@@ -16,16 +16,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mechmini.h"
-#include "rgblight.h"
-
#include <avr/pgmspace.h>
#include "action_layer.h"
#include "i2c.h"
#include "quantum.h"
-extern rgblight_config_t rgblight_config;
+#include "rgblight.h"
+// custom RGB driver
+extern rgblight_config_t rgblight_config;
void rgblight_set(void) {
if (!rgblight_config.enable) {
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
@@ -42,4 +42,5 @@ void rgblight_set(void) {
__attribute__ ((weak))
void matrix_scan_user(void) {
rgblight_task();
+ /* add other tasks to be done on each matrix scan */
}
diff --git a/keyboards/mechmini/usbconfig.h b/keyboards/mechmini/usbconfig.h
index b6b8cdbbb4..d2d848fcdc 100644
--- a/keyboards/mechmini/usbconfig.h
+++ b/keyboards/mechmini/usbconfig.h
@@ -118,7 +118,7 @@ section at the end of this file).
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
* device is powered from the USB bus.
*/
-#define USB_CFG_MAX_BUS_POWER 100
+#define USB_CFG_MAX_BUS_POWER 500
/* Set this variable to the maximum USB bus power consumption of your device.
* The value is in milliamperes. [It will be divided by two since USB
* communicates power requirements in units of 2 mA.]