AVR Z-LINKŪ


crc16.c

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00050 /*============================ INCLUDE =======================================*/
00051 #if defined( __ICCAVR__ ) || defined( DOXYGEN )
00052 
00053 #include <stdint.h>
00054 #include <stdbool.h>
00055 
00056 #include "compiler.h"
00057 
00058 /*============================ MACROS ========================================*/
00059 /*============================ TYPDEFS =======================================*/
00060 /*============================ PROTOTYPES ====================================*/
00061 /*============================ IMPLEMENTATION ================================*/
00062 
00063 /* Only needed for the IAR as avr-libc has an inlined implementation. */
00064 
00074 uint16_t crc_ccitt_update( uint16_t crc, uint8_t data )
00075 {
00076     data ^= crc & 0xFF;
00077     data ^= data << 4;
00078     
00079     uint16_t ret_val = ((((uint16_t)data << 8) | ((crc & 0xFF00) >> 8))
00080                         ^ (uint8_t)(data >> 4)
00081                         ^ ((uint16_t)data << 3));
00082     return ret_val;
00083 }
00084 
00085 #endif /* __ICCAVR__ || defined(DOXYGEN) */
00086 /* EOF */
@DOC_TITLE@
Generated on Wed Jul 11 18:16:31 2007 for AVR2001 AT86RF230 Software Programmer's Manual by doxygen 1.4.7