From 7becbfb44a7ed11593a1c322cda0dd9825c483d4 Mon Sep 17 00:00:00 2001
From: MechMerlin <30334081+mechmerlin@users.noreply.github.com>
Date: Fri, 11 Oct 2019 21:44:38 -0700
Subject: [PATCH] [Keyboard] New Keyboard: BM43A (#6997)
* new keyboard bm43a
* Thanks to noroads for generating this with his online tool
* add QMK Configurator support thanks to noroads
* turn on bootmagic lite
* update readme
* remove unneeded comments
---
keyboards/bm43a/bm43a.c | 51 ++++++++++++++++
keyboards/bm43a/bm43a.h | 30 ++++++++++
keyboards/bm43a/config.h | 73 +++++++++++++++++++++++
keyboards/bm43a/info.json | 58 ++++++++++++++++++
keyboards/bm43a/keymaps/default/config.h | 19 ++++++
keyboards/bm43a/keymaps/default/keymap.c | 33 ++++++++++
keyboards/bm43a/keymaps/default/readme.md | 1 +
keyboards/bm43a/readme.md | 16 +++++
keyboards/bm43a/rules.mk | 33 ++++++++++
9 files changed, 314 insertions(+)
create mode 100644 keyboards/bm43a/bm43a.c
create mode 100644 keyboards/bm43a/bm43a.h
create mode 100644 keyboards/bm43a/config.h
create mode 100644 keyboards/bm43a/info.json
create mode 100644 keyboards/bm43a/keymaps/default/config.h
create mode 100644 keyboards/bm43a/keymaps/default/keymap.c
create mode 100644 keyboards/bm43a/keymaps/default/readme.md
create mode 100644 keyboards/bm43a/readme.md
create mode 100644 keyboards/bm43a/rules.mk
diff --git a/keyboards/bm43a/bm43a.c b/keyboards/bm43a/bm43a.c
new file mode 100644
index 000000000..36543e372
--- /dev/null
+++ b/keyboards/bm43a/bm43a.c
@@ -0,0 +1,51 @@
+/* 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 .
+ */
+#include "bm43a.h"
+
+// Optional override functions below.
+// You can leave any or all of these undefined.
+// These are only required if you want to perform custom actions.
+
+/*
+
+void matrix_init_kb(void) {
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
+
+ matrix_init_user();
+}
+
+void matrix_scan_kb(void) {
+ // put your looping keyboard code here
+ // runs every cycle (a lot)
+
+ matrix_scan_user();
+}
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ // put your per-action keyboard code here
+ // runs for every action, just before processing by the firmware
+
+ return process_record_user(keycode, record);
+}
+
+void led_set_kb(uint8_t usb_led) {
+ // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
+
+ led_set_user(usb_led);
+}
+
+*/
diff --git a/keyboards/bm43a/bm43a.h b/keyboards/bm43a/bm43a.h
new file mode 100644
index 000000000..87ca05c4d
--- /dev/null
+++ b/keyboards/bm43a/bm43a.h
@@ -0,0 +1,30 @@
+/* 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 .
+ */
+#pragma once
+
+#include "quantum.h"
+
+#define LAYOUT( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1B, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2B, \
+ K30, K31, K32, K33, K35, K37, K38, K39, K3B \
+) { \
+ { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \
+ { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, KC_NO, K1B }, \
+ { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, KC_NO, K2B }, \
+ { K30, K31, K32, K33, KC_NO, K35, KC_NO, K37, K38, K39, KC_NO, K3B }, \
+}
diff --git a/keyboards/bm43a/config.h b/keyboards/bm43a/config.h
new file mode 100644
index 000000000..538b2eadd
--- /dev/null
+++ b/keyboards/bm43a/config.h
@@ -0,0 +1,73 @@
+/*
+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 .
+*/
+
+#pragma once
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x0000
+#define DEVICE_VER 0x0001
+#define MANUFACTURER KPRepublic
+#define PRODUCT BM43A
+#define DESCRIPTION A QMK-powered custom keyboard
+
+/* key matrix size */
+#define MATRIX_ROWS 4
+#define MATRIX_COLS 12
+
+/*
+ * 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)
+ *
+ */
+#define MATRIX_ROW_PINS { D1, F4, F1, F0 }
+#define MATRIX_COL_PINS { B0, F5, F6, F7, C7, C6, B6, B5, B4, D7, D6, D4 }
+
+#define DIODE_DIRECTION COL2ROW
+
+#define BACKLIGHT_PIN B7
+// #define BACKLIGHT_BREATHING
+#define BACKLIGHT_LEVELS 5
+
+#define RGB_DI_PIN E2
+#ifdef RGB_DI_PIN
+ #define RGBLED_NUM 10
+ #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 */
+/*== all animations enable ==*/
+ #define RGBLIGHT_ANIMATIONS
+// /*== or choose animations ==*/
+// #define RGBLIGHT_EFFECT_BREATHING
+// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
+// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+// #define RGBLIGHT_EFFECT_SNAKE
+// #define RGBLIGHT_EFFECT_KNIGHT
+// #define RGBLIGHT_EFFECT_CHRISTMAS
+// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
+// #define RGBLIGHT_EFFECT_RGB_TEST
+// #define RGBLIGHT_EFFECT_ALTERNATING
+#endif
diff --git a/keyboards/bm43a/info.json b/keyboards/bm43a/info.json
new file mode 100644
index 000000000..59dd63c72
--- /dev/null
+++ b/keyboards/bm43a/info.json
@@ -0,0 +1,58 @@
+{
+ "keyboard_name": "BM43A",
+ "url": "",
+ "maintainer": "qmk",
+ "width": 12,
+ "height": 4,
+ "layouts": {
+ "LAYOUT": {
+ "key_count": 43,
+ "layout": [
+ {"label":"K00 (D1,B0)", "x":0, "y":0},
+ {"label":"K01 (D1,F5)", "x":1, "y":0},
+ {"label":"K02 (D1,F6)", "x":2, "y":0},
+ {"label":"K03 (D1,F7)", "x":3, "y":0},
+ {"label":"K04 (D1,C7)", "x":4, "y":0},
+ {"label":"K05 (D1,C6)", "x":5, "y":0},
+ {"label":"K06 (D1,B6)", "x":6, "y":0},
+ {"label":"K07 (D1,B5)", "x":7, "y":0},
+ {"label":"K08 (D1,B4)", "x":8, "y":0},
+ {"label":"K09 (D1,D7)", "x":9, "y":0},
+ {"label":"K0A (D1,D6)", "x":10, "y":0},
+ {"label":"K0B (D1,D4)", "x":11, "y":0},
+ {"label":"K10 (F4,B0)", "x":0, "y":1, "w":1.25},
+ {"label":"K11 (F4,F5)", "x":1.25, "y":1},
+ {"label":"K12 (F4,F6)", "x":2.25, "y":1},
+ {"label":"K13 (F4,F7)", "x":3.25, "y":1},
+ {"label":"K14 (F4,C7)", "x":4.25, "y":1},
+ {"label":"K15 (F4,C6)", "x":5.25, "y":1},
+ {"label":"K16 (F4,B6)", "x":6.25, "y":1},
+ {"label":"K17 (F4,B5)", "x":7.25, "y":1},
+ {"label":"K18 (F4,B4)", "x":8.25, "y":1},
+ {"label":"K19 (F4,D7)", "x":9.25, "y":1},
+ {"label":"K1B (F4,D4)", "x":10.25, "y":1, "w":1.75},
+ {"label":"K20 (F1,B0)", "x":0, "y":2, "w":2},
+ {"label":"K21 (F1,F5)", "x":2, "y":2},
+ {"label":"K22 (F1,F6)", "x":3, "y":2},
+ {"label":"K23 (F1,F7)", "x":4, "y":2},
+ {"label":"K24 (F1,C7)", "x":5, "y":2},
+ {"label":"K25 (F1,C6)", "x":6, "y":2},
+ {"label":"K26 (F1,B6)", "x":7, "y":2},
+ {"label":"K27 (F1,B5)", "x":8, "y":2},
+ {"label":"K28 (F1,B4)", "x":9, "y":2},
+ {"label":"K29 (F1,D7)", "x":10, "y":2},
+ {"label":"K2B (F1,D4)", "x":11, "y":2},
+ {"label":"K30 (F0,B0)", "x":0, "y":3},
+ {"label":"K31 (F0,F5)", "x":1, "y":3},
+ {"label":"K32 (F0,F6)", "x":2, "y":3},
+ {"label":"K33 (F0,F7)", "x":3, "y":3, "w":2.75},
+ {"label":"K35 (F0,C6)", "x":5.75, "y":3, "w":2.25},
+ {"label":"K37 (F0,B5)", "x":8, "y":3},
+ {"label":"K38 (F0,B4)", "x":9, "y":3},
+ {"label":"K39 (F0,D7)", "x":10, "y":3},
+ {"label":"K3B (F0,D4)", "x":11, "y":3}
+ ]
+ }
+ }
+ ,"meta": "https://noroadsleft.github.io/kbf_qmk_converter/"
+}
\ No newline at end of file
diff --git a/keyboards/bm43a/keymaps/default/config.h b/keyboards/bm43a/keymaps/default/config.h
new file mode 100644
index 000000000..60dd02a9d
--- /dev/null
+++ b/keyboards/bm43a/keymaps/default/config.h
@@ -0,0 +1,19 @@
+/* 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 .
+ */
+
+#pragma once
+
+// place overrides here
diff --git a/keyboards/bm43a/keymaps/default/keymap.c b/keyboards/bm43a/keymaps/default/keymap.c
new file mode 100644
index 000000000..7cafeadb3
--- /dev/null
+++ b/keyboards/bm43a/keymaps/default/keymap.c
@@ -0,0 +1,33 @@
+/* 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 .
+ */
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT(
+ KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_UP, KC_DOT,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
+ ),
+ [1] = LAYOUT(
+ RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, BL_TOGG, BL_DEC, BL_INC, BL_STEP, _______, _______, _______, _______, _______, _______,
+ _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______
+ ),
+
+};
+
diff --git a/keyboards/bm43a/keymaps/default/readme.md b/keyboards/bm43a/keymaps/default/readme.md
new file mode 100644
index 000000000..cec19a1f9
--- /dev/null
+++ b/keyboards/bm43a/keymaps/default/readme.md
@@ -0,0 +1 @@
+# The default keymap for bm43a
diff --git a/keyboards/bm43a/readme.md b/keyboards/bm43a/readme.md
new file mode 100644
index 000000000..ee5c17333
--- /dev/null
+++ b/keyboards/bm43a/readme.md
@@ -0,0 +1,16 @@
+# bm43a
+
+A 40% mechanical keyboard.
+
+This firmware was originally taken from a kbfirmware.json and converted through [kbf_qmk_converter](https://noroadsleft.github.io/kbf_qmk_converter/). You may find the original `.json` files [here](https://drive.google.com/drive/folders/11DowBYrFN_uCNa9Q9bXwuMn91vmZYBcG).
+
+
+Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin)
+Hardware Supported: bm43a PCB
+Hardware Availability: [KPRepublic](https://kprepublic.com/products/bm43a-bm43-43-keys-40-custom-mechanical-keyboard-pcb-programmed-numpad-layouts-qmk-firmware-with-rgb-bottom-underglow-alps-mx)
+
+Make example for this keyboard (after setting up your build environment):
+
+ make bm43a: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).
diff --git a/keyboards/bm43a/rules.mk b/keyboards/bm43a/rules.mk
new file mode 100644
index 000000000..66a778b6c
--- /dev/null
+++ b/keyboards/bm43a/rules.mk
@@ -0,0 +1,33 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+# Teensy halfkay
+# Pro Micro caterina
+# Atmel DFU atmel-dfu
+# LUFA DFU lufa-dfu
+# QMK DFU qmk-dfu
+# ATmega32A bootloadHID
+# ATmega328P USBasp
+BOOTLOADER = atmel-dfu
+
+# Build Options
+# change yes to no to disable
+#
+BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
+CONSOLE_ENABLE = yes # Console for debug(+400)
+COMMAND_ENABLE = yes # 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 = no # Enable keyboard RGB underglow
+MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
+UNICODE_ENABLE = no # Unicode
+BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
+AUDIO_ENABLE = no # Audio output on port C6
+FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
+HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)