Skip to content

Commit

Permalink
[Keyboard] New Keyboard: KBDPad MKI (#6452)
Browse files Browse the repository at this point in the history
* initial commit

* define pins used and matrix size

* update readme

* delete un needed files

* make an appropriate switch matrix

* create appropriate keymap

* one little typo

* add QMK Configurator support

* Update keyboards/kbdfans/kbdpad/mk1/info.json

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
  • Loading branch information
2 people authored and drashna committed Aug 1, 2019
1 parent 17eea77 commit a2d61d7
Show file tree
Hide file tree
Showing 8 changed files with 691 additions and 0 deletions.
38 changes: 38 additions & 0 deletions keyboards/kbdfans/kbdpad/mk1/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
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/>.
*/

#pragma once

#include "config_common.h"

#define VENDOR_ID 0x20A0
#define PRODUCT_ID 0x422D
#define MANUFACTURER KBDfans
#define PRODUCT KBDPAD-MKI

#define MATRIX_ROWS 6
#define MATRIX_COLS 4

// 0 1 2 3 4 5
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5 }
#define MATRIX_COL_PINS { A0, A1, A2, A3 }
#define UNUSED_PINS

#define DIODE_DIRECTION COL2ROW
#define DEBOUNCE 5

#define BACKLIGHT_LEVELS 1
12 changes: 12 additions & 0 deletions keyboards/kbdfans/kbdpad/mk1/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"keyboard_name": "KBDFans KBDPad MKI",
"url": "",
"maintainer": "qmk",
"width": 4,
"height": 6.25,
"layouts": {
"LAYOUT": {
"layout": [{"x":2, "y":0}, {"x":3, "y":0}, {"x":0, "y":1.25}, {"x":1, "y":1.25}, {"x":2, "y":1.25}, {"x":3, "y":1.25}, {"x":0, "y":2.25}, {"x":1, "y":2.25}, {"x":2, "y":2.25}, {"x":0, "y":3.25}, {"x":1, "y":3.25}, {"x":2, "y":3.25}, {"x":3, "y":2.25, "h":2}, {"x":0, "y":4.25}, {"x":1, "y":4.25}, {"x":2, "y":4.25}, {"x":0, "y":5.25, "w":2}, {"x":2, "y":5.25}, {"x":3, "y":4.25, "h":2}]
}
}
}
27 changes: 27 additions & 0 deletions keyboards/kbdfans/kbdpad/mk1/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Copyright 2019 MechMerlin
*
* 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_DEL, KC_BSPC, \
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \
KC_P7, KC_P8, KC_P9, \
KC_P4, KC_P5, KC_P6, KC_PPLS, \
KC_P1, KC_P2, KC_P3, \
KC_P0, KC_PDOT, KC_PENT) \
};
88 changes: 88 additions & 0 deletions keyboards/kbdfans/kbdpad/mk1/mk1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/* Copyright 2019 MechMerlin
*
* 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 "i2c_master.h"
#include "quantum.h"

#ifdef RGBLIGHT_ENABLE
#include "rgblight.h"
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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
}
#endif

void matrix_init_kb(void) {
#ifdef RGBLIGHT_ENABLE
if (rgblight_config.enable) {
i2c_init();
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
}
#endif
// call user level keymaps, if any
matrix_init_user();
}

void matrix_scan_kb(void) {
#ifdef RGBLIGHT_ENABLE
rgblight_task();
#endif
matrix_scan_user();
/* Nothing else for now. */
}

__attribute__ ((weak))
void matrix_scan_user(void) {
}

void backlight_init_ports(void) {
// initialize pins D0, D1, D4 and D6 as output
setPinOutput(D0);
setPinOutput(D1);
setPinOutput(D4);
setPinOutput(D6);

// turn backlight LEDs on
writePinHigh(D0);
writePinHigh(D1);
writePinHigh(D4);
writePinHigh(D6);
}

void backlight_set(uint8_t level) {
if (level == 0) {
// turn backlight LEDs off
writePinLow(D0);
writePinLow(D1);
writePinLow(D4);
writePinLow(D6);
} else {
// turn backlight LEDs on
writePinHigh(D0);
writePinHigh(D1);
writePinHigh(D4);
writePinHigh(D6);
}
}
38 changes: 38 additions & 0 deletions keyboards/kbdfans/kbdpad/mk1/mk1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Copyright 2019 MechMerlin
*
* 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
// The second converts the arguments into a two-dimensional array

#define LAYOUT( \
k52, k53, \
k40, k41, k42, k43, \
k30, k31, k32, \
k20, k21, k22, k23, \
k10, k11, k12, \
k00, k02, k03 \
){ \
{ k00, KC_NO, k02, k03 }, \
{ k10, k11, k12, KC_NO }, \
{ k20, k21, k22, k23 }, \
{ k30, k31, k32, KC_NO }, \
{ k40, k41, k42, k43 }, \
{ KC_NO, KC_NO, k52, k53 }, \
}
47 changes: 47 additions & 0 deletions keyboards/kbdfans/kbdpad/mk1/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# KBDPad MKI

Custom numpad.

Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin)
Hardware Supported: KBDPad MKI
Hardware Availability: No longer available.


Make example for this keyboard (after setting up your build environment):

make kbdfans/kbdpad/mk1:default

Flashing

ps2avr(GB) boards use an atmega32a microcontroller and a different bootloader. It is not flashable using the regular QMK methods.

**Reset Key:** Hold down the key located at `K00`, commonly programmed as `0` while plugging in the keyboard.

Windows:
1. Download [HIDBootFlash](http://vusb.wikidot.com/project:hidbootflash).
2. Place your keyboard into reset.
3. Press the `Find Device` button and ensure that your keyboard is found.
4. Press the `Open .hex File` button and locate the `.hex` file you created.
5. Press the `Flash Device` button and wait for the process to complete.

macOS:
1. Install homebrew by typing the following:
```
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
2. Install `crosspack-avr`.
```
brew cask install crosspack-avr
```
3. Install the following packages:
```
brew install python3
pip3 install pyusb
brew install --HEAD https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb
```
4. Place your keyboard into reset.
5. Flash the board by typing `bootloadHID -r` followed by the path to your `.hex` file.
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).
48 changes: 48 additions & 0 deletions keyboards/kbdfans/kbdpad/mk1/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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/>.

# MCU name
MCU = atmega32a
PROTOCOL = VUSB

# unsupported features for now
NO_UART = yes
NO_SUSPEND_POWER_DOWN = yes

# processor frequency
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
# automatically (+60). See bootloader.mk for all options.
BOOTLOADER = bootloadHID

# build options
BOOTMAGIC_ENABLE = no
MOUSEKEY_ENABLE = yes
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = yes
COMMAND_ENABLE = yes
BACKLIGHT_ENABLE = yes
RGBLIGHT_ENABLE = no
RGBLIGHT_CUSTOM_DRIVER = no

OPT_DEFS = -DDEBUG_LEVEL=0

QUANTUM_LIB_SRC = i2c_master.c

# programming options
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
Loading

0 comments on commit a2d61d7

Please sign in to comment.