2012-04-10 10:44:27 +02:00
|
|
|
/* ----------------------------------------------------------------------------
|
2012-07-31 23:48:31 +02:00
|
|
|
* ergoDOX : controller specific code
|
2012-04-10 10:44:27 +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>
|
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
2016-06-11 22:19:48 +02:00
|
|
|
#include "./controller.h"
|
2012-04-10 10:44:27 +02:00
|
|
|
|
2012-07-31 23:48:31 +02:00
|
|
|
// ----------------------------------------------------------------------------
|
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
|
|
|
|
}
|