1
0
Fork 0

Use keyboard config for nkro (#7)

* removing nkro references - wip

* changed NKRO to be defined by keymap_config
This commit is contained in:
IBNobody 2016-09-06 23:19:01 -05:00 committed by GitHub
parent f0388a5b13
commit 558f3ec1eb
17 changed files with 131 additions and 101 deletions

View file

@ -20,6 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_util.h"
#include "action_layer.h"
#include "timer.h"
#include "keycode_config.h"
extern keymap_config_t keymap_config;
static inline void add_key_byte(uint8_t code);
static inline void del_key_byte(uint8_t code);
@ -139,7 +143,7 @@ void send_keyboard_report(void) {
void add_key(uint8_t key)
{
#ifdef NKRO_ENABLE
if (keyboard_protocol && keyboard_nkro) {
if (keyboard_protocol && keymap_config.nkro) {
add_key_bit(key);
return;
}
@ -150,7 +154,7 @@ void add_key(uint8_t key)
void del_key(uint8_t key)
{
#ifdef NKRO_ENABLE
if (keyboard_protocol && keyboard_nkro) {
if (keyboard_protocol && keymap_config.nkro) {
del_key_bit(key);
return;
}
@ -231,7 +235,7 @@ uint8_t has_anymod(void)
uint8_t get_first_key(void)
{
#ifdef NKRO_ENABLE
if (keyboard_protocol && keyboard_nkro) {
if (keyboard_protocol && keymap_config.nkro) {
uint8_t i = 0;
for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
;

View file

@ -83,10 +83,6 @@ void bootmagic(void)
}
eeconfig_update_keymap(keymap_config.raw);
#ifdef NKRO_ENABLE
keyboard_nkro = keymap_config.nkro;
#endif
/* default layer */
uint8_t default_layer = 0;
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); }

View file

@ -238,7 +238,7 @@ static void print_status(void)
print_val_hex8(keyboard_protocol);
print_val_hex8(keyboard_idle);
#ifdef NKRO_ENABLE
print_val_hex8(keyboard_nkro);
print_val_hex8(keymap_config.nkro);
#endif
print_val_hex32(timer_read32());
@ -435,8 +435,8 @@ static bool command_common(uint8_t code)
// NKRO toggle
case MAGIC_KC(MAGIC_KEY_NKRO):
clear_keyboard(); // clear to prevent stuck keys
keyboard_nkro = !keyboard_nkro;
if (keyboard_nkro) {
keymap_config.nkro = !keymap_config.nkro;
if (keymap_config.nkro) {
print("NKRO: on\n");
} else {
print("NKRO: off\n");

View file

@ -22,11 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "debug.h"
#ifdef NKRO_ENABLE
bool keyboard_nkro = true;
#endif
static host_driver_t *driver;
static uint16_t last_system_report = 0;
static uint16_t last_consumer_report = 0;

View file

@ -28,10 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern "C" {
#endif
#ifdef NKRO_ENABLE
extern bool keyboard_nkro;
#endif
extern uint8_t keyboard_idle;
extern uint8_t keyboard_protocol;

View file

@ -57,6 +57,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "visualizer/visualizer.h"
#endif
#ifdef MATRIX_HAS_GHOST
static bool has_ghost_in_row(uint8_t row)
{
@ -106,7 +108,7 @@ void keyboard_init(void) {
rgblight_init();
#endif
#if defined(NKRO_ENABLE) && defined(FORCE_NKRO)
keyboard_nkro = true;
keymap_config.nkro = 1;
#endif
}

View file

@ -27,10 +27,6 @@ void magic(void)
/* keymap config */
keymap_config.raw = eeconfig_read_keymap();
#ifdef NKRO_ENABLE
keyboard_nkro = keymap_config.nkro;
#endif
uint8_t default_layer = 0;
default_layer = eeconfig_read_default_layer();
default_layer_set((uint32_t)default_layer);