Re: Packing byte fields and an array object into struct

2013-11-13 Thread Ned Batchelder
On Wednesday, November 13, 2013 3:41:03 PM UTC-5, krishna...@gmail.com wrote: > Thanks for your reply Ned! > > I tried this your suggestion and this is what it complains... > > os_inst_bytes = struct.pack('7BI512s', 0, 0x51, 0x10, 5, 0, 0xD, 0x80, 0, '') > > -

Re: Packing byte fields and an array object into struct

2013-11-13 Thread krishna2prasad
Correction in the last input line... In [16]: result = struct.unpack('5p', os_inst[11:16]) --- error Traceback (most recent call last) in () > 1 result = struct.unpack('5p', os_inst[11

Re: Packing byte fields and an array object into struct

2013-11-13 Thread krishna2prasad
Thanks for your reply Ned! I tried this your suggestion and this is what it complains... os_inst_bytes = struct.pack('7BI512s', 0, 0x51, 0x10, 5, 0, 0xD, 0x80, 0, '') --- error Traceback

Re: Packing byte fields and an array object into struct

2013-11-13 Thread Ned Batchelder
On Wednesday, November 13, 2013 1:31:49 PM UTC-5, krishna...@gmail.com wrote: > Hello, > > I am trying to build a structure to be passed down to an I2C device driver. > The driver expects a struct that has a data array of size 512 bytes among > other things. This is my code - > > rd_wr

Packing byte fields and an array object into struct

2013-11-13 Thread krishna2prasad
Hello, I am trying to build a structure to be passed down to an I2C device driver. The driver expects a struct that has a data array of size 512 bytes among other things. This is my code - rd_wr = 0x0 # Read operation i2c_addr= addr mux = mux_sel multi_len