forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from slay-t/dozen0_ble
[Add keyboard] Add Dozen0 BLE
- Loading branch information
Showing
11 changed files
with
572 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* Copyright (c) 2014 - 2017, Nordic Semiconductor ASA | ||
* Copyright (c) 2018, Sekigon | ||
* | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form, except as embedded into a Nordic | ||
* Semiconductor ASA integrated circuit in a product or a software update for | ||
* such product, must reproduce the above copyright notice, this list of | ||
* conditions and the following disclaimer in the documentation and/or other | ||
* materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* 4. This software, with or without modification, must only be used with a | ||
* Nordic Semiconductor ASA integrated circuit. | ||
* | ||
* 5. Any software provided in binary form under this license must not be reverse | ||
* engineered, decompiled, modified and/or disassembled. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS | ||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
*/ | ||
#ifndef CUSTOM_BOARD_H | ||
#define CUSTOM_BOARD_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
//#include "nrf_gpio.h" | ||
|
||
#define GPIO(port, pin) ((port << 5) | pin) | ||
#define PIN1 GPIO(0,8) | ||
#define PIN2 GPIO(0,11) | ||
#define PIN5 GPIO(0,18) | ||
#define PIN6 GPIO(0,16) | ||
#define PIN7 GPIO(0,19) | ||
#define PIN8 GPIO(0,20) | ||
#define PIN9 GPIO(0,22) | ||
#define PIN10 GPIO(0,23) | ||
#define PIN11 GPIO(1,0) | ||
#define PIN12 GPIO(1,3) | ||
|
||
#define PIN13 GPIO(0,9) | ||
#define PIN14 GPIO(0,10) | ||
#define PIN15 GPIO(1,15) | ||
#define PIN16 GPIO(1,14) | ||
#define PIN17 GPIO(0,3) | ||
#define PIN18 GPIO(0,30) | ||
#define PIN19 GPIO(0,0) | ||
#define PIN20 GPIO(0,5) | ||
//#define NRF_LOG_ENABLED 0 | ||
//#define NRF_LOG_BACKEND_SERIAL_USES_UART 0 | ||
//#define NRF_LOG_BACKEND_SERIAL_UART_TX_PIN 5 | ||
#define NRF_LOG_BACKEND_UART_TX_PIN 8 | ||
//#define DEBUG | ||
// Low frequency clock source to be used by the SoftDevice | ||
#ifdef S210 | ||
// #define NRF_CLOCK_LFCLKSRC NRF_CLOCK_LFCLKSRC_XTAL_20_PPM | ||
#else | ||
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC, \ | ||
.rc_ctiv = 16, \ | ||
.rc_temp_ctiv = 2, \ | ||
.xtal_accuracy = 0} | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // CUSTOM_BOARD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
Copyright 2019 yynmt | ||
Copyright 2019 slay-t <slay.tx@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/>. | ||
*/ | ||
|
||
#ifndef CONFIG_H | ||
#define CONFIG_H | ||
|
||
/* USB Device descriptor parameter */ | ||
#define VENDOR_ID 0xFEED | ||
#define PRODUCT_ID 0x0000 | ||
#define DEVICE_VER 0x0001 | ||
#define MANUFACTURER yynmt | ||
#define PRODUCT Dozen0 BLE | ||
#define DESCRIPTION 12 keys macropad | ||
|
||
/* key matrix size */ | ||
#define MATRIX_ROWS 1 | ||
#define MATRIX_COLS 12 | ||
|
||
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ | ||
#define DIODE_DIRECTION COL2ROW | ||
|
||
/* number of backlight levels */ | ||
//#define BACKLIGHT_LEVELS 3 | ||
|
||
/* Set 0 if debouncing isn't needed */ | ||
#define DEBOUNCING_DELAY 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 | ||
|
||
/* key combination for command */ | ||
#define IS_COMMAND() ( \ | ||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
) | ||
|
||
/* | ||
* Feature disable options | ||
* These options are also useful to firmware size reduction. | ||
*/ | ||
|
||
/* disable debug print */ | ||
//#define NO_DEBUG | ||
|
||
/* disable print */ | ||
//#define NO_PRINT | ||
|
||
/* disable action features */ | ||
//#define NO_ACTION_LAYER | ||
//#define NO_ACTION_TAPPING | ||
//#define NO_ACTION_ONESHOT | ||
//#define NO_ACTION_MACRO | ||
//#define NO_ACTION_FUNCTION | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef DOZEN0_BLE_H_ | ||
#define DOZEN0_BLE_H_ | ||
|
||
#include "quantum.h" | ||
#include "rev1.h" | ||
|
||
|
||
#endif /* DOZEN0_BLE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/* | ||
Copyright 2018 Sekigon | ||
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 "app_ble_func.h" | ||
|
||
enum custom_keycodes { | ||
AD_WO_L = SAFE_RANGE, /* Start advertising without whitelist */ | ||
BLE_DIS, /* Disable BLE HID sending */ | ||
BLE_EN, /* Enable BLE HID sending */ | ||
USB_DIS, /* Disable USB HID sending */ | ||
USB_EN, /* Enable USB HID sending */ | ||
DELBNDS, /* Delete all bonding */ | ||
ADV_ID0, /* Start advertising to PeerID 0 */ | ||
ADV_ID1, /* Start advertising to PeerID 1 */ | ||
ADV_ID2, /* Start advertising to PeerID 2 */ | ||
ADV_ID3, /* Start advertising to PeerID 3 */ | ||
ADV_ID4, /* Start advertising to PeerID 4 */ | ||
BATT_LV, /* Display battery level in milli volts */ | ||
DEL_ID0, /* Delete bonding of PeerID 0 */ | ||
DEL_ID1, /* Delete bonding of PeerID 1 */ | ||
DEL_ID2, /* Delete bonding of PeerID 2 */ | ||
DEL_ID3, /* Delete bonding of PeerID 3 */ | ||
DEL_ID4, /* Delete bonding of PeerID 4 */ | ||
ENT_DFU, /* Start bootloader */ | ||
ENT_SLP, /* Deep sleep mode */ | ||
QWERTY, | ||
COLEMAK, | ||
DVORAK, | ||
LOWER, | ||
RAISE, | ||
ADJUST, | ||
//BACKLIT, | ||
//EISU, | ||
//KANA, | ||
//RGBRST | ||
}; | ||
|
||
extern keymap_config_t keymap_config; | ||
|
||
enum layer_number { | ||
_TWELVE = 0, | ||
_LOWER, | ||
// _RAISE, | ||
}; | ||
|
||
const uint16_t PROGMEM | ||
keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
[_TWELVE] = | ||
|
||
LAYOUT( \ | ||
LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), KC_UP, KC_DEL, KC_BSPC, \ | ||
KC_LCTRL, KC_LSFT, KC_LEFT, KC_DOWN, KC_RIGHT, LT(_LOWER, KC_ENT) \ | ||
|
||
|
||
), | ||
[_LOWER] = | ||
LAYOUT( \ | ||
AD_WO_L, ADV_ID0, ADV_ID1, DEL_ID0, BATT_LV, ENT_SLP, \ | ||
ENT_DFU, USB_DIS, USB_EN, BLE_DIS, BLE_EN, _______ \ | ||
|
||
), | ||
|
||
}; | ||
|
||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
char str[16]; | ||
|
||
if (record->event.pressed) { | ||
switch (keycode) { | ||
case DELBNDS: | ||
delete_bonds(); | ||
return false; | ||
case AD_WO_L: | ||
restart_advertising_wo_whitelist(); | ||
return false; | ||
case USB_EN: | ||
set_usb_enabled(true); | ||
return false; | ||
break; | ||
case USB_DIS: | ||
set_usb_enabled(false); | ||
return false; | ||
break; | ||
case BLE_EN: | ||
set_ble_enabled(true); | ||
return false; | ||
break; | ||
case BLE_DIS: | ||
set_ble_enabled(false); | ||
return false; | ||
break; | ||
case ADV_ID0: | ||
restart_advertising_id(0); | ||
return false; | ||
case ADV_ID1: | ||
restart_advertising_id(1); | ||
return false; | ||
case ADV_ID2: | ||
restart_advertising_id(2); | ||
return false; | ||
case ADV_ID3: | ||
restart_advertising_id(3); | ||
return false; | ||
case ADV_ID4: | ||
restart_advertising_id(4); | ||
return false; | ||
case DEL_ID0: | ||
delete_bond_id(0); | ||
return false; | ||
case DEL_ID1: | ||
delete_bond_id(1); | ||
return false; | ||
case DEL_ID2: | ||
delete_bond_id(2); | ||
return false; | ||
case DEL_ID3: | ||
delete_bond_id(3); | ||
return false; | ||
case BATT_LV: | ||
sprintf(str, "%4dmV", get_vcc()); | ||
send_string(str); | ||
return false; | ||
case ENT_DFU: | ||
bootloader_jump(); | ||
return false; | ||
} | ||
} else if (!record->event.pressed) { | ||
switch (keycode) { | ||
case ENT_SLP: | ||
sleep_mode_enter(); | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; |
Oops, something went wrong.