Crates.io | bitsutils |
lib.rs | bitsutils |
version | 0.1.7 |
source | src |
created_at | 2024-11-18 01:10:47.470932 |
updated_at | 2024-11-18 01:43:21.88746 |
description | Bits viewer |
homepage | |
repository | |
max_upload_size | |
id | 1451680 |
size | 25,104 |
cargo install bitsutils
bits 1234
# in hex
bits 0x1234
bits 1234h
# in binary
bits 0b1010
bits 1010b
# in octal
bits 0o1234
bits 1234o
Example output:
1234 = 0x4d2 = 0b10011010010
bit v desc
---------------
0 0
1 1
2 0
3 0
4 1
5 0
6 1
7 1
8 0
9 0
10 1
11 0
12 0
13 0
14 0
15 0
bits 0x0f 0x1f
Example output:
15 = 0xf = 0b1111
bit v desc
---------------
0 1
1 1
2 1
3 1
4 0
5 0
6 0
7 0
31 = 0x1f = 0b11111
bit v desc
---------------
0 1
1 1
2 1
3 1
4 1 >>
5 0
6 0
7 0
Specify a bit map with --bitmap
or -m
option or in BITMAP
environment
variable (YAML or JSON file).
Example bit map for EtherCAT control PDO:
bits:
0: switch on
1: voltage
2: quick stop
3: operation
4: new set point
7: fault reset
8: halt
Now the known bits are displayed with their description:
bits 0x0f 0x1f
Output:
15 = 0xf = 0b1111
bit v desc
------------------------
0 1 switch on
1 1 voltage
2 1 quick stop
3 1 operation
4 0 new set point
5 0
6 0
7 0 fault reset
31 = 0x1f = 0b11111
bit v desc
---------------------------
0 1 switch on
1 1 voltage
2 1 quick stop
3 1 operation
4 1 >> new set point
5 0
6 0
7 0 fault reset