cdc_task.c File Reference

,vThis file manages the CDC task. More...

#include "config.h"
#include "conf_usb.h"
#include "cdc_task.h"
#include "lib_mcu\usb\usb_drv.h"
#include "usb_descriptors.h"
#include "modules\usb\device_chap9\usb_standard_request.h"
#include "usb_specific_request.h"
#include "lib_mcu/uart/uart_lib.h"
#include "uart_usb_lib.h"
#include <stdio.h>

Include dependency graph for cdc_task.c:

Go to the source code of this file.

Functions

void cdc_task_init (void)
 This function initializes the hardware ressources required for CDC demo.
void cdc_task (void)
 Entry point of the uart cdc management.
void sof_action ()
 sof_action

Variables

volatile U8 cpt_sof
U8 rx_counter
U8 tx_counter
S_line_coding line_coding


Detailed Description

,vThis file manages the CDC task.

Copyright (c) 2004 Atmel.

Please read file license.txt for copyright notice.

Version:
1.2 at90usb162-cdc-1_0_1
Id
cdc_task.c,v 1.2 2007/01/08 16:10:58 arobert Exp
Todo:
Bug:
/

Definition in file cdc_task.c.


Function Documentation

void cdc_task_init ( void   ) 

This function initializes the hardware ressources required for CDC demo.

Parameters:
none 
Returns:
none
/

Definition at line 56 of file cdc_task.c.

References Hwb_button_init, Joy_init, Leds_init, uart_init(), uart_usb_getchar(), uart_usb_putchar, and Usb_enable_sof_interrupt.

00057 {
00058    uart_init();
00059    Leds_init();
00060    Joy_init();
00061    Hwb_button_init();
00062    Usb_enable_sof_interrupt();
00063 #ifdef AVRGCC
00064    fdevopen(uart_usb_putchar,uart_usb_getchar); //for printf redirection 
00065 #endif
00066 }

Here is the call graph for this function:

void cdc_task ( void   ) 

Entry point of the uart cdc management.

This function links the uart and the USB bus.

Parameters:
none 
Returns:
none

Definition at line 77 of file cdc_task.c.

References cpt_sof, Is_device_enumerated, Is_hwb, Is_joy_down, Is_joy_left, Is_joy_right, Is_joy_select, Is_joy_up, Led0_toggle, Led3_toggle, NB_MS_BEFORE_FLUSH, REPEAT_KEY_PRESSED, rx_counter, tx_counter, uart_getchar(), uart_putchar(), uart_test_hit(), Uart_tx_ready, uart_usb_flush(), uart_usb_getchar(), uart_usb_putchar, and uart_usb_test_hit().

00078 {
00079    if(Is_device_enumerated()) //Enumeration processs OK ?
00080    {
00081       if(cpt_sof>=NB_MS_BEFORE_FLUSH && tx_counter!=0 )  //Flush buffer in Timeout
00082       {
00083          cpt_sof=0;
00084          uart_usb_flush();
00085       }
00086       
00087       if (uart_test_hit())    //Something on USART ?
00088       {
00089          uart_usb_putchar(uart_getchar());   // Loop back, USART to USB
00090          Led0_toggle();
00091       }
00092    
00093       if (Uart_tx_ready())    //USART free ?
00094       {
00095          if (uart_usb_test_hit())   // Something received from the USB ?
00096          {
00097             while (rx_counter)
00098             {
00099                uart_putchar(uart_usb_getchar());   // loop back USB to USART
00100                Led3_toggle();
00101             }
00102          }
00103       }
00104 
00105       if ( cpt_sof>=REPEAT_KEY_PRESSED)   //Debounce joystick events
00106       {
00107          if (Is_joy_select())
00108          printf ("Select Pressed !\r\n");
00109 
00110          if (Is_joy_right())
00111          printf ("Right Pressed !\r\n");
00112    
00113          if (Is_joy_left())
00114          printf ("Left Pressed !\r\n");
00115 
00116          if (Is_joy_down())
00117          printf ("Down Pressed !\r\n");
00118 
00119          if (Is_joy_up())
00120          printf ("Up Pressed !\r\n");
00121 
00122          if(Is_hwb())
00123          printf("Hello from AT90USBXXX !\r\n");
00124       }
00125    }
00126 }

Here is the call graph for this function:


Variable Documentation

volatile U8 cpt_sof

Definition at line 42 of file cdc_task.c.

Referenced by cdc_task(), and sof_action().

U8 rx_counter

Definition at line 26 of file uart_usb_lib.c.

Referenced by cdc_task(), uart_usb_getchar(), uart_usb_init(), and uart_usb_test_hit().

U8 tx_counter

Definition at line 25 of file uart_usb_lib.c.

Referenced by cdc_task(), putchar(), uart_usb_flush(), and uart_usb_init().

S_line_coding line_coding

Definition at line 45 of file cdc_task.c.

Referenced by cdc_get_line_coding(), and cdc_set_line_coding().


Generated on Fri Jun 15 14:15:34 2007 for Atmel by  doxygen 1.5.1-p1