I am trying to make a library but cant seem to solve this error? Can anyone see what I have done wrong?
Sketch
#include <CRC32.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
Serial.print("Begin");
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(Crc.version());
}
CRC32.H
#ifndef CRC32_h
#define CRC32_h
#include "Arduino.h"
class Crc{
public:
int version(void);
unsigned long calc(unsigned char message);
};
#endif
CRC32.cpp
#include "CRC32.h"
#include "Arduino.h"
// ----------------------------- crc32b --------------------------------
/* This is the basic CRC-32 calculation with some optimization but no
table lookup. The the byte reversal is avoided by shifting the crc reg
right instead of left and by using a reversed 32-bit word to represent
the polynomial.
When compiled to Cyclops with GCC, this function executes in 8 + 72n
instructions, where n is the number of bytes in the input message. It
should be doable in 4 + 61n instructions.
If the inner loop is strung out (approx. 5*8 = 40 instructions),
it would take about 6 + 46n instructions. */
int Crc::version(void){
return 1;
}
void Crc32::calc(unsigned char message) {
Serial.print(message);
int i, j;
unsigned long Byte, crc, mask;
i = 0;
crc = 0xFFFFFFFF;
while (message[i] != 0) {
Byte = message[i]; // Get next byte.
Serial.println(message[i],HEX);
crc = crc ^ Byte;
for (j = 7; j >= 0; j--) { // Do eight times.
mask = -(crc & 1);
crc = (crc >> 1) ^ (0xEDB88320 & mask);
}
i = i + 1;
}
return ~crc;
}