summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/command.c1
-rw-r--r--common/host.h1
-rw-r--r--common/util.c10
-rw-r--r--common/util.h3
4 files changed, 13 insertions, 2 deletions
diff --git a/common/command.c b/common/command.c
index 8ca16b9102..6d4e4c642d 100644
--- a/common/command.c
+++ b/common/command.c
@@ -234,6 +234,7 @@ static bool command_common(uint8_t code)
break;
#ifdef NKRO_ENABLE
case KC_N:
+ clear_keyboard(); //Prevents stuck keys.
keyboard_nkro = !keyboard_nkro;
if (keyboard_nkro)
print("NKRO: enabled\n");
diff --git a/common/host.h b/common/host.h
index c59fbfee6a..7c4f06601d 100644
--- a/common/host.h
+++ b/common/host.h
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define HOST_H
#include <stdint.h>
+#include <stdbool.h>
#include "report.h"
#include "host_driver.h"
diff --git a/common/util.c b/common/util.c
index 644301fe89..9d8fb93219 100644
--- a/common/util.c
+++ b/common/util.c
@@ -22,7 +22,7 @@ uint8_t bitpop(uint8_t bits)
{
uint8_t c;
for (c = 0; bits; c++)
- bits &= bits -1;
+ bits &= bits - 1;
return c;
/*
const uint8_t bit_count[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
@@ -30,6 +30,14 @@ uint8_t bitpop(uint8_t bits)
*/
}
+uint8_t bitpop16(uint16_t bits)
+{
+ uint8_t c;
+ for (c = 0; bits; c++)
+ bits &= bits - 1;
+ return c;
+}
+
// most significant on-bit - return highest location of on-bit
uint8_t biton(uint8_t bits)
{
diff --git a/common/util.h b/common/util.h
index 87636c9710..c3734487f9 100644
--- a/common/util.h
+++ b/common/util.h
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UTIL_H
-#define UTIL_H 1
+#define UTIL_H
#include <stdint.h>
@@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
uint8_t bitpop(uint8_t bits);
+uint8_t bitpop16(uint16_t bits);
uint8_t biton(uint8_t bits);
#endif