/* remove a module from the chain. this isn't guaranteed to succeed, * because removing the module might result in an invalid routing */ void Chain::remove ( Module *m ) { int i = modules_pack->find( m ); int ins = 0; if ( i != 0 ) ins = module( i - 1 )->noutputs(); if ( ! can_configure_outputs( m, ins ) ) { fl_alert( "Can't remove module at this point because the resultant chain is invalid" ); } client()->lock(); strip()->handle_module_removed( m ); modules_pack->remove( m ); configure_ports(); client()->unlock(); }
int main(void) { configure_ports(); // Start PWM // Phase Correct, TOP is OCR1A, Update OCR1x at TOP, prescaler 8 // Clear OC1B on Compare Match when upcounting. Set OC1B on Compare // Match when downcounting. TCCR1A = (1 << COM1B1) | (1 << WGM11) | (1 << WGM10); TCCR1B = (1 << WGM13) | (1 << CS10); OCR1A = 130; // set period to 20 ms OCR1B = 72; TCCR0A = _BV(WGM01); TCCR0B = _BV(CS00) | _BV(CS02); OCR0A = 17; TIMSK0 = _BV(OCIE0A); // pwmInit910(); // Intialize PWM for timer which controls pins 9 and 10 ( since pins 9 and 10 are on the same timer) // pwmOn9(); // turn on PWM for pin 9 // pwmInit56(); //Initialize timer for pins 5 and 6(since pins 5 and 6 are on the same timer) // pwmOn5(); // turn on PWM for pin 5 // pwmSet5(255); //pin6 which is 8 bit PWM // pwmSet9(65535); //pin9 which is 16 bit PWM // pwmSet10(255); volatile int test = 0; while(1) { test+=1; } return 0; }
/* add a control to the control strip. Assumed to already be connected! */ void Chain::add_control ( Controller_Module *m ) { client()->lock(); controls_pack->add( m ); configure_ports(); client()->unlock(); controls_pack->redraw(); }
void Chain::buffer_size ( nframes_t nframes ) { for ( unsigned int i = scratch_port.size(); i--; ) delete[] (sample_t*)scratch_port[i].buffer(); scratch_port.clear(); configure_ports(); for ( int i = 0; i < modules(); ++i ) { Module *m = module(i); m->resize_buffers( nframes ); } }
void Chain::buffer_size ( nframes_t nframes ) { for ( unsigned int i = scratch_port.size(); i--; ) free(scratch_port[i].buffer()); scratch_port.clear(); configure_ports(); Module::set_buffer_size ( nframes ); for ( int i = 0; i < modules(); ++i ) { Module *m = module(i); m->resize_buffers( nframes ); } }
void initialize() { counter_a = 0; counter_b = 0; configure_ports(); configure_timers(); init_step_motor(); init_servodrive(); init_proxi_switch(); init_delays(); sei(); while(INIT_TIME--) { buzzer(440, 100); delay_s(1); } }
int main(void) { configure_ports(); a2dInit(); a2dSetPrescaler(ADC_PRESCALE_DIV32); a2dSetReference(ADC_REFERENCE_AVCC); init_servos(); LED_on(); neutral(); hold_pos(); while (1) { move_forward(); // sustain_pos(); } return 0; }
bool Chain::insert ( Module *m, Module *n ) { client()->lock(); if ( !m ) { if ( modules() == 0 && n->can_support_inputs( 0 ) >= 0 ) { n->chain( this ); n->configure_inputs( 0 ); modules_pack->add( n ); } else if ( n->can_support_inputs( module( modules() - 1 )->noutputs() ) >= 0 ) { n->chain( this ); n->configure_inputs( module( modules() - 1 )->noutputs() ); modules_pack->add( n ); } else { DMESSAGE( "Module says it can't support %i inputs", module( modules() - 1 )->noutputs() ); goto err; } } else { int i = modules_pack->find( m ); n->chain( this ); if ( 0 == i ) { /* inserting to head of chain*/ if ( n->can_support_inputs( 0 ) >= 0 ) n->configure_inputs( 0 ); else goto err; } else { if ( n->can_support_inputs( module( i - 1 )->noutputs() ) >= 0 ) { n->configure_inputs( module( i - 1 )->noutputs() ); m->configure_inputs( n->noutputs() ); for ( int j = i + 1; j < modules(); ++j ) module( j )->configure_inputs( module( j - 1 )->noutputs() ); } else goto err; } modules_pack->insert( *n, i ); } strip()->handle_module_added( n ); configure_ports(); client()->unlock(); DMESSAGE( "Module \"%s\" has %i:%i audio and %i:%i control ports", n->name(), n->ninputs(), n->noutputs(), n->ncontrol_inputs(), n->ncontrol_outputs() ); n->initialize(); return true; err: client()->unlock(); DMESSAGE( "Insert failed" ); return false; }
void init_device() { configure_ports(); opdi_slave_init(); }
int main(void) { /****************INITIALIZATIONS*******************/ //other stuff Im experimenting with for SoR uartInit(); // initialize the UART (serial port) uartSetBaudRate(0, 9600); // set UARTE speed, for Bluetooth uartSetBaudRate(1, 115200); // set UARTD speed, for USB connection, up to 500k, try 115200 if it uartSetBaudRate(2, 57600); // set UARTH speed uartSetBaudRate(3, 57600); // set UARTJ speed, for Blackfin //G=Ground, T=Tx (connect to external Rx), R=Rx (connect to external Tx) // initialize rprintf system and configure uart1 (USB) for rprintf rprintfInit(uart1SendByte); configure_ports(); // configure which ports are analog, digital, etc. LED_on(); rprintf("\r\nSystem Warming Up"); // initialize the timer system (comment out ones you don't want) init_timer0(TIMER_CLK_1024); init_timer1(TIMER_CLK_64); init_timer2(TIMER2_CLK_64); init_timer3(TIMER_CLK_64); init_timer4(TIMER_CLK_64); init_timer5(TIMER_CLK_1024); //timer5Init(); a2dInit(); // initialize analog to digital converter (ADC) a2dSetPrescaler(ADC_PRESCALE_DIV32); // configure ADC scaling a2dSetReference(ADC_REFERENCE_AVCC); // configure ADC reference voltage int i = 0, j = 0; //let system stabelize for X time for(i=0;i<16;i++) { j=a2dConvert8bit(i);//read each ADC once to get it working accurately delay_cycles(5000); //keep LED on long enough to see Axon reseting rprintf("."); } LED_off(); rprintf("Initialization Complete \r\n"); reset_timer0(); reset_timer1(); reset_timer2(); reset_timer3(); reset_timer4(); reset_timer5(); while(1) { control(); delay_cycles(100); //an optional small delay to prevent crazy oscillations } return 0; }
void prvSetupHardware(){ int i, j; //add 1.7s delay for potential power issues delay_cycles(65535); delay_cycles(65535); delay_cycles(65535); delay_cycles(65535); delay_cycles(65535); delay_cycles(65535); delay_cycles(65535); uartInit(); // initialize the UART (serial port) uartSetBaudRate(0, 38400); // set UARTE speed, for Bluetooth uartSetBaudRate(1, 115200); // set UARTD speed, for USB connection, up to 500k, try 115200 if it doesn't work uartSetBaudRate(2, 38400); // set UARTH speed uartSetBaudRate(3, 38400); // set UARTJ speed, for Blackfin //G=Ground, T=Tx (connect to external Rx), R=Rx (connect to external Tx) rprintfInit(uart1SendByte);// initialize rprintf system and configure uart1 (USB) for rprintf configure_ports(); // configure which ports are analog, digital, etc. LED_on(); //rprintf("\r\nSystem Warmed Up"); // initialize the timer system init_timer0(TIMER_CLK_1024); // init_timer1(TIMER_CLK_64); // Timer 1 is initialized by FreeRTOS init_timer2(TIMER2_CLK_64); init_timer3(TIMER_CLK_64); init_timer4(TIMER_CLK_64); init_timer5(TIMER_CLK_64); a2dInit(); // initialize analog to digital converter (ADC) a2dSetPrescaler(ADC_PRESCALE_DIV32); // configure ADC scaling a2dSetReference(ADC_REFERENCE_AVCC); // configure ADC reference voltage //let system stabelize for X time for(i=0;i<16;i++) { j=a2dConvert8bit(i);//read each ADC once to get it working accurately delay_cycles(5000); //keep LED on long enough to see Axon reseting rprintf("."); } LED_off(); rprintf("Initialization Complete \r\n"); //reset all timers to zero reset_timer0(); reset_timer1(); reset_timer2(); reset_timer3(); reset_timer4(); reset_timer5(); /********PWM Setup***********/ prvPWMSetup(); }