30 #ifndef _UNISASA_HEADER_ 31 #define _UNISASA_HEADER_ 33 #include "unisasa_types.h" 44 #define FIRST_ID_SEN 0 45 #define FIRST_ID_ACT 0 46 #define BYTES_ADDRESS_DEVICE 1 48 #define BYTES_UNSIGNED_INT 4 49 #define BYTES_MESSAGE 8 52 //====================================================================// 58 #if defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN) 59 #error "Please define: BIG_ENDIAN or LITTLE_ENDIAN, not both" 62 #if !defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN) 63 #error "Please define: BIG_ENDIAN or LITTLE_ENDIAN" 68 #define SEND(array,size,converter) _reverseArray(array, size, converter); send(converter, size) 69 #define RECV(array,size,converter) receive(converter, size); _reverseArray(converter, size, array) 71 #define SEND(array,size,converter) send(array,size) 72 #define RECV(array,size,converter) receive(array,size) 77 typedef unsigned char byte_t;
85 unsigned char byte[BYTES_MESSAGE];
137 unsigned char sizeIOMsg;
138 unsigned char sizeIDSen;
139 unsigned char sizeIDAct;
160 unsigned int integer;
161 unsigned char byte[SIZE_TYPE_SENSOR];
172 unsigned char sizeOutput;
173 unsigned char typeOutput;
204 unsigned int integer;
205 unsigned char byte[SIZE_TYPE_ACTUATOR];
216 unsigned char sizeInput;
217 unsigned char typeInput;
254 typedef void (*
sendUnisasa)(
unsigned char* message,
unsigned int size);
void addSensor(unsigned int typeSensor, unsigned char sizeOutput, unsigned char typeOutput, getSensorValueFunc getValue)
void createDevice(unsigned int address, unsigned char sizeIOmsg, messageHandlerFunc callback1, messageAndAnswerHandlerFunc callback2)
union sensorType_t sensorType_t
void(* messageHandlerFunc)(unsigned char *)
void communication(receiveUnisasa recvFunc, sendUnisasa sendFunc)
void(* setActuatorValueFunc)(unsigned char *act_value)
#define BYTES_ADDRESS_DEVICE
void(* getSensorValueFunc)(unsigned char *sensor_value)
union actuatorType_t actuatorType_t
struct actuator_t actuator_t
void(* receiveUnisasa)(unsigned char *message, unsigned int size)
void addActuator(unsigned int typeActuator, unsigned char sizeInput, unsigned char typeInput, setActuatorValueFunc setValue)
union converter_t converter_t
void(* messageAndAnswerHandlerFunc)(unsigned char *request, unsigned char *reply)
union deviceAddress_t deviceAddress_t
void(* sendUnisasa)(unsigned char *message, unsigned int size)