rllib  1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Macros | Functions
rldf1.cpp File Reference
#include "rldf1.h"
#include <time.h>
Include dependency graph for rldf1.cpp:

Go to the source code of this file.

Classes

class  df1Buffer
 

Macros

#define DBGPRINTF(x...)
 

Functions

static unsigned short calcCRC (unsigned short crc, unsigned short buffer)
 
static unsigned short computeCRC (const unsigned char *buffer, int len)
 

Macro Definition Documentation

#define DBGPRINTF (   x...)

Definition at line 41 of file rldf1.cpp.

Function Documentation

static unsigned short calcCRC ( unsigned short  crc,
unsigned short  buffer 
)
static

Definition at line 118 of file rldf1.cpp.

{
unsigned short temp1, y;
temp1 = crc ^ buffer;
crc = (crc & 0xff00) | (temp1 & 0xff);
for (y = 0; y < 8; y++) {
if (crc & 1) {
crc = crc >> 1;
crc ^= 0xa001;
} else
crc = crc >> 1;
}
return crc;
}
static unsigned short computeCRC ( const unsigned char *  buffer,
int  len 
)
static

Definition at line 133 of file rldf1.cpp.

{
unsigned short crc = 0;
for (int x=0; x<len; x++) {
crc = calcCRC(crc, (unsigned short)buffer[x] );
}
crc = calcCRC (crc,0x03); // ETX
return (crc);
}