예제 #1
0
파일: demo.c 프로젝트: kerichsen/asf
int main(void)
{
  init_sys_clocks();

  init_dbg_rs232(FPBA_HZ);

  print_dbg("AVR UC3 DSP DEMO\r\n");

  irq_initialize_vectors();

  // GUI, Controller and DSP process init
  gui_init(FCPU_HZ, FHSB_HZ, FPBA_HZ, FPBB_HZ);
  gui_text_print(GUI_COMMENT_ID, TEXT_IDLE);
  gui_text_print(GUI_FILTER_ID, filter_active_get_description());
  controller_init(FCPU_HZ, FHSB_HZ, FPBA_HZ, FPBB_HZ);
  twi_init();
  dsp_process_init(FCPU_HZ, FHSB_HZ, FPBA_HZ, FPBB_HZ);

  cpu_irq_enable();

  // Main loop
  while (1)
  {
    gui_task();
    controller_task();
    dsp_process_task();
    state_machine_task();
  }
}
예제 #2
0
파일: main.c 프로젝트: Mazetti/asf
/*! \brief Main File Section:
 *          - Initialization (CPU, Controller Task,... )
 *          - Main loop with task management (ADC, DAC, CAN and GUI)
 */
int main(void)
{
	irq_initialize_vectors();

	/* Initialize the board.
	 * The board-specific conf_board.h file contains the configuration of
	 * the board initialization.
	 */
	board_init();

	/* Initialize the clocks.
	 * The clock-specific conf_clocks.h file contains the configuration of
	 * the clocks initialization.
	 */
	sysclk_init();

	// Initialize the sleep manager
	sleepmgr_init();
	sleepmgr_lock_mode(SLEEPMGR_IDLE);

        /* Initialize the required Task.
	 * - Initialize the DAC task to start the signal generator,
	 * - Initialize the ADC task to start the scope acquisition,
	 * - Initialize the Noise Task to add digital noise to the signal,
	 * - Initialize the Filter Task to remove the digital noise of the signal,
	 * - Initialize the GUI Task to display signals as a scope on the LCD,
	 * - Initialize the Remote Task to display signals as a scope on the LCD,
	 */
	dac_task_init();
	adc_task_init();
	noise_task_init();
	filter_task_init();
	gui_task_init();
	controller_task_init();
	remote_task_init();

	cpu_irq_enable();

	// Free running scheduler loop
	while (true) {
		// Enter Sleep Mode
		sleepmgr_enter_sleep();
		// Call ADC task
		adc_task();
		// Call DAC task
		dac_task();
		// Call Noise task
		noise_task();
		// Filter Task
		filter_task();
		// Call Gui task for update
		gui_task();
		// Call Controller Task for control Update
		controller_task();
		// Send data to the PC Application
		remote_task();
	}
}
예제 #3
0
파일: comm.c 프로젝트: samjacoby/avr
void loop() {

    controller_task();

    /*
    sensor_read(32);
    fetch_sensor_read(&inphase, &quad);
    if(inphase != quad) {
            PORTB ^= _BV(PIN4);
            PORTB ^= _BV(PIN4);
        }
    controller_set_val(inphase, quad);
    */
}
예제 #4
0
파일: main.c 프로젝트: Mazetti/asf
/*!
 * \brief init function : do init and loop (poll if configured so)
 */
static int app_engine(void)
{

	// configure GUI
	gui_init(CPU_CLK_FREQ(),CPU_CLK_FREQ(),CPU_CLK_FREQ(),PBA_CLK_FREQ());

	// configure controller
	controller_init(CPU_CLK_FREQ(),CPU_CLK_FREQ(),CPU_CLK_FREQ(),
		PBA_CLK_FREQ());

	// initializes t2BF
	AppEngineInit( gui_callback, "Atmel Spp Lite" );

	/* do a loop */
	while (true) {
		OSTimeDlyHMSM(0, 0, 0, 200);

		controller_task();

		if (controller_inquiry() == true) {
			AppEngineInquiryButton( );
		}
		else if (controller_select() == true) {
			AppEngineSelectDeviceButton( );
		}
		else if (controller_connect() == true) {
			AppEngineConnectButton( );
		}
		else if (controller_send() == true) {
			AppEngineJoystickButton( AppEngine_Left );
		}

		if (display) {
			OSTimeDlyHMSM(0, 0, 0, 200);
			// A delay so that it is humanly possible to see the
			OSTimeDlyHMSM(0, 0, 0, 200);
			// character(s) before they are cleared
			display = 0;
		}
	}
}