2012-03-15 09:01:36 +01:00
|
|
|
/* ----------------------------------------------------------------------------
|
2012-04-25 08:22:20 +02:00
|
|
|
* ergoDOX layout : exports
|
|
|
|
*
|
|
|
|
* Different layouts are included by modifying a variable in the makefile.
|
2012-03-17 02:31:36 +01:00
|
|
|
* ----------------------------------------------------------------------------
|
2012-03-27 12:06:52 +02:00
|
|
|
* Copyright (c) 2012 Ben Blazak <benblazak.dev@gmail.com>
|
|
|
|
* Released under The MIT License (MIT) (see "license.md")
|
|
|
|
* Project located at <https://github.com/benblazak/ergodox-firmware>
|
2012-03-15 09:01:36 +01:00
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
2012-03-27 12:06:52 +02:00
|
|
|
#ifndef LAYOUT_h
|
|
|
|
#define LAYOUT_h
|
2012-03-15 09:01:36 +01:00
|
|
|
|
2012-04-30 03:47:27 +02:00
|
|
|
#include <avr/pgmspace.h>
|
2012-04-29 08:40:00 +02:00
|
|
|
#include "lib/data-types.h"
|
|
|
|
#include "lib/key-functions.h" // for `kbfun_funptr_t`
|
2012-04-10 10:44:27 +02:00
|
|
|
|
2012-05-30 01:53:55 +02:00
|
|
|
#include "matrix.h" // for number of rows and columns, and layout
|
|
|
|
// to matrix macros
|
2012-03-15 09:01:36 +01:00
|
|
|
|
2012-04-29 07:39:23 +02:00
|
|
|
// include the appropriate keyboard layout header
|
|
|
|
// for:
|
|
|
|
// - number of layers
|
2012-04-29 09:47:08 +02:00
|
|
|
// - possible non-default layout matrix definitions
|
2012-04-29 07:39:23 +02:00
|
|
|
// - possible non-default layout 'get' and 'set' definitions
|
2012-04-28 10:23:51 +02:00
|
|
|
#undef _str
|
|
|
|
#undef _expstr
|
|
|
|
#undef _inc
|
|
|
|
#define _str(s) #s // stringify
|
|
|
|
#define _expstr(s) _str(s) // expand -> stringify
|
|
|
|
#define _inc _expstr(layout/MAKEFILE_KEYBOARD_LAYOUT.h) // inc(lude)
|
|
|
|
#include _inc
|
|
|
|
#undef _str
|
|
|
|
#undef _expstr
|
|
|
|
#undef _inc
|
2012-03-27 12:06:52 +02:00
|
|
|
|
2012-04-29 07:39:23 +02:00
|
|
|
|
2012-04-29 09:47:08 +02:00
|
|
|
// default layout 'get' macros and `extern` matrix declarations
|
2012-04-29 07:39:23 +02:00
|
|
|
//
|
2012-04-30 03:47:27 +02:00
|
|
|
// these are for when the matrices are stored solely in Flash. layouts
|
|
|
|
// may redefine them if they wish and use RAM, EEPROM, or any
|
|
|
|
// combination of the three, as long as they maintain the same
|
|
|
|
// interface.
|
2012-04-29 09:47:08 +02:00
|
|
|
//
|
|
|
|
// - if the macro is overridden, the matrix declaration must be too,
|
|
|
|
// and vice versa.
|
2012-04-29 07:39:23 +02:00
|
|
|
//
|
|
|
|
// - 'set' functions are optional, and should be defined in the layout
|
|
|
|
// specific '.h'. they'll require the use of the EEPROM, possibly in
|
|
|
|
// clever conjunction with one of the other two memories (since the
|
2012-04-29 09:47:08 +02:00
|
|
|
// EEPROM is small). custom key functions will also need to be
|
|
|
|
// written.
|
2012-04-29 07:39:23 +02:00
|
|
|
//
|
2012-04-29 09:47:08 +02:00
|
|
|
// - to override these macros with real functions, set the macro equal
|
|
|
|
// to itself (e.g. `#define kb_layout_get kb_layout_get`) and provide
|
2012-04-29 07:39:23 +02:00
|
|
|
// function prototypes in the layout specific '.h'
|
|
|
|
|
|
|
|
#ifndef kb_layout_get
|
2012-04-30 03:47:27 +02:00
|
|
|
extern uint8_t PROGMEM \
|
|
|
|
_kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS];
|
|
|
|
|
2012-04-29 07:39:23 +02:00
|
|
|
#define kb_layout_get(layer,row,column) \
|
2012-04-30 03:47:27 +02:00
|
|
|
( (uint8_t) \
|
|
|
|
pgm_read_byte(&( \
|
|
|
|
_kb_layout[layer][row][column] )) )
|
2012-04-29 07:39:23 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef kb_layout_press_get
|
2012-04-30 03:47:27 +02:00
|
|
|
extern kbfun_funptr_t PROGMEM \
|
2012-04-29 09:47:08 +02:00
|
|
|
_kb_layout_press[KB_LAYERS][KB_ROWS][KB_COLUMNS];
|
2012-04-30 03:47:27 +02:00
|
|
|
|
2012-04-29 07:39:23 +02:00
|
|
|
#define kb_layout_press_get(layer,row,column) \
|
2012-04-30 03:47:27 +02:00
|
|
|
( (kbfun_funptr_t) \
|
|
|
|
pgm_read_word(&( \
|
|
|
|
_kb_layout_press[layer][row][column] )) )
|
2012-04-29 07:39:23 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef kb_layout_release_get
|
2012-04-29 09:47:08 +02:00
|
|
|
extern kbfun_funptr_t PROGMEM \
|
|
|
|
_kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS];
|
2012-04-30 03:47:27 +02:00
|
|
|
|
2012-04-29 07:39:23 +02:00
|
|
|
#define kb_layout_release_get(layer,row,column) \
|
2012-04-30 03:47:27 +02:00
|
|
|
( (kbfun_funptr_t) \
|
|
|
|
pgm_read_word(&( \
|
|
|
|
_kb_layout_release[layer][row][column] )) )
|
2012-05-30 01:53:55 +02:00
|
|
|
|
2012-04-29 07:39:23 +02:00
|
|
|
#endif
|
2012-03-27 12:06:52 +02:00
|
|
|
|
2012-06-01 09:50:45 +02:00
|
|
|
|
|
|
|
// default logical LED macros (all defined to nothing)
|
|
|
|
#ifndef kb_led_num_on
|
|
|
|
#define kb_led_num_on()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_num_off
|
|
|
|
#define kb_led_num_off()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_caps_on
|
|
|
|
#define kb_led_caps_on()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_caps_off
|
|
|
|
#define kb_led_caps_off()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_scroll_on
|
|
|
|
#define kb_led_scroll_on()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_scroll_off
|
|
|
|
#define kb_led_scroll_off()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_compose_on
|
|
|
|
#define kb_led_compose_on()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_compose_off
|
|
|
|
#define kb_led_compose_off()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_kana_on
|
|
|
|
#define kb_led_kana_on()
|
|
|
|
#endif
|
|
|
|
#ifndef kb_led_kana_off
|
|
|
|
#define kb_led_kana_off()
|
|
|
|
#endif
|
|
|
|
|
2012-03-27 12:06:52 +02:00
|
|
|
#endif
|
2012-03-15 09:01:36 +01:00
|
|
|
|