Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCan Geliş <geliscan@gmail.com>2017-08-01 12:04:34 +0300
committerdc42 <dcrocker@eschertech.com>2017-08-01 12:04:34 +0300
commit3247390f323c07d5c834b206103397f295a95378 (patch)
tree1a0a2e81a6d59287a377450abf0917af04422bad /src/Storage/CRC32.h
parent74890fbe742c1e4a96f862174260767d0b7daad2 (diff)
Support for binary write for M559 and M560 (#125)
* Support for binary write M560 and M559 now supports binary uploads. Size in bytes of the file can be supplied to the GCode with S parameter to indicate end of file otherwise upload will continue until the EOF is encountered. M560 writes www folder by default M559 writes sys folder by default Default folders can be changed by supplying the absolute path of the file. For example: M560 P/sys/firmware.bin * code refactoring * CRC32 checksum verification for binary uploads In this implementation CRC32 checksum should be supplied with "C" parameter with 0x prefix. Example: M559 C0xabcdef Ptest.bin S123 * code refactoring
Diffstat (limited to 'src/Storage/CRC32.h')
-rw-r--r--src/Storage/CRC32.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Storage/CRC32.h b/src/Storage/CRC32.h
new file mode 100644
index 00000000..06bcfe13
--- /dev/null
+++ b/src/Storage/CRC32.h
@@ -0,0 +1,27 @@
+#ifndef CRC32_H
+#define CRC32_H
+
+#include <cstdint> // for uint32_t
+#include <cstddef> // for size_t
+
+class CRC32
+{
+private:
+ static const uint32_t CRC_32_TAB[];
+ uint32_t crc;
+
+public:
+ CRC32();
+ void Update(char c);
+ void Update(const char *c, size_t len);
+ void Reset();
+ uint32_t Get() const;
+
+};
+
+inline uint32_t CRC32::Get() const
+{
+ return ~crc;
+}
+
+#endif \ No newline at end of file