rllib  1
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

◆ DBGPRINTF

#define DBGPRINTF (   x...)

Definition at line 41 of file rldf1.cpp.

Function Documentation

◆ calcCRC()

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

Definition at line 118 of file rldf1.cpp.

119 {
120  unsigned short temp1, y;
121  temp1 = crc ^ buffer;
122  crc = (crc & 0xff00) | (temp1 & 0xff);
123  for (y = 0; y < 8; y++) {
124  if (crc & 1) {
125  crc = crc >> 1;
126  crc ^= 0xa001;
127  } else
128  crc = crc >> 1;
129  }
130  return crc;
131 }

◆ computeCRC()

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

Definition at line 133 of file rldf1.cpp.

134 {
135  unsigned short crc = 0;
136  for (int x=0; x<len; x++) {
137  crc = calcCRC(crc, (unsigned short)buffer[x] );
138  }
139  crc = calcCRC (crc,0x03); // ETX
140  return (crc);
141 }
static unsigned short calcCRC(unsigned short crc, unsigned short buffer)
Definition: rldf1.cpp:118