ergodox-firmware/src/keyboard/controller.c

38 lines
1 KiB
C
Raw Normal View History

/* ----------------------------------------------------------------------------
* ergoDOX : controller specific code
* ----------------------------------------------------------------------------
* 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"
// ----------------------------------------------------------------------------
/* 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))
return 1;
2012-04-12 06:05:45 +02:00
if (mcp23018_update_matrix(matrix))
return 2;
return 0; // success
}