Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ClassPad #116

Merged
merged 19 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions qmk_porting/keyboards/ClassPad/ClassPad.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
Copyright 2023 OctopusZ <https://github.com/OctopusZ>

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 "gpio.h"
#include "extra_keycode.h"

#ifdef RGB_MATRIX_ENABLE
/* clang-format off */
led_config_t g_led_config = {
{
{0 , 1 , 2 , 3 , NO_LED, NO_LED, NO_LED},
{NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED},
{NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED},
{NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED},
{NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED},
}, {
{0,0},{12,0},{24,0},{35,0},
}, {
2, 2, 2, 2,
}
};
/* clang-format on */

bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max)
{
if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
return false;
}
if (led_min <= 0 && led_max > 0 && host_keyboard_led_state().num_lock) {
RGB_MATRIX_INDICATOR_SET_COLOR(0, 0xFF, 0x00, 0x00);
} else {
RGB_MATRIX_INDICATOR_SET_COLOR(0, 0x00, 0x00, 0x00);
}
if (led_min <= 1 && led_max > 1) {
RGB_MATRIX_INDICATOR_SET_COLOR(1, 0x00, 0x00, 0x00);
}
if (led_min <= 2 && led_max > 2) {
RGB_MATRIX_INDICATOR_SET_COLOR(2, 0x00, 0x00, 0x00);
}
if (led_min <= 3 && led_max > 3) {
RGB_MATRIX_INDICATOR_SET_COLOR(3, 0x00, 0x00, 0x00);
}

#if defined BATTERY_MEASURE_PIN || defined BLE_ENABLE
extern void wireless_rgb_indicator_task(uint8_t led_min, uint8_t led_max);

wireless_rgb_indicator_task(led_min, led_max);
#endif
return true;
}

#endif
bool dip_switch_update_kb(uint8_t index, bool active)
{
switch (index) {
case 0:
if (active) // run once when tirggle
{
// writePinHigh(B12); // for debug
// setPinOutput(B12);
if (kbd_protocol_type != kbd_protocol_ble) {
wait_ms(50); // for debounce
bootloader_boot_mode_set(BOOTLOADER_BOOT_MODE_BLE);
soft_reset_keyboard();
}
} else {
// writePinLow(B12); // for debug
// setPinOutput(B12);
if (kbd_protocol_type != kbd_protocol_usb) {
wait_ms(50); // for debounce
bootloader_boot_mode_set(BOOTLOADER_BOOT_MODE_USB);
soft_reset_keyboard();
}
}
break;
}
return true;
}

int main()
{
extern void protocol_setup();
extern void protocol_init();
extern void protocol_task();

platform_setup();

protocol_setup();
#if !defined ESB_ENABLE || ESB_ENABLE != 2
keyboard_setup();
#endif

protocol_init();

/* Main loop */
for (;;) {
protocol_task();
//! housekeeping_task() is handled by platform
}
}
38 changes: 38 additions & 0 deletions qmk_porting/keyboards/ClassPad/ClassPad.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright 2022 OctopusZ <https://github.com/OctopusZ>

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"
#include "extra_keycode.h"

// clang-format off
#define LAYOUT_all( \
K000, K001, K002, K003, K004, K005, K006, \
K100, K101, K102, K104, K105, K106, \
K200, K201, K202, K203, K204, K205, K206, \
K300, K301, K302, \
K400, K402, K403 \
) \
{ \
{K000, K001, K002, K003, K004, K005, K006 },\
{K100, K101, K102, KC_NO, K104, K105, K106 },\
{K200, K201, K202, K203, K204, K205, K206 },\
{K300, K301, K302, KC_NO, KC_NO, KC_NO, KC_NO},\
{K400, KC_NO, K402, K403, KC_NO, KC_NO, KC_NO}\
}
// clang-format on
48 changes: 48 additions & 0 deletions qmk_porting/keyboards/ClassPad/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
Copyright 2022 Huckies <https://github.com/Huckies>

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/>.
*/

// RB_PIN_UART0 - UART0: PB4/PB7 -> PA15/PA14
// #define UART0_IO_REMAPPING

// RB_PIN_UART1 - UART1: PA8/PA9 -> PB12/PB13
// #define UART1_IO_REMAPPING

// RB_PIN_UART2 - UART2: PA6/PA7 -> PB22/PB23
// #define UART2_IO_REMAPPING

// RB_PIN_UART3 - UART3: PA4/PA5 -> PB20/PB21
// #define UART3_IO_REMAPPING

/* I2C_IO_REMAPPING - I2C: PB13/PB12 -> PB21/PB20 */
// #define I2C_IO_REMAPPING

/* SPI_IO_REMAPPING - SPI0: PA12/PA13/PA14/PA15 -> PB12/PB13/PB14/PB15 */
#define SPI_IO_REMAPPING

