Browse Source

x68k_usb: Convert legacy keymap into current one

tags/v2.9
tmk 8 years ago
parent
commit
e7808f7ea4
3 changed files with 12 additions and 35 deletions
  1. 1
    1
      converter/x68k_usb/Makefile
  2. 0
    3
      converter/x68k_usb/config.h
  3. 11
    31
      converter/x68k_usb/keymap.c

+ 1
- 1
converter/x68k_usb/Makefile View 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

converter/x68k_usb/config_pjrc.h → converter/x68k_usb/config.h View 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

+ 11
- 31
converter/x68k_usb/keymap.c View 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)]) };
}

Loading…
Cancel
Save