can_task.h File Reference


Detailed Description

CAN Task.

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

Definition in file can_task.h.

Go to the source code of this file.

Functions

void can_task (void)
 CAN Task:
  • Check if messages are correctly transmitted/received
  • Update message for transmission/reception.

void can_task_init (void)


Function Documentation

void can_task ( void   ) 

CAN Task:

  • Check if messages are correctly transmitted/received
  • Update message for transmission/reception.

Definition at line 134 of file can_task.c.

References BUFFER_LENGTH, can_example_prepare_data_to_receive(), can_example_prepare_data_to_send(), message_received_on_channel0, message_transmitted_on_channel1, pCANMOB_message2, and signal3_buf.

Referenced by main().

00135 {
00136 int i;
00137 int value;
00138     if (message_transmitted_on_channel1 == true)
00139     {
00140         message_transmitted_on_channel1 = false;
00141         if (message_received_on_channel0 == true)
00142         {
00143           message_received_on_channel0 = false;
00144           for (i=BUFFER_LENGTH-1;i>=1;i--)
00145           {
00146               signal3_buf[i] = signal3_buf[i-1];
00147           }
00148           value = (pCANMOB_message2[0].can_msg->data.u8[0]<<8)|(pCANMOB_message2[0].can_msg->data.u8[1]);
00149           signal3_buf[0] = ( value*0x20) - 0x8000;
00150           can_example_prepare_data_to_receive();
00151           can_example_prepare_data_to_send();
00152         }
00153     }
00154 }

void can_task_init ( void   ) 

Definition at line 105 of file can_task.c.

References can_example_prepare_data_to_receive(), and can_example_prepare_data_to_send().

Referenced by main().

00106 {
00107   // Setup the generic clock for CAN
00108   scif_gc_setup(AVR32_SCIF_GCLK_CANIF,
00109                 SCIF_GCCTRL_OSC0,
00110                 AVR32_SCIF_GC_NO_DIV_CLOCK,
00111                 0);
00112   // Now enable the generic clock
00113   scif_gc_enable(AVR32_SCIF_GCLK_CANIF);
00114 
00115   static const gpio_map_t CAN_GPIO_MAP =
00116   {
00117     {AVR32_CANIF_RXLINE_0_0_PIN, AVR32_CANIF_RXLINE_0_0_FUNCTION},
00118     {AVR32_CANIF_TXLINE_0_0_PIN, AVR32_CANIF_TXLINE_0_0_FUNCTION},
00119     {AVR32_CANIF_RXLINE_1_2_PIN, AVR32_CANIF_RXLINE_1_2_FUNCTION},
00120     {AVR32_CANIF_TXLINE_1_2_PIN, AVR32_CANIF_TXLINE_1_2_FUNCTION}
00121   };
00122   // Assign GPIO to CAN.
00123   gpio_enable_module(CAN_GPIO_MAP,
00124                      sizeof(CAN_GPIO_MAP) / sizeof(CAN_GPIO_MAP[0]));
00125 
00126   can_example_prepare_data_to_receive();
00127   can_example_prepare_data_to_send();
00128 }


Generated on Fri Feb 19 02:22:37 2010 for AVR32 - CAN LIN LOOPBACKS Demo. by  doxygen 1.5.5