Opacity meter with USB interface

Dependencies:   USBDevice mbed

Revision:
0:8ce24e6c4de1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ByteOperations.h	Tue Jan 05 16:44:57 2016 +0000
@@ -0,0 +1,278 @@
+#ifndef BYTEOPERATION_H_
+#define BYTEOPERATION_H_
+
+#include <stdint.h>
+
+/* low index equals low nibble */
+/* Write 32 bit var to 4 bytes */
+void write_32_to_8(int *i, uint8_t dst[], uint32_t src);
+
+/* Write 16 bit var to 2 bytes */
+void write_16_to_8(int *i, uint8_t dst[], uint16_t src);
+
+/* Write 4 bytes to 32 bit var*/
+uint32_t read_8_to_32(int *i, uint8_t *src);
+
+/* Write 2 bytes to 16 bit var*/
+uint16_t read_8_to_16(int *i, uint8_t *src);
+
+
+const uint8_t logaritmify[0xFF] = {
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+1  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+2  ,
+3  ,
+3  ,
+3  ,
+3  ,
+3  ,
+3  ,
+3  ,
+3  ,
+3  ,
+3  ,
+3  ,
+4  ,
+4  ,
+4  ,
+4  ,
+4  ,
+4  ,
+4  ,
+4  ,
+5  ,
+5  ,
+5  ,
+5  ,
+5  ,
+5  ,
+5  ,
+6  ,
+6  ,
+6  ,
+6  ,
+6  ,
+6  ,
+7  ,
+7  ,
+7  ,
+7  ,
+7  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