mixer-slider/protocol/communication.h
2020-11-01 16:14:56 +01:00

30 lines
544 B
C

/*
* communication.h
*
* Describes the data packet sent for each channel
*/
#pragma once
#include "interface.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint16_t poti[4];
uint16_t slider;
uint8_t button:1;
} message_t;
/// END OF MESSAGE == MSB is set
#define IS_EOM(b) (b & (0x80))
// defines the message length of a slave message in bytes
// NOTE: sizeof(message_t) is 12 because of the 4-byte alignment criteria
#define SLAVE_MESSAGE_LEN (5*2+1)
#ifdef __cplusplus
} // end extern "C"
#endif