comm struct assert

This commit is contained in:
Rene Hopf
2015-07-21 00:37:43 +02:00
parent e462645ca5
commit 076f7bbe1d
+13 -6
View File
@@ -1,22 +1,29 @@
#pragma once
#define DATABAUD 2000000;
#define STATIC_ASSERT(COND, MSG) extern char MSG[(COND)?1:-1]
#define DATABAUD 2000000
#define TOFIXED(a) ((int16_t)(a*64))
#define TOFLOAT(a) ((float)(a/64.0))
typedef struct{
int16_t amp;
int16_t volt;
int16_t temp;
int16_t amp;
int16_t volt;
int16_t temp;
} from_hv_t;
typedef struct{
int16_t a;
int16_t b;
int16_t a;
int16_t b;
} to_hv_t;
STATIC_ASSERT(sizeof(to_hv_t) <= DATABAUD / 11 / 5000 - 1 - 5, to_hv_struct_to_large);
STATIC_ASSERT(sizeof(from_hv_t) <= DATABAUD / 11 / 5000 - 1 - 5, from_hv_struct_to_large);
//#error foo bar
// struct f1tof4{
// int16 ia;
// int16 ib;