diff --git a/inc/protocol.h b/inc/protocol.h --- a/inc/protocol.h +++ b/inc/protocol.h @@ -67,6 +67,7 @@ bool protocol_receive_message(CanRxMsgTy bool protocol_send_message(protocol_message_t* message); bool protocol_process_message(protocol_message_t* message); bool protocol_send_data(protocol_data_key_t key, uint8_t sensor, float data); +bool protocol_send_data_bytes(protocol_data_key_t key, uint8_t sensor, uint8_t* data); bool protocol_send_test(); bool _protocol_config(protocol_message_t* message); diff --git a/src/protocol.c b/src/protocol.c --- a/src/protocol.c +++ b/src/protocol.c @@ -129,6 +129,25 @@ bool protocol_send_data(protocol_data_ke return result; } +bool protocol_send_data_bytes(protocol_data_key_t key, uint8_t sensor, uint8_t* data) +{ + bool result = true; + + protocol_message_t message; + message.command = false; + message.id = protocol_device; + message.key = key; + message.sensor = sensor; + message.data.byte_data[0] = data[0]; + message.data.byte_data[1] = data[1]; + message.data.byte_data[2] = data[2]; + message.data.byte_data[3] = data[3]; + + result = protocol_send_message(&message); + + return result; +} + bool _protocol_get_data(protocol_message_t* message) { bool result = false;