diff options
Diffstat (limited to 'README.mkd')
-rw-r--r-- | README.mkd | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -30,11 +30,11 @@ useful. ### 8 Byte Decoding uint64_t data = 0x8000000000000000; - uint64_t result = get_bitfield(data, 0, 1, false); + uint64_t result = eightbyte_get_bitfield(data, 0, 1, false); // result == 0x1 data = 0x0402574d555a0401; - result = get_bitfield(data, 16, 32, false); + result = eightbyte_get_bitfield(data, 16, 32, false); // result = 0x574d555a; data = 0x00000000F34DFCFF; @@ -50,8 +50,8 @@ useful. ### 8 Byte Encoding uint64_t data = 0; - fail_unless(set_bit_field(&data, 1, 0, 1)); - uint64_t result = get_bitfield(data, 0, 1, false); + fail_unless(8byte_set_bitfield(&data, 1, 0, 1)); + uint64_t result = eightbyte_get_bitfield(data, 0, 1, false); ck_assert_int_eq(result, 0x1); ### CAN Signal Encoding @@ -59,10 +59,10 @@ useful. The library supports encoding floating point CAN signals as well as booleans into a uint64_t payload. - uint64_t payload = bitfield_encode_float(1, 1, 3, 1, 0) + uint64_t payload = eightbyte_encode_float(1, 1, 3, 1, 0) // payload == 0x1000000000000000 - payload = bitfield_encode_bool(true, 1, 3); + payload = eightbyte_encode_bool(true, 1, 3); // payload == 0x1000000000000000 ### CAN Signal Decoding @@ -70,14 +70,14 @@ into a uint64_t payload. The library supports parsing floating point CAN signals as well as booleans. uint64_t payload = 0xeb00000000000000; - float float_result = bitfield_parse_float(payload, + float float_result = eightbyte_parse_float(payload, 2, // starting bit 4, // width of the signal's field 1001.0, // transformation factor for the signal value -30000.0); // transformation offset for the signal value // float_result == -19990.0 - bool bool_result = bitfield_parse_bool(payload, + bool bool_result = eightbyte_parse_bool(payload, 0, // starting bit 1, // width of the signal's field 1.0, // transformation factor for the signal value |