浏览代码

Add Cassette42 (#10562)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Monksoffunk 4 年之前
父节点
当前提交
45e6bb7add

+ 16 - 0
keyboards/cassette42/cassette42.c

@@ -0,0 +1,16 @@
+/* Copyright 2019 monksoffunk
+ *
+ * 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 "cassette42.h"

+ 34 - 0
keyboards/cassette42/cassette42.h

@@ -0,0 +1,34 @@
+/* Copyright 2019 monksoffunk
+ *
+ * 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/>.
+ */
+#pragma once
+
+#include "quantum.h"
+
+/* This a shortcut to help you visually see your layout.
+ *
+ * The first section contains all of the arguments representing the physical
+ * layout of the board and position of the keys.
+ *
+ * The second converts the arguments into a two-dimensional array which
+ * represents the switch matrix.
+ */
+#define LAYOUT( \
+        k10,  k11,   \
+    k00, k01, k02, k03\
+) \
+{ \
+    { k00, k01, k02, k03, k10, k11 }, \
+}

+ 233 - 0
keyboards/cassette42/common/glcdfont.c

@@ -0,0 +1,233 @@
+// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0.
+// See gfxfont.h for newer custom bitmap font info.
+
+#include "progmem.h"
+
+// Standard ASCII 5x7 font
+
+static const unsigned char font[] PROGMEM = {
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
+0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
+0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
+0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
+0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
+0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
+0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
+0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
+0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
+0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
+0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
+0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
+0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
+0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
+0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
+0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
+0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
+0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
+0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
+0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
+0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
+0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
+0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
+0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
+0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
+0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
+0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
+0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
+0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
+0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
+0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
+0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
+0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
+0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
+0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
+0x36, 0x49, 0x56, 0x20, 0x50, 0x00,
+0x00, 0x08, 0x07, 0x03, 0x00, 0x00,
+0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
+0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
+0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00,
+0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
+0x00, 0x80, 0x70, 0x30, 0x00, 0x00,
+0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
+0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
+0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
+0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
+0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
+0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
+0x21, 0x41, 0x49, 0x4D, 0x33, 0x00,
+0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
+0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
+0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00,
+0x41, 0x21, 0x11, 0x09, 0x07, 0x00,
+0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
+0x46, 0x49, 0x49, 0x29, 0x1E, 0x00,
+0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
+0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
+0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
+0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
+0x02, 0x01, 0x59, 0x09, 0x06, 0x00,
+0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
+0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
+0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
+0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
+0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
+0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
+0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
+0x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
+0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
+0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
+0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
+0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
+0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
+0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00,
+0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
+0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
+0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
+0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
+0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
+0x26, 0x49, 0x49, 0x49, 0x32, 0x00,
+0x03, 0x01, 0x7F, 0x01, 0x03, 0x00,
+0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
+0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
+0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
+0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
+0x03, 0x04, 0x78, 0x04, 0x03, 0x00,
+0x61, 0x59, 0x49, 0x4D, 0x43, 0x00,
+0x00, 0x7F, 0x41, 0x41, 0x41, 0x00,
+0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
+0x00, 0x41, 0x41, 0x41, 0x7F, 0x00,
+0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
+0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
+0x00, 0x03, 0x07, 0x08, 0x00, 0x00,
+0x20, 0x54, 0x54, 0x78, 0x40, 0x00,
+0x7F, 0x28, 0x44, 0x44, 0x38, 0x00,
+0x38, 0x44, 0x44, 0x44, 0x28, 0x00,
+0x38, 0x44, 0x44, 0x28, 0x7F, 0x00,
+0x38, 0x54, 0x54, 0x54, 0x18, 0x00,
+0x00, 0x08, 0x7E, 0x09, 0x02, 0x00,
+0x18, 0x24, 0x24, 0x1C, 0x38, 0x00,
+0x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
+0x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
+0x20, 0x40, 0x40, 0x3D, 0x00, 0x00,
+0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
+0x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
+0x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
+0x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
+0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
+0x7C, 0x18, 0x24, 0x24, 0x18, 0x00,
+0x18, 0x24, 0x24, 0x18, 0x7C, 0x00,
+0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
+0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
+0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
+0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
+0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
+0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
+0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
+0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
+0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
+0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
+0x00, 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00, 0x3F,
+0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
+0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
+0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
+0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
+0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};

+ 25 - 0
keyboards/cassette42/common/oled_helper.c

