bitarray - Add a parity bit to message bytes in Python -


i want use pigpio library send , receive 8-bit binary data on serial link using bit-banging. other side expects , sends bytes added valid parity bit. unfortunately there no parity handling in pigpio library. however, pigpio library accepts data in chunks of arbitrary length, can add parity bit in my code each data byte before present 9-bit chunks send routine (or receive 9-bit chunks , verify parity). messages sent in buffer 8-bit binary bytes. looking @ bitarray functions stymied how can extend each message byte parity bit , fill bitarray 9-bit data in python. have suggestion?

as per docs wave_add_serial(), need set bb_bits=9.

http://abyz.co.uk/rpi/pigpio/python.html#wave_add_serial

then:

for bb_bits 9-16 there 2 bytes per character.

so need provide data formatted 9 bits of data plus 7 bits of don't-care in two-byte pairs. should make life easy, real data spread twice many bytes originally, parity being stored in first bit of every other byte.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -