Make the modules transfer a module protocol version composed of a major, a minor and a patch number.

This commit is contained in:
László Monda
2017-12-15 01:28:13 +01:00
parent c1b887cea8
commit d59ba83d99
3 changed files with 11 additions and 3 deletions

View File

@@ -10,10 +10,17 @@
#include "bool_array_converter.h"
#include "bootloader.h"
#include "module.h"
#include "versions.h"
i2c_message_t RxMessage;
i2c_message_t TxMessage;
static version_t moduleProtocolVersion = {
MODULE_PROTOCOL_MAJOR_VERSION,
MODULE_PROTOCOL_MINOR_VERSION,
MODULE_PROTOCOL_PATCH_VERSION,
};
void SlaveRxHandler(void)
{
if (!CRC16_IsMessageValid(&RxMessage)) {
@@ -57,7 +64,7 @@ void SlaveTxHandler(void)
break;
}
case SlaveProperty_ModuleProtocolVersion: {
TxMessage.data[0] = MODULE_PROTOCOL_VERSION;
memcpy(TxMessage.data, &moduleProtocolVersion, sizeof(version_t));
TxMessage.length = 1;
break;
}