formaty/formats/example.toml
Joey Hines 70a3c260e6
Improved docs + a bunch of fixes
+ Better error handling
  + Line numbers in toml errors should now match the file
  + Errors during parsing show where in the bit stream they failed
+ Fixed some issues with string, float, and double parsing reporting the wrong bit width
+ Updated docs and added the example.toml config
+ clipppy + fmt
2022-04-10 10:42:05 -06:00

42 lines
1.2 KiB
TOML

# Example fields to show off configuration
# Example data to use "[0x00, 0x55, 0xff, 0x43, 0xd2 0x99 0x90, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x57, 0x6f, 0x72, 0x6c, 0x64]"
[[formats]]
# Format name
name = "example"
# Global bit flip
bit_flip = false
# signed int field, big endian
[[formats.fields]]
name = "int field"
field_type = {type = "Int", bit_width = 16, endianness = "BigEndian"}
# unsigned int field, little endian. also is printed as hex
[[formats.fields]]
name = "uint field"
print_type = {print = "Base", base=16}
field_type = {type = "UInt", bit_width = 4, endianness = "LittleEndian"}
# unsigned int field, little endian. also is printed as hex
[[formats.fields]]
name = "uint field"
print_type = {print = "Base", base=16}
field_type = {type = "UInt", bit_width = 4, endianness = "LittleEndian"}
# single precesion float field.
[[formats.fields]]
name = "float field"
bit_flip = false
field_type = {type = "Float", endianness = "BigEndian"}
# string field. Printed as a byte array
[[formats.fields]]
name = "string field"
print_type = {print = "ByteArray"}
field_type = {type = "String", endianness = "BigEndian", max_len = 55}
# byte field
[[formats.fields]]
name = "bytes field"
field_type = {type = "Bytes", endianness = "BigEndian", max_len = 55}