uC/Matrix_Controller/Core/Src/matrix_util.c
void matr_compare(volatile uint16_t data[N_COL][N_ROW], uint8_t* output){

	// loop over all columns first, as output is column sorted
	for(int i = 0; i < N_COL; i++){

		output[i] = 255;																	// preload

		// loop over all rows
		for(int j = 0; j < N_ROW; j++){
			uint16_t m = data[i][j];
			if(m < threshold_level[i][j]){																		// compare with threshold
				output[i] &= ~(1 << j);											// mark as dark
			}

		}

		//*(output[i]) = ~(uint8_t)(output[i]);													// invert, as only dark should be highlighted

	}


}
/**
 * @brief Calculates the output matrix in binary mode (1 column represented by 8 bit
 * uses threshold_level to produce output
 * @param data: input data in format uint16_t array [N_COL][N_ROW]
 * @param output: pointer to output vector of uint8_t with length [N_COL]
 */
@brief Calculates the output matrix in binary mode (1 column represented by 8 bit
uses threshold_level to produce output
@param data: input data in format uint16_t array [N_COL][N_ROW]
@param output: pointer to output vector of uint8_t with length [N_COL]
@brief Calculates the output matrix in binary mode ( 1 column represented by 8 bit uses threshold_level to produce output @param data : input data in format uint16_t array [ N_COL ] [ N_ROW ] @param output : pointer to output vector of uint8_t with length [ N_COL ]
void matr_compare(volatile uint16_t data[N_COL][N_ROW], uint8_t* output){
	for(int i = 0; i < N_COL; i++){
		output[i] = 255;																	
		for(int j = 0; j < N_ROW; j++){
			uint16_t m = data[i][j];
			if(m < threshold_level[i][j]){																		
				output[i] &= ~(1 << j);											
			}
		}
	}
}
void matr_compare ( volatile uint16_t data [ N_COL ] [ N_ROW ] , uint8_t * output ) { for ( int i = 0 ; i < N_COL ; i ++ ) { output [ i ] = 255 ; for ( int j = 0 ; j < N_ROW ; j ++ ) { uint16_t m = data [ i ] [ j ] ; if ( m < threshold_level [ i ] [ j ] ) { output [ i ] &= ~ ( 1 << j ) ; } } } }
@brief Calculates the output matrix in binary mode (1 column represented by 8 bit
 uses threshold_level to produce output
 @param data: input data in format uint16_t array [N_COL][N_ROW]
 @param output: pointer to output vector of uint8_t with length [N_COL]
@brief Calculates the output matrix in binary mode ( 1 column represented by 8 bit uses threshold_level to produce output @param data : input data in format uint16_t array [ N_COL ] [ N_ROW ] @param output : pointer to output vector of uint8_t with length [ N_COL ]
// loop over all columns first, as output is column sorted // preload // loop over all rows // compare with threshold // mark as dark //*(output[i]) = ~(uint8_t)(output[i]);													// invert, as only dark should be highlighted