diff options
Diffstat (limited to 'CAN-binder/libs/openxc-message-format/libs/nanopb/examples/using_double_on_avr/decode_double.c')
-rw-r--r-- | CAN-binder/libs/openxc-message-format/libs/nanopb/examples/using_double_on_avr/decode_double.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/CAN-binder/libs/openxc-message-format/libs/nanopb/examples/using_double_on_avr/decode_double.c b/CAN-binder/libs/openxc-message-format/libs/nanopb/examples/using_double_on_avr/decode_double.c deleted file mode 100644 index 5802eca..0000000 --- a/CAN-binder/libs/openxc-message-format/libs/nanopb/examples/using_double_on_avr/decode_double.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Decodes a double value into a float variable. - * Used to read double values with AVR code, which doesn't support double directly. - */ - -#include <stdio.h> -#include <pb_decode.h> -#include "double_conversion.h" -#include "doubleproto.pb.h" - -int main() -{ - uint8_t buffer[32]; - size_t count = fread(buffer, 1, sizeof(buffer), stdin); - pb_istream_t stream = pb_istream_from_buffer(buffer, count); - - AVRDoubleMessage message; - pb_decode(&stream, AVRDoubleMessage_fields, &message); - - float v1 = double_to_float(message.field1); - float v2 = double_to_float(message.field2); - - printf("Values: %f %f\n", v1, v2); - - if (v1 == 1234.5678f && - v2 == 0.00001f) - { - return 0; - } - else - { - return 1; - } -} |