#include <syslog.h>
#include <sys/types.h>
#include <string.h>
+#include <stdint.h>
#include "debug_print.h"
#include "spi.h"
Little Endian
3byte -> signed long(4byte)
*/
-static long b3_to_long32(unsigned char *ptr)
+static int32_t b3_to_long32(unsigned char *ptr)
{
char buf[4];
} else {
buf[3] = 0;
}
- return *((long*)buf);
+ return *((int32_t*)buf);
}
static int decode(char *buf, AdData *ad)
{
ad->data1sec[ch] = *((int32_t*)ptr);
ptr += 4;
}
+/*
+u_int8_t *ptrsave = ptr;
+for(i = 0; i < AD_SAMPLE; i++) {
+ *ptr++ = i;
+ *ptr++ = 0;
+ *ptr++ = 0;
+}
+ptr = ptrsave;
+*/
// 50Hz data
for(ch = 0; ch < AD_CHNUM; ch++) {
for(i = 0; i < AD_SAMPLE; i++) {
ptr += 3;
}
}
+// DEBUG!!!!!!!!!!!!!!!!!!!!!!!
+//for(i = 0; i < AD_SAMPLE; i++) {
+// ad->data[0][i] = i;
+//}
+
// Checksum
ad->checksum = *((u_int16_t*)ptr);