This is a followup question to my question , that was left unanswered
EDIT and organized
from my module:
class t_data_block(Structure):
_fields_ = [("current_readings",c_ulong * PORTS_NUM),
("power_reading",c_ulong)]
class t_sys_flags(Structure):
"System flags"
_fields_ = [("Alarm1",c_ulong,1),
("Alarm2",c_ulong,1),
("reserved",c_ulong,30)]
class t_input_buff(Structure):
"Input buffer from the board"
_fields_ = [("header",c_ulong),
("sys_flags", t_sys_flags),# t_sys_flags is another structure
("data_block", t_data_block * CHIP_NUM)] # t_data_block is another structure
I need to go over each byte in buff and i tried the following:
from pc_memory import*
def calc_formula(buff,len):
sum = 0
for curChar in buff:
numericByteValue = ord(curChar)
sum += numericByteValue
return sum
def main:
input_buff = t_input_buff()
calc_formula(input_buff,len)
and i get "error:TypeError: 't_input_buff' object is not iterable" upon executing the for command
i also tried use str(buff) with no luck
Any suggestions?