[Keyboard] Add cg108 keyboard and fix keymap Dosa40rgb (#14753)

* Add cg108 keyboard and fix keymap Dosa40rgb

* Update keyboards/dtisaac/cg108/readme.md

* Update keyboards/dtisaac/dosa40rgb/rules.mk

* Update keyboards/dtisaac/cg108/info.json

* Update keyboards/dtisaac/cg108/keymaps/default/keymap.c

* Update keyboards/dtisaac/cg108/rules.mk

* Update keyboards/dtisaac/cg108/rules.mk
master
Dao Tak Isaac 2021-10-10 04:55:00 +07:00 committed by GitHub
parent f216c20fc7
commit 3c188d98a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 339 additions and 57 deletions

View File

@ -0,0 +1,17 @@
/* Copyright 2021 DTIsaac
*
* 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 "cg108.h"

View File

@ -0,0 +1,49 @@
/* Copyright 2021 DTIsaac
*
* 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 is 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.
*/
// default keymap: all 117 keys with ANSI Enter
#define LAYOUT( \
K000, K001, K002, K003, K300, K301, K302, K303, K306, K307, K308, K309, K310, K004, K005, K006, K007, K008, K009, K010, \
K100, K101, K102, K103, K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K104, K105, K106, K107, K108, K109, K110, \
K200, K201, K202, K203, K500, K501, K502, K503, K505, K506, K507, K508, K509, K510, K204, K205, K206, K207, K208, K209, K210, \
K800, K801, K802, K803, K600, K601, K602, K603, K606, K607, K608, K609, K610, K807, K808, K809, K810, \
K900, K901, K902, K903, K700, K701, K702, K703, K705, K706, K707, K708, K709, K710, K906, K907, K908, K909, K910, \
KA00, KA01, KA02, KA03, K804, K805, K806, K604, K605, K904, K905, KA04, KA05, KA06, KA07, KA08, KA09, KA10 \
) { \
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010 }, \
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110 }, \
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210 }, \
{ K300, K301, K302, K303, KC_NO, KC_NO, K306, K307, K308, K309, K310 }, \
{ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410 }, \
{ K500, K501, K502, K503, KC_NO, K505, K506, K507, K508, K509, K510 }, \
{ K600, K601, K602, K603, K604, K605, K606, K607, K608, K609, K610 }, \
{ K700, K701, K702, K703, KC_NO, K705, K706, K707, K708, K709, K710 }, \
{ K800, K801, K802, K803, K804, K805, K806, K807, K808, K809, K810 }, \
{ K900, K901, K902, K903, K904, K905, K906, K907, K908, K909, K910 }, \
{ KA00, KA01, KA02, KA03, KA04, KA05, KA06, KA07, KA08, KA09, KA10 } \
}

View File

@ -0,0 +1,62 @@
/*
Copyright 2021 DTIsaac
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 0x4454 // DT
#define PRODUCT_ID 0x4973 // Is
#define DEVICE_VER 0x0002
#define MANUFACTURER DTIsaac
#define PRODUCT CG108
/* key matrix size */
#define MATRIX_ROWS 11
#define MATRIX_COLS 11
/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
/* key matrix pins */
#define MATRIX_ROW_PINS { F4, F1, F0, F5, F6, F7, D4, D5, D3, D2, D0 }
#define MATRIX_COL_PINS { C7, C6, B4, D7, B3, B2, B0, E6, B1, D1, D6 }
#define UNUSED_PINS
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW
#define LED_NUM_LOCK_PIN B5
#define LED_CAPS_LOCK_PIN B6
#define LED_SCROLL_LOCK_PIN B7
#define LED_PIN_ON_STATE 0
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

View File

