cdc_rf_task.h File Reference

This file contains the function declarations. More...

#include "config.h"

Include dependency graph for cdc_rf_task.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void sof_action (void)
 sof_action
bit usb_test_hit (void)
 This function checks if a character has been received on the USB bus.
char usb_getchar (void)
 This function reads one byte from the USB bus.
bit usb_tx_ready (void)
 This function checks if the USB emission buffer is ready to accept at at least 1 byte.
int usb_putchar (int)
 This function fills the USB transmit buffer with the new data.
void usb_flush (void)
 This function sends the data stored in the USB transmit buffer.


Detailed Description

This file contains the function declarations.

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

Definition in file cdc_rf_task.h.


Function Documentation

void sof_action (  ) 

sof_action

USB Start Of Frame Interrupt user subroutine, executed each 1ms

Parameters:
none 
Returns:
none

Definition at line 189 of file cdc_rf_task.c.

00190 {
00191 
00192    cpt_sof++;
00193    if(led_tx_flash<=LED_FLASH_DELAY)
00194    {
00195      led_tx_flash++;
00196    }
00197    if(led_tx_flash==LED_FLASH_DELAY)
00198    {
00199       Led1_off();     
00200    }
00201    
00202    if(led_rx_flash<=LED_FLASH_DELAY)
00203    {
00204      led_rx_flash++;
00205    }
00206    if(led_rx_flash==LED_FLASH_DELAY)
00207    {
00208       Led0_off();     
00209    }
00210    
00211 
00212    if(cpt_sof_led++>=RF_LEDS_OFF_DELAY+RF_LEDS_FLASH_DELAY+1) cpt_sof_led=0;
00213    if(cpt_sof_led==RF_LEDS_OFF_DELAY)
00214    {
00215        Led0_on();
00216        Led1_on();
00217    }
00218    if(cpt_sof_led==RF_LEDS_OFF_DELAY+RF_LEDS_FLASH_DELAY)
00219    {
00220        Led0_off();
00221        Led1_off();
00222    }
00223 
00224 }

bit usb_test_hit ( void   ) 

This function checks if a character has been received on the USB bus.

Returns:
bit (true if a byte is ready to be read)

Definition at line 232 of file cdc_rf_task.c.

References Is_usb_receive_out, rx_counter, TX_EP, Usb_ack_receive_out, Usb_byte_counter, and Usb_select_endpoint.

Referenced by cdc_rf_task(), and usb_getchar().

00233 {
00234   if (!rx_counter)
00235   {
00236     Usb_select_endpoint(TX_EP);
00237     if (Is_usb_receive_out())
00238     {
00239       rx_counter = Usb_byte_counter();
00240       if (!rx_counter)
00241       {
00242         Usb_ack_receive_out();
00243       }
00244     }
00245   }
00246   return (rx_counter!=0);
00247 }

Here is the caller graph for this function:

char usb_getchar ( void   ) 

This function reads one byte from the USB bus.

If one byte is present in the USB fifo, this byte is returned. If no data is present in the USB fifo, this function waits for USB data.

Returns:
U8 byte received

Definition at line 257 of file cdc_rf_task.c.

References rx_counter, TX_EP, Usb_ack_receive_out, Usb_read_byte, Usb_select_endpoint, and usb_test_hit().

Referenced by cdc_rf_task().

00258 {
00259   register Uchar data_rx;
00260 
00261   Usb_select_endpoint(TX_EP);
00262   if (!rx_counter) while (!usb_test_hit());
00263   data_rx=Usb_read_byte();
00264   rx_counter--;
00265   if (!rx_counter) Usb_ack_receive_out();
00266   return data_rx;
00267 }

Here is the call graph for this function:

Here is the caller graph for this function:

bit usb_tx_ready ( void   ) 

This function checks if the USB emission buffer is ready to accept at at least 1 byte.

Returns:
Boolean. TRUE if the firmware can write a new byte to transmit.

Definition at line 276 of file cdc_rf_task.c.

References FALSE, Is_usb_write_enabled, and TRUE.

Referenced by usb_putchar().

00277 {
00278   if (!Is_usb_write_enabled())
00279   {
00280     return FALSE;
00281   }
00282   return TRUE;
00283 }

Here is the caller graph for this function:

int usb_putchar ( int  data_to_send  ) 

This function fills the USB transmit buffer with the new data.

This buffer is sent if complete. To flush this buffer before waiting full, launch the rf_usb_flush() function.

Parameters:
data_to_send 
Returns:

Definition at line 294 of file cdc_rf_task.c.

References Is_usb_write_enabled, RX_EP, tx_counter, usb_flush(), Usb_select_endpoint, usb_tx_ready(), and Usb_write_byte.

Referenced by cdc_rf_task().

00295 {
00296    Usb_select_endpoint(RX_EP);
00297    while(!usb_tx_ready()); // Wait Endpoint ready
00298    Usb_write_byte(data_to_send);
00299    tx_counter++;
00300    if(!Is_usb_write_enabled()) //If Endpoint full -> flush
00301      {
00302       usb_flush();
00303      }
00304    return data_to_send;
00305 }

Here is the call graph for this function:

Here is the caller graph for this function:

void usb_flush ( void   ) 

This function sends the data stored in the USB transmit buffer.

This function does nothing if there is no data in the buffer.

Definition at line 312 of file cdc_rf_task.c.

References RX_EP, tx_counter, Usb_select_endpoint, and Usb_send_in.

Referenced by cdc_rf_task(), and usb_putchar().

00313 {
00314    Usb_select_endpoint(RX_EP);
00315    Usb_send_in();
00316    tx_counter = 0;
00317 }

Here is the caller graph for this function:


Generated on Mon May 5 15:58:00 2008 for ATMEL by  doxygen 1.5.1-p1