void qt_dbtreemodel_impl :: finished_updating()
 { 
     _updating.wait();
     _updating_mutex.lock();
     _update_rows();
     _insert_rows();
     _updating_mutex.unlock();
 }
uint8_t teensy_update_matrix(bool matrix[KB_ROWS][KB_COLUMNS]) {
	teensypin_write(DDR, SET, COLUMN_0);   // set col low (set as output)
	_update_rows(matrix, 0);               // read row 0..5 & update matrix
	teensypin_write(DDR, CLEAR, COLUMN_0); // set col hi-Z (set as input)

	teensypin_write(DDR, SET, COLUMN_1);
	_update_rows(matrix, 1);
	teensypin_write(DDR, CLEAR, COLUMN_1);

	teensypin_write(DDR, SET, COLUMN_2);
	_update_rows(matrix, 2);
	teensypin_write(DDR, CLEAR, COLUMN_2);

	teensypin_write(DDR, SET, COLUMN_3);
	_update_rows(matrix, 3);
	teensypin_write(DDR, CLEAR, COLUMN_3);

	teensypin_write(DDR, SET, COLUMN_4);
	_update_rows(matrix, 4);
	teensypin_write(DDR, CLEAR, COLUMN_4);

	teensypin_write(DDR, SET, COLUMN_5);
	_update_rows(matrix, 5);
	teensypin_write(DDR, CLEAR, COLUMN_5);

	teensypin_write(DDR, SET, COLUMN_6);
	_update_rows(matrix, 6);
	teensypin_write(DDR, CLEAR, COLUMN_6);

	return 0;  // success
}