Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

user_application.c File Reference

#include "config.h"
#include "user_application.h"
#include "\conf\board.h"
#include "modules\usb\usb_task.h"
#include "lib_mcu\usb\usb_drv.h"
#include "modules\usb_hid_generic_api\usb_hid_generic_api.h"

Go to the source code of this file.

Functions

void user_application_task_init (void)
void user_application_task (void)

Variables

U8 data_received [LENGTH_OF_REPORT]
U8 data_to_send [LENGTH_OF_REPORT]
U8 state = 0
U8 send_free
U8 Continuous_Mode
Union16 idata scan_key
U8 key_hit
U8 transmit_no_key
U8 usb_configuration_nb
bit reset_to_bootloader
bit last_INT0_button_state = 1


Function Documentation

void user_application_task_init void   ) 
 

Definition at line 52 of file user_application.c.

References Configure_led, data_to_send, Led_all_off, LED_PORT_10MA, LENGTH_OF_REPORT, and U8.

00053 { 00054 U8 c; 00055 Configure_led(0,LED_PORT_10MA); 00056 Configure_led(1,LED_PORT_10MA); 00057 Configure_led(2,LED_PORT_10MA); 00058 Configure_led(3,LED_PORT_10MA); 00059 Led_all_off(); 00060 for (c=0; c< LENGTH_OF_REPORT; c++) 00061 { 00062 data_to_send[c] = 0; 00063 } 00064 }

void user_application_task void   ) 
 

Definition at line 81 of file user_application.c.

References __API_JMP_BOOTLOADER, Configure_led, data_received, data_to_send, Enable_ale, INT0_button, Is_new_data_read, Is_write_data_ready, last_INT0_button_state, Led_0_off, Led_0_on, Led_1_off, Led_1_on, Led_2_off, Led_2_on, Led_3_off, Led_3_on, Led_all_off, MAP_BOOT, Pll_stop, reset_to_bootloader, STANDARD_PORT, TRUE, Usb_detach, Usb_disable, usb_read_continuous(), and usb_write_continuous().

00082 { 00083 if(Is_new_data_read()) 00084 { 00085 usb_read_continuous(data_received); 00086 00087 if((data_received[0]=='1')&&(data_received[1]=='1')) 00088 Led_0_on(); 00089 00090 if((data_received[0]=='0')&&(data_received[1]=='1')) 00091 Led_0_off(); 00092 00093 if((data_received[0]=='1')&&(data_received[1]=='2')) 00094 Led_1_on(); 00095 00096 if((data_received[0]=='0')&&(data_received[1]=='2')) 00097 Led_1_off(); 00098 00099 if((data_received[0]=='1')&&(data_received[1]=='3')) 00100 Led_2_on(); 00101 00102 if((data_received[0]=='0')&&(data_received[1]=='3')) 00103 Led_2_off(); 00104 00105 if((data_received[0]=='1')&&(data_received[1]=='4')) 00106 Led_3_on(); 00107 00108 if((data_received[0]=='0')&&(data_received[1]=='4')) 00109 Led_3_off(); 00110 } 00111 00112 00113 00114 if (INT0_button != last_INT0_button_state) // INT0 button pressed 00115 { 00116 if (Is_write_data_ready()) 00117 { 00118 data_to_send[0] = !INT0_button; 00119 usb_write_continuous(data_to_send, 1); 00120 last_INT0_button_state = INT0_button; 00121 } 00122 } 00123 00124 00125 if (reset_to_bootloader == TRUE) 00126 { 00127 Usb_detach(); 00128 Led_all_off(); 00129 Enable_ale(); 00130 Configure_led(0,STANDARD_PORT); 00131 Configure_led(1,STANDARD_PORT); 00132 Configure_led(2,STANDARD_PORT); 00133 Configure_led(3,STANDARD_PORT); 00134 for (data_received[0]=0; data_received[0]<250; data_received[0]++); 00135 Usb_disable(); 00136 Pll_stop(); 00137 EA = 0; 00138 MAP_BOOT; 00139 __API_JMP_BOOTLOADER(); 00140 } 00141 }


Variable Documentation

U8 data_received[LENGTH_OF_REPORT]
 

Definition at line 21 of file user_application.c.

Referenced by user_application_task().

U8 data_to_send[LENGTH_OF_REPORT]
 

Definition at line 22 of file user_application.c.

Referenced by user_application_task(), and user_application_task_init().

U8 state = 0
 

Definition at line 23 of file user_application.c.

U8 send_free
 

Definition at line 24 of file user_application.c.

Referenced by usb_task(), usb_user_endpoint_init(), and usb_write_continuous().

U8 Continuous_Mode
 

Definition at line 25 of file user_application.c.

Union16 idata scan_key
 

Definition at line 26 of file user_application.c.

U8 key_hit
 

Definition at line 27 of file user_application.c.

U8 transmit_no_key
 

Definition at line 28 of file user_application.c.

U8 usb_configuration_nb
 

Definition at line 29 of file user_application.c.

Referenced by usb_enum_var_init(), usb_get_configuration(), usb_read_continuous(), usb_set_configuration(), and usb_write_continuous().

bit reset_to_bootloader
 

Definition at line 30 of file user_application.c.

bit last_INT0_button_state = 1
 

Definition at line 32 of file user_application.c.

Referenced by user_application_task().


Generated on Mon Apr 10 17:23:31 2006 for Atmel by doxygen 1.3.7