Example #1
0
void start_power() {
	int i;
	int inds[NUM_PWR_CHANNELS];	

	// initialize meter settings
	init_power(); 

	// create worker threads for all meters
	for (i = 0; i < NUM_PWR_CHANNELS; i++) {
		int exit;
		inds[i] = i;
		exit = pthread_create(&threads[i], NULL, read_power, (void *) &inds[i]);
		error_message("- POWER: created power thread #%d with return code %d\n", 
			i, exit);
	}

	// wait for all threads to be running
	int running = 0;
	while(!running) {
		running = 1;
		for (i = 0; i < NUM_PWR_CHANNELS; i++) {
			if (states[i] == INIT) running = 0;
		}		
	}
}
Example #2
0
int main(void)
{
	DDRC |= (1 << DDRC7);
	PORTC |= (1 << PORTC7);
	_delay_ms(2);
	PORTC &= ~(1 << PORTC7);
	
 	init_power();
 	init_timeout_timer();
	init_switch();
	init_ref_clock();
	init_spi(2);
	init_buttons();
	init_serial(2400);
	init_adc();
	init_i2c();
	//Turn on interrupts
	sei();
	play_sounds();
	//Debug: Never Gets here
    while(1)
    {
		_delay_ms(1000);
		get_POT_set_TWIPOT();
	}
}
Example #3
0
int main (void) {
    long i;

    init_timer(&data[6], &data[0]);
    init_power();
    play_system_sound(0x4003, 1);

    clear_display();

    for (i = -5; i <= 5; i++) {
	set_lcd_number(LCD_SIGNED, i % 5, LCD_DECIMAL_0);
	refresh_display();
	wait_release();
	wait_press();
    }

    for (i = -5; i <= 5; i++) {
	set_lcd_number(LCD_SIGNED, i % -5, LCD_DECIMAL_0);
	refresh_display();
	wait_release();
	wait_press();
    }

    shutdown_timer();

    return 0;
}
Example #4
0
int main (void) {
    char playing;

    while (1) {
	init_timer(&data[6], &data[0]);
	init_power();

	set_lcd_segment(0x3020);
	refresh_display();

	play_system_sound(0x4003, 1);

	wait_release();
	wait_press();

	play_system_sound(0x4003, 0);

	do {
	    get_sound_playing_flag(0x700c, &playing);
	} while (playing);

	clear_display();
	refresh_display();

	shutdown_timer();
	shutdown_power();
    }
    return 0;
}
Example #5
0
/* Initialisation */
void rcx_init (void) {
    init_timer(&async, &dispatch[0]);
    init_power();
    systime_init();
    init_sensors();
    //init_motors
    init_buttons(); // Buttons & display pins
    init_serial(0, 0, 1, 1);
}
Example #6
0
int main (void) {
    char playing;

    init_timer(&async, &dispatch[0]);
    init_power();

    set_lcd_segment(0x3020);
    refresh_display();

    play_system_sound(0x4003, 1);

    do {
	get_sound_playing_flag(0x700c, &playing);
    } while (playing);

    shutdown_timer();

    return 0;
}
Example #7
0
int main (void) {
    char playing;
    short count = -10;
    int count2 = 0;
    int sound = 0;
    int i, j;
    unsigned char op = 0;
    char code;

    while (1) {
	init_timer(&data[6], &data[0]);
	init_power();
	play_system_sound(0x4003, 1);

#if 1
	init_buttons();
	clear_display();
#endif


#if 0
	*((volatile void **)0xfda2) = motor_control;
	while (1);
#endif

#if 0
	while (1) {
	    for (j = 0; j < 100; j++) {
		percent=j;
		set_lcd_number(0x3001, j, 0x3002);
		refresh_display();
		for (i = 0; i < 1000; i++);
	    }
	}
#endif

#if 0
	while (1) {
	    int i;

	    *((short *)0xc000) = 0x0;
#if 0
	    count2 += *((short *)0xfb7f);
#endif
	    for (i = 0; i < 1000; i++) {
		count++;
	    }
	}
#endif

#if 0
	while (1) {
	    set_lcd_number(0x3017, count, 0x3002);
	    refresh_display();
	    count ++;
#if 1
	    wait_release();
	    wait_press();
#endif
	}
#endif

#if 1
	count = 1;
	while (1) {
	    set_lcd_number(0x301f, count, 0x3002);
	    refresh_display();
	    count ++;
	    wait_release();
	    wait_press();
	}
#endif

#if 0
	set_lcd_number(0x301f, 0xffff, 0x3002);
	refresh_display();
	wait_release();
	wait_press();
	break;
#endif

#if 0
	play_system_sound(0x4003, 0);

	do {
	    get_sound_playing_flag(0x700c, &playing);
	} while (playing);
	
	clear_display();
	refresh_display();
	shutdown_power();
#endif

    }

    return 0;
}