add extern "C" to matrix.cpp
parent
2aa5e44640
commit
fa86b10138
|
@ -83,19 +83,21 @@ KBDReportParser kbd_parser3;
|
|||
KBDReportParser kbd_parser4;
|
||||
|
||||
|
||||
uint8_t matrix_rows(void) { return MATRIX_ROWS; }
|
||||
uint8_t matrix_cols(void) { return MATRIX_COLS; }
|
||||
bool matrix_has_ghost(void) { return false; }
|
||||
void matrix_init(void) {
|
||||
extern "C"
|
||||
{
|
||||
uint8_t matrix_rows(void) { return MATRIX_ROWS; }
|
||||
uint8_t matrix_cols(void) { return MATRIX_COLS; }
|
||||
bool matrix_has_ghost(void) { return false; }
|
||||
void matrix_init(void) {
|
||||
// USB Host Shield setup
|
||||
usb_host.Init();
|
||||
kbd1.SetReportParser(0, (HIDReportParser*)&kbd_parser1);
|
||||
kbd2.SetReportParser(0, (HIDReportParser*)&kbd_parser2);
|
||||
kbd3.SetReportParser(0, (HIDReportParser*)&kbd_parser3);
|
||||
kbd4.SetReportParser(0, (HIDReportParser*)&kbd_parser4);
|
||||
}
|
||||
}
|
||||
|
||||
static void or_report(report_keyboard_t report) {
|
||||
static void or_report(report_keyboard_t report) {
|
||||
// integrate reports into keyboard_report
|
||||
keyboard_report.mods |= report.mods;
|
||||
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
||||
|
@ -108,9 +110,9 @@ static void or_report(report_keyboard_t report) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void) {
|
||||
uint8_t matrix_scan(void) {
|
||||
static uint16_t last_time_stamp1 = 0;
|
||||
static uint16_t last_time_stamp2 = 0;
|
||||
static uint16_t last_time_stamp3 = 0;
|
||||
|
@ -165,13 +167,13 @@ uint8_t matrix_scan(void) {
|
|||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool matrix_is_modified(void) {
|
||||
bool matrix_is_modified(void) {
|
||||
return matrix_is_mod;
|
||||
}
|
||||
}
|
||||
|
||||
bool matrix_is_on(uint8_t row, uint8_t col) {
|
||||
bool matrix_is_on(uint8_t row, uint8_t col) {
|
||||
uint8_t code = CODE(row, col);
|
||||
|
||||
if (IS_MOD(code)) {
|
||||
|
@ -185,9 +187,9 @@ bool matrix_is_on(uint8_t row, uint8_t col) {
|
|||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
matrix_row_t matrix_get_row(uint8_t row) {
|
||||
matrix_row_t matrix_get_row(uint8_t row) {
|
||||
uint16_t row_bits = 0;
|
||||
|
||||
if (IS_MOD(CODE(row, 0)) && keyboard_report.mods) {
|
||||
|
@ -202,9 +204,9 @@ matrix_row_t matrix_get_row(uint8_t row) {
|
|||
}
|
||||
}
|
||||
return row_bits;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t matrix_key_count(void) {
|
||||
uint8_t matrix_key_count(void) {
|
||||
uint8_t count = 0;
|
||||
|
||||
count += bitpop(keyboard_report.mods);
|
||||
|
@ -214,21 +216,23 @@ uint8_t matrix_key_count(void) {
|
|||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_print(void) {
|
||||
void matrix_print(void) {
|
||||
print("\nr/c 0123456789ABCDEF\n");
|
||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
||||
xprintf("%02d: ", row);
|
||||
print_bin_reverse16(matrix_get_row(row));
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void led_set(uint8_t usb_led)
|
||||
{
|
||||
void led_set(uint8_t usb_led)
|
||||
{
|
||||
kbd1.SetReport(0, 0, 2, 0, 1, &usb_led);
|
||||
kbd2.SetReport(0, 0, 2, 0, 1, &usb_led);
|
||||
kbd3.SetReport(0, 0, 2, 0, 1, &usb_led);
|
||||
kbd4.SetReport(0, 0, 2, 0, 1, &usb_led);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue