blob: 8f6ac5f135b388f22f537c8dd13bb62299d4dddd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
CAN Message Utilities for C
============
## Bitfield Manipulation
## CAN Signal Encoding
## CAN Signal Decoding
The library supports parsing floating point CAN signals as well as booleans.
uint64_t payload = 0xeb00000000000000;
float result = bitfield_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
// result == -19990.0
bool result = bitfield_parse_bool(payload,
0, // starting bit
1, // width of the signal's field
1.0, // transformation factor for the signal value
0); // transformation offset for the signal value
// result == true
## Testing
The library includes a test suite that uses the `check` C unit test library.
$ make test
## Authors
Chris Peplin cpeplin@ford.com
## License
Copyright (c) 2013 Ford Motor Company
Licensed under the BSD license.
|