@@ -0,0 +1,25 @@
+#ifdef OLED_DRIVER_ENABLE
+#    include QMK_KEYBOARD_H
+#    include <stdio.h>
+#    include <string.h>
+
+void render_logo(void) {
+    static const char PROGMEM logo[] = {0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0};
+    oled_write_P(logo, false);
+}
+
+#    ifdef RGBLIGHT_ENABLE
+extern rgblight_config_t rgblight_config;
+static char led_buf[24] = "LED state ready.\n";
+rgblight_config_t rgblight_config_bak;
+
+void update_led_status(void) {
+    if (rgblight_config_bak.enable != rgblight_config.enable || rgblight_config_bak.mode != rgblight_config.mode || rgblight_config_bak.hue != rgblight_config.hue || rgblight_config_bak.sat != rgblight_config.sat || rgblight_config_bak.val != rgblight_config.val) {
+        snprintf(led_buf, sizeof(led_buf) - 1, "%c H%2d S%2d V%2d MODE%2d", rgblight_config.enable ? '*' : '.', (uint8_t)(rgblight_config.hue / RGBLIGHT_HUE_STEP), (uint8_t)(rgblight_config.sat / RGBLIGHT_SAT_STEP), (uint8_t)(rgblight_config.val / RGBLIGHT_VAL_STEP), (uint8_t)rgblight_config.mode);
+        rgblight_config_bak = rgblight_config;
+    }
+}
+
+void render_led_status(void) { oled_write(led_buf, false); }
+#    endif
+#endif

+ 22 - 0
keyboards/cassette42/common/oled_helper.h

@@ -0,0 +1,22 @@
+#ifdef OLED_DRIVER_ENABLE
+
+void render_logo(void);
+
+#    define RENDER_LOGO(a) render_logo(a)
+
+#    ifdef RGBLIGHT_ENABLE
+void update_led_status(void);
+void render_led_status(void);
+#        define UPDATE_LED_STATUS() update_led_status()
+#        define RENDER_LED_STATUS(a) render_led_status(a)
+#    else
+#        define UPDATE_LED_STATUS()
+#        define RENDER_LED_STATUS(a)
+#    endif
+
+#else
+#    define RENDER_LOGO(a)
+#    define UPDATE_LED_STATUS()
+#    define RENDER_LED_STATUS(a)
+
+#endif

+ 52 - 0
keyboards/cassette42/config.h

@@ -0,0 +1,52 @@
+/*
+Copyright 2019 monksoffunk
+
+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/>.
+*/
+
+#pragma once
+
+#include "config_common.h"
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID       0xFEED
+#define PRODUCT_ID      0xCA42
+#define DEVICE_VER      0x0001
+#define MANUFACTURER    monksoffunk
+#define PRODUCT         cassette42
+
+/* key matrix size */
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 6
+
+#define DIRECT_PINS {{ B4, F6, F5, F4, B5, F7 }}
+#define UNUSED_PINS
+
+#define ENCODERS_PAD_A { B6, B3 }
+#define ENCODERS_PAD_B { B2, B1 }
+#define ENCODER_RESOLUTION 4
+
+#define RGB_DI_PIN D3
+#ifdef RGB_DI_PIN
+#    define RGBLED_NUM 5
+#    define RGBLIGHT_HUE_STEP 8
+#    define RGBLIGHT_SAT_STEP 8
+#    define RGBLIGHT_VAL_STEP 8
+#    define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
+#    define RGBLIGHT_SLEEP         /* If defined, the RGB lighting will be switched off when the host goes to sleep */
+#    define RGBLIGHT_ANIMATIONS
+#endif
+
+#define OLED_FONT_H "keyboards/cassette42/common/glcdfont.c"

+ 12 - 0
keyboards/cassette42/info.json

@@ -0,0 +1,12 @@
+{
+    "keyboard_name": "cassette42", 
+    "url": "http://www.sho-k.co.uk/tech/1246.html", 
+    "maintainer": "monksoffunk", 
+    "width": 4, 
+    "height": 2.75, 
+    "layouts": {
+        "LAYOUT": {
+            "layout": [{"x":0.5, "y":0.75}, {"x":2.5, "y":0.75}, {"x":0, "y":1.75}, {"x":1, "y":1.75}, {"x":2, "y":1.75}, {"x":3, "y":1.75}]
+        }
+    }
+}

+ 174 - 0
keyboards/cassette42/keymaps/default/keymap.c

