]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
x68k_usb: Convert legacy keymap into current one
authortmk <hasu@tmk-kbd.com>
Fri, 29 Apr 2016 06:30:32 +0000 (15:30 +0900)
committertmk <hasu@tmk-kbd.com>
Fri, 29 Apr 2016 06:30:32 +0000 (15:30 +0900)
converter/x68k_usb/Makefile
converter/x68k_usb/config.h [moved from converter/x68k_usb/config_pjrc.h with 97% similarity]
converter/x68k_usb/keymap.c

index fd2eb1999b0284548f84dc0bd5934c4d557eb0c2..9df264b3524345cdf8d382c350005d0dd0d16bd4 100644 (file)
@@ -18,7 +18,7 @@ SRC = keymap.c \
        led.c \
        protocol/serial_uart.c
 
-CONFIG_H = config_pjrc.h
+CONFIG_H = config.h
 
 
 # MCU name, you MUST set this to match the board you are using
similarity index 97%
rename from converter/x68k_usb/config_pjrc.h
rename to converter/x68k_usb/config.h
index 77989fe3b8e91734172208f6bdfed9eea36d5df3..b552223a86cd93d5a1ce5fc878f54520e3d8fadb 100644 (file)
@@ -39,9 +39,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
     keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) \
 )
 
-/* legacy keymap support */
-#define USE_LEGACY_KEYMAP
-
 
 /* USART configuration
  *     asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control
index 5e09f55d204304d3cbcde5e59b4eca6a876ac3bd..671e5decc66ba7fec2dfd631babfa9d51f6bc684 100644 (file)
@@ -19,6 +19,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <stdbool.h>
 #include <avr/pgmspace.h>
 #include "keycode.h"
+#include "action.h"
 #include "util.h"
 #include "keymap.h"
 
@@ -70,30 +71,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 }
 
 
-// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
-static const uint8_t PROGMEM fn_layer[] = {
-    0,              // Fn0
-    0,              // Fn1
-    0,              // Fn2
-    0,              // Fn3
-    0,              // Fn4
-    0,              // Fn5
-    0,              // Fn6
-    0               // Fn7
+static const uint16_t fn_actions[] PROGMEM = {
 };
 
-// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
-// See layer.c for details.
-static const uint8_t PROGMEM fn_keycode[] = {
-    KC_NO,          // Fn0
-    KC_NO,          // Fn1
-    KC_NO,          // Fn2
-    KC_NO,          // Fn3
-    KC_NO,          // Fn4
-    KC_NO,          // Fn5
-    KC_NO,          // Fn6
-    KC_NO           // Fn7
-};
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+}
 
 
 static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -134,17 +117,14 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 };
 
 
-uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
-{
-    return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
-}
-
-uint8_t keymap_fn_layer(uint8_t index)
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
 {
-    return pgm_read_byte(&fn_layer[index]);
+    return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
 }
 
-uint8_t keymap_fn_keycode(uint8_t index)
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
 {
-    return pgm_read_byte(&fn_keycode[index]);
+    return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
 }