diff --git a/inc/protocol.h b/inc/protocol.h --- a/inc/protocol.h +++ b/inc/protocol.h @@ -55,8 +55,9 @@ typedef enum { WATER_PH = 0x000E, CAN_ID = 0x0100, DATA_RATE = 0x0101, - GPIO = 0x0102, - LED_BRIGHTNESS = 0x0103, + LED_BRIGHTNESS = 0x0102, + INPUT = 0x0103, + OUTPUT = 0x0104, } protocol_data_key_t; void protocol_init(protocol_device_t device); diff --git a/src/protocol.c b/src/protocol.c --- a/src/protocol.c +++ b/src/protocol.c @@ -124,6 +124,30 @@ bool protocol_send_data(protocol_data_ke return result; } +bool _protocol_get_data(protocol_message_t* message) +{ + bool result = false; + + if (message->key == CAN_ID) + { + protocol_send_data(message->key, message->sensor, protocol_settings.val.can_id); + } + else if (message->key == DATA_RATE) + { + protocol_send_data(message->key, message->sensor, ((float)protocol_settings.val.data_rate)/1000); + } + else if (message->key == LED_BRIGHTNESS) + { + protocol_send_data(message->key, message->sensor, protocol_settings.val.led_brightness); + } + else + { + //call config weak function + result = protocol_get_data(message); + } + return result; +} + bool _protocol_config(protocol_message_t* message) { bool result = false;