2012-04-10 10:44:27 +02:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* ergoDOX specific code: tying it all together
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
* 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-04-29 08:40:00 +02:00
|
|
|
#include "lib/data-types.h"
|
2012-04-10 10:44:27 +02:00
|
|
|
|
|
|
|
#include "ergodox/matrix.h"
|
bugfix (mostly): changed the way layers are handled
before, if you pressed a key, then shifted layers, then released it, the
first layer's press() would be called, and the 2nd layer's release()
would be called, causing keys to stick, and probably other errors. now,
the layer that the key was on when it was pressed is kept track of, and
the proper release() is called.
also, layers can be shifted per key now, instead of just for the whole
board at once
i also changed how keyboard-private includes are handled. "private"
stuff is now in its own file, instead of being nested in an extra
`#ifdef`.
and i think that's it. i'm pretty tired right now, so there may be
errors, but it seemed to work all right with cursory tests.
2012-06-11 12:27:34 +02:00
|
|
|
#include "ergodox/mcp23018--private.h"
|
|
|
|
#include "ergodox/teensy-2-0--private.h"
|
2012-04-10 10:44:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* returns
|
|
|
|
* - success: 0
|
|
|
|
* - error: number of the function that failed
|
|
|
|
*/
|
|
|
|
uint8_t kb_init(void) {
|
|
|
|
if (teensy_init()) // must be first
|
|
|
|
return 1;
|
|
|
|
if (mcp23018_init()) // must be second
|
|
|
|
return 2;
|
|
|
|
|
|
|
|
return 0; // success
|
|
|
|
}
|
|
|
|
|
|
|
|
/* returns
|
|
|
|
* - success: 0
|
|
|
|
* - error: number of the function that failed
|
|
|
|
*/
|
|
|
|
uint8_t kb_update_matrix(bool matrix[KB_ROWS][KB_COLUMNS]) {
|
2012-04-12 06:05:45 +02:00
|
|
|
if (teensy_update_matrix(matrix))
|
2012-04-10 10:44:27 +02:00
|
|
|
return 1;
|
2012-04-12 06:05:45 +02:00
|
|
|
if (mcp23018_update_matrix(matrix))
|
2012-04-10 10:44:27 +02:00
|
|
|
return 2;
|
|
|
|
|
|
|
|
return 0; // success
|
|
|
|
}
|
|
|
|
|