I got the columns and rows using this.
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
if (matrix_is_on(r, c)) {
row_pressed = r;
col_pressed = c;
xprintf("r1:%d c1:%d \n", r, c);
break;
}
}
}
It give me the right result, but I don't know if it is the right way to this.
May be there is already a function to this, I don't want to reinvent the wheel.