int main(void) { init_timer(); init_io(); USART_Init(); sei(); fill_cube(0xFF); _delay_us(1500000); int mode = (PIND & (1<<PD3)); if (mode) { while (1) { random_filler(1); random_filler(0); loadbar(); rain(100); send_voxels_rand_z(200); set_edges(); _delay_us(5000000); } } else { int escape = 0; int counter = 0; while (1) { uint8_t byte; byte = USART_Receive(); if (!escape) { if (byte == 0xAB) { // escape character escape = 1; } else if (counter < 64) { tab[counter/8][counter%8] = byte; counter++; } } else { if (byte == 0xCD) { // start character counter = 0; } else if (byte == 0xAB && counter < 64) { tab[counter/8][counter%8] = byte; counter++; } escape = 0; } } } return 0; }
/** Constructor. * @param scanlines list of scanline models (Does only work with ScanlineGrid) * @param q Qualifier for a single pixel (The qualifier gets deleted by this class) * @param threshold minimum rise required for classification * @param max_size of an object to be detected (if 0 value will be ignored) * @param use_rising_flank * if true the classification can start on a rising flank * @param use_falling_flank * if true the classification can start on a falling flank */ GradientClassifier::GradientClassifier(std::list<ScanlineGrid *> *scanlines, Qualifier * q, unsigned int threshold, unsigned int max_size, bool use_rising_flank, bool use_falling_flank) : Classifier("GradientClassifier") { if (!scanlines) throw fawkes::NullPointerException("GradientClassifier: scanlines may not be null!"); if (!q) throw fawkes::NullPointerException("GradientClassifier: the Qualifier may not be null!"); _scanlines = scanlines; _q = q; _max_size = 999999; //Infinite... set_threshold(threshold, max_size); set_edges(use_rising_flank, use_falling_flank); }