added a test layout, and an `all-layouts` target to the makefile

partial-rewrite
Ben Blazak 2014-01-13 20:25:49 -08:00
parent 24884d470a
commit bcdbc2e37e
5 changed files with 103 additions and 3 deletions

4
firmware/.gitignore vendored
View File

@ -3,5 +3,7 @@
*.eep
*.elf
*.hex
*.map
firmware.hex

View File

@ -0,0 +1,87 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* TODO
* - description
* - update, if i change the semantics `kb__layout__exec_key()`
*
* Implements the "layout" section of '.../firmware/keyboard.h'
*/
#include <avr/pgmspace.h>
#include "../../../../firmware/keyboard.h"
#include "../../../../firmware/lib/layout/key-functions.h"
// ----------------------------------------------------------------------------
// matrix control
// ----------------------------------------------------------------------------
/** functions/kb__layout__exec_key/description
* Implementation notes:
* - TODO
*/
void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
key_functions__type_string ( PSTR( "test: " ) );
key_functions__type_string ( PSTR( " pressed: " ) );
key_functions__type_byte_hex ( pressed );
key_functions__type_string ( PSTR( " row: " ) );
key_functions__type_byte_hex ( row );
key_functions__type_string ( PSTR( " column: " ) );
key_functions__type_byte_hex ( column );
key_functions__type_string ( PSTR( "\n" ) );
// handle jumping to the bootloader if the three keys that cause this in
// the templates/kinesis-mod layout are pressed (in any order)
static uint8_t count; // set to 0 by the compiler
if ( ( row == 0x2 && column == 0x6 ) ||
( row == 0x2 && column == 0x7 ) ||
( row == 0x5 && column == 0x0 ) ) {
if (pressed) {
count++;
} else {
count--;
}
}
if (count >=3) {
key_functions__jump_to_bootloader();
}
}
// ----------------------------------------------------------------------------
// LED control
// ----------------------------------------------------------------------------
void kb__led__logical_on(char led) {
switch(led) {
case 'N': kb__led__on(1); break; // numlock
case 'C': kb__led__on(2); break; // capslock
case 'S': kb__led__on(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
void kb__led__logical_off(char led) {
switch(led) {
case 'N': kb__led__off(1); break; // numlock
case 'C': kb__led__off(2); break; // capslock
case 'S': kb__led__off(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}

View File

@ -25,6 +25,7 @@ KEYBOARD_LAYOUT := qwerty--kinesis-mod
# default layout for this keyboard
KEYBOARD_LAYOUTS := \
test \
colemak--kinesis-mod \
dvorak--kinesis-mod \
qwerty--kinesis-mod

View File

@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013 Ben Blazak <benblazak.dev@gmail.com>
* Copyright (c) 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */

View File

@ -116,7 +116,7 @@ OBJ := $(SRC:%.c=%.o)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
.PHONY: all clean
.PHONY: all clean cleanall all-layouts
all: $(TARGET).hex $(TARGET).eep
@echo
@ -138,6 +138,16 @@ clean:
@echo '--- cleaning ---'
git clean -dX # remove ignored files and directories
cleanall: clean
-rm $(TARGET)--*.hex
all-layouts:
for layout in $(KEYBOARD_LAYOUTS); do \
make clean all KEYBOARD_LAYOUT=$$layout; \
mv $(TARGET).hex $(TARGET)--$$layout.hex; \
done
make clean
# -----------------------------------------------------------------------------
.SECONDARY: