Changeset - 01ed20819369
[Not reviewed]
default
0 2 0
matthewreed - 6 years ago 2018-08-29 23:20:05

Added send bytes function to protocol
2 files changed with 20 insertions and 0 deletions:
0 comments (0 inline, 0 general)
inc/protocol.h
Show inline comments
 
@@ -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);
 
src/protocol.c
Show inline comments
 
@@ -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;
0 comments (0 inline, 0 general)