@ -0,0 +1,130 @@
{
"keyboard_name": "CG108",
"url": "",
"maintainer": "daotakisaac",
"width": 22.5,
"height": 6.5,
"layouts": {
"LAYOUT": {
"layout": [
{"label":"K000", "x":0, "y":0},
{"label":"K001", "x":2, "y":0},
{"label":"K002", "x":3, "y":0},
{"label":"K003", "x":4, "y":0},
{"label":"K300", "x":5, "y":0},
{"label":"K301", "x":6.5, "y":0},
{"label":"K302", "x":7.5, "y":0},
{"label":"K303", "x":8.5, "y":0},
{"label":"K306", "x":9.5, "y":0},
{"label":"K307", "x":11, "y":0},
{"label":"K308", "x":12, "y":0},
{"label":"K309", "x":13, "y":0},
{"label":"K310", "x":14, "y":0},
{"label":"K004", "x":15.25, "y":0},
{"label":"K005", "x":16.25, "y":0},
{"label":"K006", "x":17.25, "y":0},
{"label":"K007", "x":18.5, "y":0},
{"label":"K008", "x":19.5, "y":0},
{"label":"K009", "x":20.5, "y":0},
{"label":"K010", "x":21.5, "y":0},
{"label":"K100", "x":0, "y":1.5},
{"label":"K101", "x":1, "y":1.5},
{"label":"K102", "x":2, "y":1.5},
{"label":"K103", "x":3, "y":1.5},
{"label":"K400", "x":4, "y":1.5},
{"label":"K401", "x":5, "y":1.5},
{"label":"K402", "x":6, "y":1.5},
{"label":"K403", "x":7, "y":1.5},
{"label":"K404", "x":8, "y":1.5},
{"label":"K405", "x":9, "y":1.5},
{"label":"K406", "x":10, "y":1.5},
{"label":"K407", "x":11, "y":1.5},
{"label":"K408", "x":12, "y":1.5},
{"label":"K409", "x":13, "y":1.5},
{"label":"K410", "x":14, "y":1.5},
{"label":"K104", "x":15.25, "y":1.5},
{"label":"K105", "x":16.25, "y":1.5},
{"label":"K106", "x":17.25, "y":1.5},
{"label":"K107", "x":18.5, "y":1.5},
{"label":"K108", "x":19.5, "y":1.5},
{"label":"K109", "x":20.5, "y":1.5},
{"label":"K110", "x":21.5, "y":1.5},
{"label":"K200", "x":0, "y":2.5, "w":1.5},
{"label":"K201", "x":1.5, "y":2.5},
{"label":"K202", "x":2.5, "y":2.5},
{"label":"K203", "x":3.5, "y":2.5},
{"label":"K500", "x":4.5, "y":2.5},
{"label":"K501", "x":5.5, "y":2.5},
{"label":"K502", "x":6.5, "y":2.5},
{"label":"K503", "x":7.5, "y":2.5},
{"label":"K505", "x":8.5, "y":2.5},
{"label":"K506", "x":9.5, "y":2.5},
{"label":"K507", "x":10.5, "y":2.5},
{"label":"K508", "x":11.5, "y":2.5},
{"label":"K509", "x":12.5, "y":2.5},
{"label":"K510", "x":13.5, "y":2.5, "w":1.5},
{"label":"K204", "x":15.25, "y":2.5},
{"label":"K205", "x":16.25, "y":2.5},
{"label":"K206", "x":17.25, "y":2.5},
{"label":"K207", "x":18.5, "y":2.5},
{"label":"K208", "x":19.5, "y":2.5},
{"label":"K209", "x":20.5, "y":2.5},
{"label":"K210", "x":21.5, "y":2.5},
{"label":"K800", "x":0, "y":3.5, "w":1.75},
{"label":"K801", "x":1.75, "y":3.5},
{"label":"K802", "x":2.75, "y":3.5},
{"label":"K803", "x":3.75, "y":3.5},
{"label":"K600", "x":4.75, "y":3.5},
{"label":"K601", "x":5.75, "y":3.5},
{"label":"K602", "x":6.75, "y":3.5},
{"label":"K603", "x":7.75, "y":3.5},
{"label":"K606", "x":8.75, "y":3.5},
{"label":"K607", "x":9.75, "y":3.5},
{"label":"K608", "x":10.75, "y":3.5},
{"label":"K609", "x":11.75, "y":3.5},
{"label":"K610", "x":12.75, "y":3.5, "w":2.25},
{"label":"K807", "x":18.5, "y":3.5},
{"label":"K808", "x":19.5, "y":3.5},
{"label":"K809", "x":20.5, "y":3.5},
{"label":"K810", "x":21.5, "y":3.5},
{"label":"K900", "x":0, "y":4.5, "w":1.25},
{"label":"K901", "x":1.25, "y":4.5},
{"label":"K902", "x":2.25, "y":4.5},
{"label":"K903", "x":3.25, "y":4.5},
{"label":"K700", "x":4.25, "y":4.5},
{"label":"K701", "x":5.25, "y":4.5},
{"label":"K702", "x":6.25, "y":4.5},
{"label":"K703", "x":7.25, "y":4.5},
{"label":"K705", "x":8.25, "y":4.5},
{"label":"K706", "x":9.25, "y":4.5},
{"label":"K707", "x":10.25, "y":4.5},
{"label":"K708", "x":11.25, "y":4.5},
{"label":"K709", "x":12.25, "y":4.5, "w":1.75},
{"label":"K710", "x":14, "y":4.5},
{"label":"K906", "x":16.25, "y":4.5},
{"label":"K907", "x":18.5, "y":4.5},
{"label":"K908", "x":19.5, "y":4.5},
{"label":"K909", "x":20.5, "y":4.5},
{"label":"K910", "x":21.5, "y":4.5},
{"label":"KA00", "x":0, "y":5.5, "w":1.5},
{"label":"KA01", "x":1.5, "y":5.5},
{"label":"KA02", "x":2.5, "y":5.5, "w":1.5},
{"label":"KA03", "x":4, "y":5.5},
{"label":"K804", "x":5, "y":5.5, "w":2},
{"label":"K805", "x":7, "y":5.5},
{"label":"K806", "x":8, "y":5.5, "w":2},
{"label":"K604", "x":10, "y":5.5},
{"label":"K605", "x":11, "y":5.5, "w":1.5},
{"label":"K904", "x":12.5, "y":5.5},
{"label":"K905", "x":13.5, "y":5.5, "w":1.5},
{"label":"KA04", "x":15.25, "y":5.5},
{"label":"KA05", "x":16.25, "y":5.5},
{"label":"KA06", "x":17.25, "y":5.5},
{"label":"KA07", "x":18.5, "y":5.5},
{"label":"KA08", "x":19.5, "y":5.5},
{"label":"KA09", "x":20.5, "y":5.5},
{"label":"KA10", "x":21.5, "y":5.5}
]
}
}
}

