int main(int argc, char* argv[]) { /* Variable Declaration and Initialization */ int i = 0; int buffer_size = 2048; if(argc != 1) { buffer_size = atoi(argv[1]); } int pixel_buffer_size = buffer_size+1; data.buffer_size = buffer_size; data.pixel_buffer_size = pixel_buffer_size; /* Memory Allocation */ #if(RAW == ON) if((data.buffer = malloc(buffer_size * sizeof(int16_t))) == NULL) exit(-1); #else if((data.buffer = malloc(buffer_size * sizeof(float))) == NULL) exit(-1); #endif if((data.pixel_tab = malloc(pixel_buffer_size * sizeof(char))) == NULL) exit(-1); init_processing(); usleep(100); for(int j = 0; j < 10; j++) { pthread_mutex_lock(&process_mutex); for(i = 0; i < buffer_size; i++) data.buffer[i] = 0.26; data.position = 65; pthread_cond_signal(&new_data_to_process); pthread_mutex_unlock(&process_mutex); /* Temps de Capture (100us parcequ'on gère!) */ usleep(100); } end_processing(); /* RP and Variables Release */ free(data.pixel_tab); free(data.buffer); return EXIT_SUCCESS; }
void init(void){ DIR_DATA = STD_DIR_DATA; DIR_REGA = STD_DIR_REGA; DIR_REGB = STD_DIR_REGB; DIR_MC2 = STD_DIR_MC2; PORT_DATA = STD_PORT_DATA; PORT_REGA = STD_PORT_REGA; PORT_REGB = STD_PORT_REGB; PORT_MC2 = STD_PORT_MC2; init_mux(); init_switch(); init_buffer(); init_processing(); for(char i = 0; i<10; i++){ for(char j = 0; j<13; j++){ CUBE[i][j]=0x01; } } //Timer A: TCCR1A = 0x00; TCCR1B = (1<<WGM12)|(1<CS12); OCR1AH = TM1ZAEHLER>>8; OCR1AL = TM1ZAEHLER & 0x00FF; TIMSK = (1<<OCIE1A); sei(); PORT_REGB |= (1<<PIN_ENABLE_CUBE); // CUBE EINSCHALTEN }