pwm period is now 200us instead of the default 20ms veml6040 config is now AF_BIT | TRIG_BIT

Dependencies:   mbed MMA8451Q USBDevice WakeUp vt100

Fork of afero_node_suntory_2017_06_15 by Orefatoi

Revision:
0:20bce0dcc921
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/CheckSum.cpp	Tue Dec 20 01:51:02 2016 +0000
@@ -0,0 +1,44 @@
+#include "CheckSum.h"
+
+uint32_t *CheckSum::table = NULL;
+
+CheckSum::CheckSum()
+{
+    reset();
+}
+
+void
+CheckSum::reset()
+{
+    checkSum = 0xFFFFFFFF;
+    if(table==NULL)
+    {
+        table = new uint32_t[256];
+        for (uint32_t i = 0; i < 256; i++)
+        {
+            uint32_t c = i;
+            for (int j = 0; j < 8; j++)
+            {
+                c = (c & 1) ? (0xEDB88320 ^ (c >> 1)) : (c >> 1);
+            }
+            table[i] = c;
+        }
+    }
+}
+
+void
+CheckSum::calc(uint8_t *buf, size_t len)
+{
+    for (size_t i = 0; i < len; i++)
+    {
+        checkSum = table[(checkSum ^ buf[i]) & 0xFF] ^ (checkSum >> 8);
+    }
+}
+
+CheckSum::CheckSumCRC32
+CheckSum::get()
+{
+    CheckSumCRC32 crc32;
+    crc32.uint32 = checkSum ^ 0xFFFFFFFF;
+    return crc32; 
+}