@@ -0,0 +1,174 @@
+/* Copyright 2019 monksoffunk
+ *
+ * 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 QMK_KEYBOARD_H
+
+#include "common/oled_helper.h"
+
+// Defines the keycodes used by our macros in process_record_user
+enum custom_keycodes {
+    RGBRST = SAFE_RANGE,
+    WRTROM,
+};
+
+enum layer_number {
+    _AUDIO = 0,
+    _HUE,
+    _SAT,
+    _VAL,
+    _MODE,
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    // LAYOUT(LeftEncoder, RightEncoder, LeftSwitch, CenterLeftSwitch, CenterRightSwitch, RightSwitch)
+    [_AUDIO] = LAYOUT(KC_MUTE, KC_ENT, LT(_HUE, KC_MPRV), LT(_SAT, KC_MPLY), LT(_VAL, KC_MNXT), LT(_MODE, KC_SPC)), 
+    [_HUE]   = LAYOUT(RGB_TOG, RGBRST, _______, _______, RGB_HUD, RGB_HUI), 
+    [_SAT]   = LAYOUT(_______, _______, _______, _______, RGB_SAD, RGB_SAI), 
+    [_VAL]   = LAYOUT(_______, _______, RGB_VAD, RGB_VAI, _______, RGB_VAI), 
+    [_MODE]  = LAYOUT(_______, WRTROM, RGB_RMOD, RGB_MOD, RGB_MOD, _______),
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+    switch (keycode) {
+        case WRTROM:
+#ifdef RGBLIGHT_ENABLE
+            if (record->event.pressed) {
+                eeconfig_update_rgblight_current();
+            }
+#endif
+            return false;
+            break;
+
+        case RGBRST:
+#ifdef RGBLIGHT_ENABLE
+            if (record->event.pressed) {
+                eeconfig_update_rgblight_default();
+                rgblight_enable();
+            }
+#endif
+            return false;
+            break;
+    }
+    return true;
+}
+
+#ifdef OLED_DRIVER_ENABLE
+#    include <stdio.h>
+#    include <string.h>
+
+// assign the right code to your layers for OLED display
+#    define L_AUDIO 0
+#    define L_HUE (1 << _HUE)
+#    define L_SAT (1 << _SAT)
+#    define L_VAL (1 << _VAL)
+#    define L_MODE (1 << _MODE)
+
+void render_status(void) {
+    render_logo();
+    // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
+    switch (layer_state) {
+        case L_AUDIO:
+            oled_write_P(PSTR("audio control\n"), false);
+            break;
+        case L_HUE:
+            oled_write_P(PSTR("rgb HUE control\n"), false);
+            break;
+        case L_SAT:
+            oled_write_P(PSTR("rgb SAT control\n"), false);
+            break;
+        case L_VAL:
+            oled_write_P(PSTR("rgb VAL control\n"), false);
+            break;
+        case L_MODE:
+            oled_write_P(PSTR("rgb MODE control\n"), false);
+            break;
+        default:
+            break;
+    }
+    UPDATE_LED_STATUS();
+    RENDER_LED_STATUS();
+}
+
+void oled_task_user(void) {
+    if (is_keyboard_master()) {
+        render_status();
+    } else {
+        render_logo();
+    }
+}
+#endif
+
+void led_set_user(uint8_t usb_led) {}
+
+void encoder_update_user(uint8_t index, bool clockwise) {
+    oled_on();
+    if (index == 0) { /* left encoder */
+        switch (layer_state) {
+            case L_AUDIO:
+                if (clockwise) {
+                    tap_code(KC_VOLU);
+                } else {
+                    tap_code(KC_VOLD);
+                }
+                break;
+
+            case L_HUE:
+#ifdef RGBLIGHT_ENABLE
+                if (clockwise) {
+                    rgblight_increase_hue_noeeprom();
+                } else {
+                    rgblight_decrease_hue_noeeprom();
+                }
+#endif
+                break;
+
+            case L_SAT:
+#ifdef RGBLIGHT_ENABLE
+                if (clockwise) {
+                    rgblight_increase_sat_noeeprom();
+                } else {
+                    rgblight_decrease_sat_noeeprom();
+                }
+#endif
+                break;
+
+            case L_VAL:
+#ifdef RGBLIGHT_ENABLE
+                if (clockwise) {
+                    rgblight_increase_val_noeeprom();
+                } else {
+                    rgblight_decrease_val_noeeprom();
+                }
+#endif
+                break;
+
+            case L_MODE:
+#ifdef RGBLIGHT_ENABLE
+                if (clockwise) {
+                    rgblight_step_noeeprom();
+                } else {
+                    rgblight_step_reverse_noeeprom();
+                }
+#endif
+                break;
+        }
+    } else if (index == 1) { /* right encoder */
+        if (clockwise) {
+            tap_code(KC_DOWN);
+        } else {
+            tap_code(KC_UP);
+        }
+    }
+}

+ 1 - 0
keyboards/cassette42/keymaps/default/readme.md

@@ -0,0 +1 @@
+# The default keymap for cassette42

+ 15 - 0
keyboards/cassette42/readme.md

@@ -0,0 +1,15 @@
+# Cassette42
+
+![cassette42](https://pbs.twimg.com/media/D63q5S0UcAE9Rfj?format=jpg&name=large)
+
+An audio control pad with 4 switches and 2 rotary encoders.
+
+* Keyboard Maintainer: [monksoffunk](https://github.com/monksoffunk)  [@monksoffunkJP](https://twitter.com/monksoffunkJP)
+* Hardware Supported: Cassette 42 PCB
+* Hardware Availability: [Yushakobo Shop](https://yushakobo.jp/shop/cassette42/)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make cassette42:default
+
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

+ 26 - 0
keyboards/cassette42/rules.mk

@@ -0,0 +1,26 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = caterina
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = no       # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = no        # Mouse keys
+EXTRAKEY_ENABLE = yes       # Audio control and System control
+CONSOLE_ENABLE = no         # Console for debug
+COMMAND_ENABLE = no         # Commands for debug and configuration
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = no            # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = yes       # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
+ENCODER_ENABLE = yes
+OLED_DRIVER_ENABLE = yes
+
+SRC += ./common/oled_helper.c