hid_example.c File Reference


Detailed Description

Main file of the USB HID example.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file hid_example.c.

#include <stdio.h>
#include "compiler.h"
#include "board.h"
#include "print_funcs.h"
#include "intc.h"
#include "power_clocks_lib.h"
#include "FreeRTOS.h"
#include "task.h"
#include "conf_usb.h"
#include "usb_task.h"
#include "device_mouse_hid_task.h"
#include "host_mouse_hid_task.h"
#include "hid_example.h"

Go to the source code of this file.

Functions

int main (void)
 Main function. Execution starts here.

Variables

System Clock Frequencies
static pcl_freq_param_t pcl_freq_param


Function Documentation

int main ( void   ) 

Main function. Execution starts here.

Return values:
42 Fatal error.

Definition at line 244 of file hid_example.c.

References device_mouse_hid_task(), device_mouse_hid_task_init(), host_mouse_hid_task(), host_mouse_hid_task_init(), and pcl_freq_param.

00245 {
00246   // Configure system clocks.
00247   if (pcl_configure_clocks(&pcl_freq_param) != PASS)
00248     return 42;
00249 
00250   // Initialize USB clock (on PLL1)
00251   pcl_configure_usb_clock();
00252 
00253   // Initialize usart comm
00254   init_dbg_rs232(pcl_freq_param.pba_f);
00255 
00256   // Initialize USB task
00257   usb_task_init();
00258 
00259 #if USB_DEVICE_FEATURE == ENABLED
00260   // Initialize device mouse USB task
00261   device_mouse_hid_task_init();
00262 #endif
00263 #if USB_HOST_FEATURE == ENABLED
00264   //host_keyboard_hid_task_init();
00265 
00266   // Initialize host mouse USB task
00267   host_mouse_hid_task_init();
00268 #endif
00269 
00270 #ifdef FREERTOS_USED
00271   // Start OS scheduler
00272   vTaskStartScheduler();
00273   portDBG_TRACE("FreeRTOS returned.");
00274   return 42;
00275 #else
00276   // No OS here. Need to call each task in round-robin mode.
00277   while (TRUE)
00278   {
00279     usb_task();
00280   #if USB_DEVICE_FEATURE == ENABLED
00281     device_mouse_hid_task();
00282   #endif
00283   #if USB_HOST_FEATURE == ENABLED
00284     //host_keyboard_hid_task();
00285     host_mouse_hid_task();
00286   #endif
00287   }
00288 #endif  // FREERTOS_USED
00289 }


Variable Documentation

pcl_freq_param_t pcl_freq_param [static]

Initial value:

{
  .cpu_f        = FCPU_HZ,
  .pba_f        = FPBA_HZ,
  .osc0_f       = FOSC0,
  .osc0_startup = OSC0_STARTUP
}

Definition at line 165 of file hid_example.c.

Referenced by main().


Generated on Fri Feb 19 02:33:00 2010 for AVR32 - USB HID FreeRTOS Example by  doxygen 1.5.5