// #define BLE_TX_POWER LL_TX_POWEER_MINUS_16_DBM
// #define BLE_TX_POWER LL_TX_POWEER_MINUS_12_DBM
// #define BLE_TX_POWER LL_TX_POWEER_MINUS_8_DBM
// #define BLE_TX_POWER LL_TX_POWEER_MINUS_5_DBM
// #define BLE_TX_POWER LL_TX_POWEER_MINUS_3_DBM
// #define BLE_TX_POWER LL_TX_POWEER_MINUS_1_DBM
// #define BLE_TX_POWER LL_TX_POWEER_0_DBM
// #define BLE_TX_POWER LL_TX_POWEER_1_DBM
// #define BLE_TX_POWER LL_TX_POWEER_2_DBM
#define BLE_TX_POWER LL_TX_POWEER_3_DBM
// #define BLE_TX_POWER LL_TX_POWEER_4_DBM
// #define BLE_TX_POWER LL_TX_POWEER_5_DBM
// #define BLE_TX_POWER LL_TX_POWEER_6_DBM
185 changes: 185 additions & 0 deletions qmk_porting/keyboards/ClassPad/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"name": "ClassPad",
"vendorId": "0xCAFE",
"productId": "0x0b9A",
"customKeycodes": [
{
"name": "USB",
"title": "USB MODE",
"shortName": "USB"
},
{
"name": "BLE1",
"title": "Tap = Use BLE slot 1, Hold = Clean BLE slot 1 binding",
"shortName": "BLE1"
},
{
"name": "BLE2",
"title": "Tap = Use BLE slot 2, Hold = Clean BLE slot 2 binding",
"shortName": "BLE2"
},
{
"name": "BLE3",
"title": "Tap = Use BLE slot 3, Hold = Clean BLE slot 3 binding",
"shortName": "BLE3"
},
{
"name": "BLE4",
"title": "Tap = Use BLE slot 4, Hold = Clean BLE slot 4 binding",
"shortName": "BLE4"
},
{
"name": "BLE5",
"title": "Tap = Use BLE slot 5, Hold = Clean BLE slot 5 binding",
"shortName": "BLE5"
},
{
"name": "BLE6",
"title": "Tap = Use BLE slot 6, Hold = Clean BLE slot 6 binding",
"shortName": "BLE6"
},
{
"name": "BLE7",
"title": "Tap = Use BLE slot 7, Hold = Clean BLE slot 7 binding",
"shortName": "BLE7"
},
{
"name": "BLE8",
"title": "Tap = Use BLE slot 8, Hold = Clean BLE slot 8 binding",
"shortName": "BLE8"
},
{
"name": "BLE9",
"title": "Tap = Use BLE slot 9, Hold = Clean BLE slot 9 binding",
"shortName": "BLE9"
},
{
"name": "BLE10",
"title": "Tap = Use BLE slot 10, Hold = Clean BLE slot 10 binding",
"shortName": "BLE10"
},
{
"name": "BLE11",
"title": "Tap = Use BLE slot 11, Hold = Clean BLE slot 11 binding",
"shortName": "BLE11"
},
{
"name": "BLE12",
"title": "Tap = Use BLE slot 12, Hold = Clean BLE slot 12 binding",
"shortName": "BLE12"
},
{
"name": "BLE13",
"title": "Tap = Use BLE slot 13, Hold = Clean BLE slot 13 binding",
"shortName": "BLE13"
},
{
"name": "BLE814",
"title": "Tap = Use BLE slot 14, Hold = Clean BLE slot 14 binding",
"shortName": "BLE14"
},
{
"name": "BLE815",
"title": "Tap = Use BLE slot 15, Hold = Clean BLE slot 15 binding",
"shortName": "BLE15"
},
{
"name": "BLE816",
"title": "Tap = Use BLE slot 16, Hold = Clean BLE slot 16 binding",
"shortName": "BLE16"
},
{
"name": "BC_A",
"title": "Clean ALL BLE slot binding",
"shortName": "BC_A"
},
{
"name": "2.4G",
"title": "ESB MODE(2.4G mode)",
"shortName": "2.4G"
},
{
"name": "BAT",
"title": "Enable battery lever indicator",
"shortName": "BAT"
}
],
"matrix": {
"rows": 5,
"cols": 7
},
"layouts": {
"keymap": [
[
"0,0",
"0,1",
"0,2",
"0,3",
{
"x": 0.25
},
"0,4\n\n\n0,0",
"0,5\n\n\n0,0",
"0,6\n\n\n0,0",
{
"w": 1.5
},
"0,4\n\n\n0,1",
{
"w": 1.5
},
"0,6\n\n\n0,1"
],
[
"1,0",
"1,1",
"1,2",
{
"h": 2
},
"2,3",
{
"x": 0.25,
"w": 1.5
},
"1,4\n\n\n1,0",
{
"w": 1.5
},
"1,6\n\n\n1,0",
"1,4\n\n\n1,1",
"1,5\n\n\n1,1",
"1,6\n\n\n1,1"
],
[
"2,0",
"2,1",
"2,2"
],
[
"3,0",
"3,1",
"3,2",
{
"h": 2
},
"4,3",
{
"x": 1.25
},
"2,5\n\n\n\n\n\n\n\n\ne0"
],
[
{
"w": 2
},
"4,0",
"4,2"
]
],
"labels": [
"A",
"B"
]
}
}
Loading