summaryrefslogtreecommitdiff
path: root/keyboard/planck/keymaps/keymap_lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/planck/keymaps/keymap_lock.c')
-rw-r--r--keyboard/planck/keymaps/keymap_lock.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/keyboard/planck/keymaps/keymap_lock.c b/keyboard/planck/keymaps/keymap_lock.c
index 4fe2e0a2bf..b844d1cdab 100644
--- a/keyboard/planck/keymaps/keymap_lock.c
+++ b/keyboard/planck/keymaps/keymap_lock.c
@@ -2,7 +2,7 @@
#include "backlight.h"
#include "action_layer.h"
#include "keymap_midi.h"
-#include "beeps.h"
+#include <avr/boot.h>
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = { /* Qwerty */
@@ -53,6 +53,16 @@ const uint16_t PROGMEM fn_actions[] = {
};
+uint16_t hextokeycode(int hex) {
+ if (hex == 0x0) {
+ return KC_0;
+ } else if (hex < 0xA) {
+ return KC_1 + (hex - 0x1);
+ } else {
+ return KC_A + (hex - 0xA);
+ }
+}
+
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
@@ -64,6 +74,35 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
backlight_set(BACKLIGHT_LEVELS);
default_layer_and(0);
default_layer_or((1<<5));
+
+ uint8_t low = boot_lock_fuse_bits_get(0x0000);
+ uint8_t high = boot_lock_fuse_bits_get(0x0003);
+ uint8_t ext = boot_lock_fuse_bits_get(0x0002);
+ uint8_t lock = boot_lock_fuse_bits_get(0x0001);
+
+ register_code(hextokeycode((low & 0xF0) >> 4));
+ unregister_code(hextokeycode((low & 0xF0) >> 4));
+ register_code(hextokeycode((low & 0x0F)));
+ unregister_code(hextokeycode((low & 0x0F)));
+
+
+ register_code(hextokeycode((high & 0xF0) >> 4));
+ unregister_code(hextokeycode((high & 0xF0) >> 4));
+ register_code(hextokeycode((high & 0x0F)));
+ unregister_code(hextokeycode((high & 0x0F)));
+
+
+ register_code(hextokeycode((ext & 0xF0) >> 4));
+ unregister_code(hextokeycode((ext & 0xF0) >> 4));
+ register_code(hextokeycode((ext & 0x0F)));
+ unregister_code(hextokeycode((ext & 0x0F)));
+
+
+ register_code(hextokeycode((lock & 0xF0) >> 4));
+ unregister_code(hextokeycode((lock & 0xF0) >> 4));
+ register_code(hextokeycode((lock & 0x0F)));
+ unregister_code(hextokeycode((lock & 0x0F)));
+
// note(0+12, 20);
// note(0+24, 20);
} else {