Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 
John-Mark Gurney 455c410b89 rename so name is consistent... 1 ano atrás
..
encdec8b10b rename so name is consistent... 1 ano atrás
tests add a working framework for doing 8b10b encoding/decoding.. 2 anos atrás
.gitignore Merge commit 'ae0f979e1aa9ee734bd6b4b8d74bea8e7e112142' as 'blinkled/encdec8b10b' 2 anos atrás
.travis.yml Merge commit 'ae0f979e1aa9ee734bd6b4b8d74bea8e7e112142' as 'blinkled/encdec8b10b' 2 anos atrás
LICENSE Merge commit 'ae0f979e1aa9ee734bd6b4b8d74bea8e7e112142' as 'blinkled/encdec8b10b' 2 anos atrás
Makefile Merge commit 'ae0f979e1aa9ee734bd6b4b8d74bea8e7e112142' as 'blinkled/encdec8b10b' 2 anos atrás
README.md Merge commit 'ae0f979e1aa9ee734bd6b4b8d74bea8e7e112142' as 'blinkled/encdec8b10b' 2 anos atrás
requirements.txt Merge commit 'ae0f979e1aa9ee734bd6b4b8d74bea8e7e112142' as 'blinkled/encdec8b10b' 2 anos atrás
setup.py Merge commit 'ae0f979e1aa9ee734bd6b4b8d74bea8e7e112142' as 'blinkled/encdec8b10b' 2 anos atrás

README.md

Build Status

encdec8b10b

Encode and decode 8B10B encoding

Get

python3 -m pip install encdec8b10b

Usage

Encode Data Byte

from encdec8b10b import EncDec8B10B

running_disp = 0
byte_to_enc = 0xf
running_disp, encoded = EncDec8B10B.enc_8b10b(byte_to_enc, running_disp)
print(hex(encoded))
Output >> 0xba

Encode Control Byte

from encdec8b10b import EncDec8B10B

running_disp = 0
byte_to_enc = 0xbc # comma
ctrl = 1
running_disp, encoded = EncDec8B10B.enc_8b10b(byte_to_enc, running_disp, ctrl)
print(hex(encoded))
Output >> 0x17c

Decode Data Byte

from encdec8b10b import EncDec8B10B

byte_to_dec = 0xba
ctrl, decoded = EncDec8B10B.dec_8b10b(byte_to_dec)
print(hex(decoded))
Output >> 0xf
# ctrl variable confirm that it was a data byte
print(ctrl)
Output >> 0

Decode Control Byte

from encdec8b10b import EncDec8B10B

byte_to_dec = 0x17c # comma encoded
ctrl, decoded = EncDec8B10B.dec_8b10b(byte_to_dec)
print(hex(decoded))
Output >> 0xbc
# ctrl variable confirm that it was a control byte
print(ctrl)
Output >> 1

Verbosity

Both functions have a verbose-mode to make it easier to confirm everything that’s happening:

from encdec8b10b import EncDec8B10B

running_disp = 0
byte_to_enc = 0xA0
running_disp, encoded = EncDec8B10B.enc_8b10b(byte_to_enc, running_disp, verbose=True)

Output >> Encoder - In: A0 - Encoded: 146 - Running Disparity: 0

ctrl, decoded = EncDec8B10B.dec_8b10b(encoded, verbose=True)

Output >> Decoded: A0 - Control: 0

8B10B

8B10B Encoding were implemented by Al Widmer and Peter Franaszek in 1983. It is still widely used in high-speed electronics.

Thanks