-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
This is guide will show you how to configure the DAK 1.1 firmware for your keyboard. To use this firmware you need to install the Arduino IDE and the Teensyduino add-on.
First you need to configure the IO pins of the controller. To do this open the
project in the Arduino IDE and then click on hw_config.h
. This file describes
how the keyboard (key matrix) is physically connected to the controller.
Set the number of ROWS and COLUMNS in your key matrix:
#define ROWS 9
#define COLUMNS 14
Then define macros for each row/column pin. For example, if the row 1 (R0) is connected to the pin 21
then define it in the following manner:
#define R0 21
...
#define R8 12
#define C0 11
...
#define C13 23
Once all pins are correctly defined, add all rows and columns in correct order to the following arrays:
const uint8_t ROW_PINS[] = {R0, R1, R2, R3, R4, R5, R6, R7, R8};
const uint8_t COLUMN_PINS[] = {C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13};
To change the IO-pins for the LEDs, edit the following values:
#define LED1 0 // CAPS LOCK
#define LED2 24 // FN LOCK
Then define a macro for each button/switch in the key array. The syntax used here: {[column index],[row index]}
. These macros are used to make the layout_config_XX.h
easier to read.
#define B33A {4,4}
#define B33B {4,5}
If you want to check that everything is configured correctly, you can uncomment the following line:
#define DEBUG_PRINT_STATES_ARRAY
This will print the states of the switches to the serial port. This feature is useful to make sure that all switches are working properly and the pins are correctly defined. Use only for debugging. To enable the serial port set in the IDE: Tools -> USB type: -> Serial + Keyboard + Mouse + Joystick
To define the layout open layout_config_FI.h
. Currently, there is only a Finnish layout, which is quite different from the US layout, so it is likely that you need to define a new layout for your keyboard. To do that you can edit the layout file or create a new one. In case of a new file, update in the DAK.ino
file include accordingly:
#include "layout_config_FI.h"
//to
#include "[YOUR_NEW_FILE_NAME].h"
To set the FN keys, update the following values. Currently, there are two FN keys which are used to access the FN layer. If both FN keys are pressed simultaneously, FN lock is enable/disabled.
const uint8_t FN1[] = B58A;
const uint8_t FN2[] = B63A;
Each physical key has two layers and each layer has two actions. To define the behavior of a layer, there are three different modes implemented: ADDITIVE_ACTION
, TOGGLE_ACTION
, and DOUBLE_ACTION
. They are explained in the layout_config_FI.h
file.
Each physical key needs to be defined individually as shown below and added to the keys_const
array.
#define K33 DOUBLE_ACTION,DOUBLE_ACTION,{KEY_F,KEY_9,0,0},{0,SHIFT,0,0},B33A,B33B // )
Where:
#define
[KEY NAME]
[KeyType (normal-layer)],
[KeyType (fn-layer) ],
{[1. action key code (normal-layer)], [2. action key code (normal-layer)], [1. action key code (fn-layer)], [2. action key code (fn-layer)]},
{[1. action modifiers (normal-layer)], [2. action modifiers (normal-layer)], [1. action modifiers (fn-layer)], [2. action modifiers (fn-layer)]},
{[column index first button],[row index first button]},
{[column index second button],[row index second button]}
The most important key codes can be found here, the complete list of key codes (including multimedia keys) can be found here, see lines 70-227.
Modifier keys can be combined using the following syntax: for example CTRL + ALT + SHIFT = MODIFIERKEY_CTRL | MODIFIERKEY_RIGHT_ALT | MODIFIER_SHIFT
. Normal keys cannot be combined.
Now that all thing are configured, we can upload the program on the Teensy.
To upload the code connect the Teensy to the computer and then go Tools->Board:
and choose
your board. After that open Tools->USB Type:
and choose Keyboard
. Then just hit the
upload button in the upper left corner and the code should be compiled and sent to the controller.