working! cleaned up a bit and found a silly bug

one bug left to fix before it's actually doing what it's supposed to

scanning at about 140Hz :D , and only slightly bigger than the old
firmware (though, with many fewer layers compiled in...) (also, the
winavr makefile gets the hex to be smaller somehow; i should probably
look into that)
partial-rewrite
Ben Blazak 2013-04-19 14:58:09 -07:00
parent 0774d0dd09
commit 316f54596e
10 changed files with 31 additions and 16 deletions

View File

@ -8,6 +8,9 @@
* A default way to execute keys.
*
* Meant to be included *only* by the layout using it.
*
* TODO: oops... need to keep track of which layer keys were pressed on, so we
* can release on the same layer
*/
@ -23,12 +26,13 @@
void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
void (*function)(void);
uint8_t offset = 0;
for(uint8_t i=0; i<layer_stack__size(); i++) {
function = _layout[ layer_stack__peek(i) ]
[ row ]
[ column ]
[ (pressed) ? 0 : 1 ];
do {
function = _layout[ layer_stack__peek(offset) ]
[ row ]
[ column ]
[ (pressed) ? 0 : 1 ];
if (function == &KF(transp))
function = NULL;
@ -43,7 +47,9 @@ void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
return;
}
}
offset++;
} while (offset < layer_stack__size());
// if we get here, there was a transparent key in layer 0; do nothing
}

View File

@ -74,8 +74,8 @@ layout_t _layout = {
K, nop,
// left hand ...... ......... ......... ......... ......... ......... .........
equal, 1, 2, 3, 4, 5, esc,
bkslash, quote, comma, period, p, y, lpu1l1,
tab, a, o, e, u, i,
tab, quote, comma, period, p, y, lpu1l1,
bkslash, a, o, e, u, i,
shL2kcap, semicol, q, j, k, x, lpupo1l1,
guiL, grave, bkslash, arrowL, arrowR,
ctrlL, altL,

View File

@ -74,8 +74,8 @@ layout_t _layout = {
K, nop,
// left hand ...... ......... ......... ......... ......... ......... .........
equal, 1, 2, 3, 4, 5, esc,
bkslash, q, w, e, r, t, lpu1l1,
tab, a, s, d, f, g,
tab, q, w, e, r, t, lpu1l1,
bkslash, a, s, d, f, g,
shL2kcap, z, x, c, v, b, lpupo1l1,
guiL, grave, bkslash, arrowL, arrowR,
ctrlL, altL,

View File

@ -60,3 +60,7 @@ SRC += $(wildcard $(CURDIR)/layout/$(KEYBOARD_LAYOUT)*.c)
CFLAGS += -include $(wildcard $(CURDIR)/options.h)
$(CURDIR)/layout/qwerty-kinesis-mod.o: $(wildcard $(CURDIR)/layout/common/*)
$(CURDIR)/layout/dvorak-kinesis-mod.o: $(wildcard $(CURDIR)/layout/common/*)
$(CURDIR)/layout/colemak-symbol-mod.o: $(wildcard $(CURDIR)/layout/common/*)

View File

@ -28,9 +28,9 @@ void key_functions__toggle_capslock (uint16_t ignore) {
// toggle capslock
usb__kb__set_key(true, KEYBOARD__CapsLock);
usb_keyboard_send();
usb__kb__send_report();
usb__kb__set_key(false, KEYBOARD__CapsLock);
usb_keyboard_send();
usb__kb__send_report();
// restore the state of both shifts
if (lshift_pressed) usb__kb__set_key(true, KEYBOARD__LeftShift);

View File

@ -71,11 +71,11 @@ static uint8_t _resize_stack(void) {
if (temp) {
_stack = temp;
_allocated += change;
return 0; // success
} else {
return 1; // error
}
}
return 0; // success
}
/** functions/_shift_elements/description

View File

@ -17,5 +17,5 @@
void usb__init(void) { usb_init(); }
bool usb__is_configured(void) { usb_configured(); }
bool usb__is_configured(void) { return usb_configured(); }

View File

@ -115,9 +115,10 @@ bool usb__kb__read_led(char led) {
case 'O': return keyboard_leds & (1<<3); // compose
case 'K': return keyboard_leds & (1<<4); // kana
};
return false;
}
uint8_t usb__kb__send_report(void) {
return (uint8_t) usb_keyboard_send();
return usb_keyboard_send();
}

View File

@ -36,6 +36,7 @@
* - `usb_keyboard_press()` removed
* - `OPT__` macros added (and other code modified accordingly)
* - `PROGMEM` code made `const`
* - removed unused variable `t` from `ISR(USB_GEN_vect)`
*/
@ -376,7 +377,7 @@ int8_t usb_keyboard_send(void)
//
ISR(USB_GEN_vect)
{
uint8_t intbits, t, i;
uint8_t intbits, i;
static uint8_t div4=0;
intbits = UDINT;

View File

@ -28,6 +28,9 @@ TARGET := firmware
# -----------------------------------------------------------------------------
default-target: all
# (to retain default behavior when included makefiles specify dependencies)
CURDIR := .
ROOTDIR := .
# note: by default, `CURDIR` is initialized to (an absolute path to) the