示例#1
0
void run()
{
	setup_hardware();
	current_state.current_screen->draw();
	set_as_input(DDRC, 5);
	set_as_input(DDRC, 4);
	set_as_input(DDRC, 3);
	forever
	{
		struct event_t e;
		if(NOTHING_HAPPENED != poll_hardware(&e) && e.emitter != NOTHING_HAPPENED)
		{
			if(current_state.current_screen->event_handler != NULL)
			{
				switch(current_state.current_screen->event_handler(&e))
				{
					case SIGNAL_REDRAW:
					{
						current_state.current_screen->draw();
						break;
					}
					
					default:
					{
						
					}
				}
			}
			
			global_event_handler(&e);
		}
	}
}
示例#2
0
int main( void )	{
	setup_hardware();				// @"../../hardware/hardware.h"
	
	init_led_utama();
	init_hardware();

	vTaskStartScheduler();

	printf("Keluar dari Scheduler !!!!\r\n");
    /* Will only get here if there was insufficient memory to create the idle task. */
	return 0;

}
示例#3
0
int main(void)
{
    setup_hardware();
    setup_set_handedness();
    sei();

    /* wait for USB startup to get ready for debug output */
    uint8_t timeout = 200;  // timeout when USB is not available
    while (timeout-- && USB_DeviceState != DEVICE_STATE_Configured) {
        wait_ms(5);
#if defined(INTERRUPT_CONTROL_ENDPOINT)
        ;
#else
        USB_USBTask();
#endif
    }

    /* if (USB_DeviceState != DEVICE_STATE_Configured) { */
    if (!has_usb()) {
        // USB failed to connect, so run this device in slave mode.
        matrix_init();
        serial_slave_init();

        while (1) {
            matrix_slave_scan();
        }
    }

    /* init modules */
    keyboard_init();
    host_set_driver(&lufa_driver);

#ifdef SLEEP_LED_ENABLE
    sleep_led_init();
#endif

    while (1) {
        keyboard_task();

#if !defined(INTERRUPT_CONTROL_ENDPOINT)
        USB_USBTask();
#endif
    }
}
示例#4
0
static portTASK_FUNCTION(task_led2, pvParameters )	{
	static char tog = 0;
	loop_idle = 0;
	idle_lama = 0;
	for (;;)	{
		
		#ifdef PAKAI_MODE_POWER
		if (status_power()>0)	{
			vTaskSuspend( hdl_kirimcepat );
			vTaskSuspend( hdl_ambilcepat );
			vTaskSuspend( hdl_shell );

			setup_hardware();
			xSerialPortInitMinimal(BAUD_RATE_SHELL, configMINIMAL_STACK_SIZE);
			
			vTaskDelay(200);
			
			vTaskResume( hdl_kirimcepat );
			vTaskResume( hdl_ambilcepat );
			//vTaskResume( hdl_shell );
			
			
			flagRTCc = 0;
			set_power_rtc(0);
			printf("  kembali normal.... !!\r\n");
		}
		#endif
		
		togle_led_utama(tog=1-tog);
		cek_tik();
		
		#ifdef PAKAI_PUSHBUTTON
			kurangi_delay_push();
		#endif
		
		vTaskDelay(500);
		//printf(" - Tanggal   : %d-%d-%d\r\n", infoGPS.utc.day, infoGPS.utc.mon, infoGPS.utc.year);
	}
}
示例#5
0
文件: bluebox.c 项目: johandc/bluebox
int main(void)
{
	setup_hardware();
	GlobalInterruptEnable();

	callsign_init(conf.callsign);

	flash_leds();

	adf_set_power_on(XTAL_FREQ);
	adf_configure();
	adf_set_rx_mode();

	swd_init();
	swd_enable();

	while (1) {
		conf_task();
		rx_task();
		tx_task();
		USB_USBTask();
	}
}
示例#6
0
int
main(int ac, char**av)
{
        int retValue = 0;

        bool option_test_leds = false;
        bool option_test_cnc = false;
        bool option_test_cnc_pulse = false;
        bool option_run_assembler_file = false;

        // Default frequency
        char* frequency = "1";
        char* fileName = NULL;

        if (ac == 1) {
  	    usage();
            return 1;
        }

        if (strcmp("test_leds", av[1]) == 0) {
	  option_test_leds = true;
        } 
	else if (strcmp("test_cnc", av[1]) == 0) {
	  option_test_cnc = true;
	}
	else if (strcmp("test_cnc_pulse", av[1]) == 0) {
          if (ac >= 3) {
	      frequency = av[2];
          }
	  option_test_cnc_pulse = true;

          printf("test_cnc_pulse: using frequency=%s\n", frequency);
	}
	else if (strcmp("run_assembler_file", av[1]) == 0) {
          if (ac >= 3) {
	      fileName = av[2];
          }
	  option_run_assembler_file = true;

          printf("run_assembler_file %s\n", fileName);
	}
	else {
  	    printf("menlo_cnc_app [test_leds] | [test_cnc] [test_cnc_pulse] [frequency]\n");
            return 1;
	}

        // Setup the hardware
        setup_hardware();

        if (option_test_leds) {
            retValue = test_leds(ledpio_base_address);
        }

        if (option_test_cnc) {
            retValue = test_menlo_cnc(menlo_cnc_registers_base_address);
        }

        if (option_test_cnc_pulse) {
	   retValue = test_menlo_cnc_pulse(menlo_cnc_registers_base_address, frequency);
        }

        if (option_run_assembler_file) {
	   retValue = run_assembler_file(menlo_cnc_registers_base_address, fileName);
        }

        close_hardware();

	return( retValue );
}
示例#7
0
文件: main.c 项目: RuinaLab/Ranger
void init(void)
{
  setup_hardware(); 
  setup_software();
}
示例#8
0
文件: main.c 项目: SickSad/DeltaRobot
void setup(){
    setup_hardware();
}