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
 
@@ -64,12 +64,13 @@ void protocol_init(protocol_device_t dev
 
flash_settings_t* protocol_get_settings(void);
 
void protocol_save_settings(void);
 
bool protocol_receive_message(CanRxMsgTypeDef* can_message);
 
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);
 
 
bool protocol_estop(bool value);
 
bool protocol_set_output(protocol_message_t* message);
 
bool protocol_get_data(protocol_message_t* message);
src/protocol.c
Show inline comments
 
@@ -126,12 +126,31 @@ bool protocol_send_data(protocol_data_ke
 
 
    result = protocol_send_message(&message);
 
 
    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;
 
 
    if (message->key == CAN_ID)
 
    {
0 comments (0 inline, 0 general)