View File

@ -0,0 +1,27 @@
/* Copyright 2021 DTIsaac
*
* 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
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_MPLY, KC_MPRV, KC_MNXT, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PCMM, KC_PDOT, KC_PENT
)
};

View File

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

View File

@ -0,0 +1,26 @@
# CG108
![CG108](https://i.imgur.com/AUqkNhEh.jpg)
A base full-size keyboard CG108 of DTIsaac
* Keyboard Maintainer: [DTIsaac](https://github.com/daotakisaac)
* Hardware Supported: CG108 DTIsaac
Make example for this keyboard (after setting up your build environment):
make dtisaac/cg108:default
Flashing example for this keyboard:
make dtisaac/cg108:default:flash
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).
## Bootloader
Enter the bootloader in 3 ways:
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
* **Keycode in layout**: Press the key mapped to `RESET` if it is available

View File

@ -0,0 +1,22 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
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 = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output

View File

@ -66,7 +66,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
//#define DEBOUNCE 5
/* disable these deprecated features by default */
#define NO_ACTION_MACRO

View File

@ -14,8 +14,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "spi_master.h"
#include "wait.h"
// Defines names for use in layer keycodes and the keymap
enum layer_names {
@ -28,14 +26,9 @@ enum layer_names {
enum custom_keycodes {
BASE,
L1,
BLE_DIS, // Disconnect BLE
LED_EN, // Toggle LED
};
#define L1 MO(_L1)
const uint8_t cm1[] = "AT+GAPSTOPADV";
const uint8_t cm2[] = "AT+GAPDISCONNECT";
const uint8_t cm3[] = "ATZ";
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base */
@ -52,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[_L2] = LAYOUT(
LED_EN, RGB_RMOD, KC_UP, RGB_MOD, RGB_HUI, RGB_VAI, RGB_SAI, RGB_SPI, KC_TRNS, OUT_USB, OUT_BT, BLE_DIS,
RGB_TOG, RGB_RMOD, KC_UP, RGB_MOD, RGB_HUI, RGB_VAI, RGB_SAI, RGB_SPI, KC_TRNS, OUT_USB, OUT_BT, KC_TRNS,
KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, RGB_HUD, RGB_VAD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_BSLS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TAB, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
@ -74,49 +67,3 @@ void rgb_matrix_indicators_user(void)
rgb_matrix_set_color(22, 200, 0, 200);
}
}
void sdep_send(const uint8_t *cmd, uint8_t len) {
spi_start(AdafruitBleCSPin, false, 0, 2);
uint8_t cnt = 200;
bool ready = false;
do {
ready = spi_write(0x10) != 0xFE;
if (ready) {
break;
}
spi_stop();
wait_us(25);
spi_start(AdafruitBleCSPin, false, 0, 2);
} while (cnt--);
if (ready) {
spi_write(0x00);
spi_write(0x0A);
spi_write(len);
spi_transmit(cmd, len);
}
spi_stop();
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LED_EN:
if (record->event.pressed) {
DDRB = DDRB ^ 0x20;
PORTB &= ~(1 << 5);
}
return false;
case BLE_DIS:
if (record->event.pressed) {
sdep_send(cm1,sizeof(cm1));
sdep_send(cm2,sizeof(cm2));
sdep_send(cm3,sizeof(cm3));
}
return false;
}
return true;
}

View File

@ -19,7 +19,8 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to
## Bootloader
Enter the bootloader in 2 ways:
Enter the bootloader in 3 ways:
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
* **Keycode in layout**: Press the key mapped to `RESET` if it is available

View File

@ -7,7 +7,7 @@ BOOTLOADER = lufa-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = no # Audio control and System control
CONSOLE_ENABLE = no # Console for debug