I am checking status of single bit currently based on the variable value I pass. I have tried
def check_status(bit0 = False,bit2 = False,bit3=False):
regvalue = read_register()
if bit0:
if regvalue & 0x01:
return 1
else:
return 0
elif bit2:
if regvalue & 0x04:
return 1
else:
return 0
elif bit3:
if regvalue & 0x08:
return 1
else:
return 0
else:
raise
How in a efficient way can I return the status of more than one bit? like if want to check the status of bit0 and bit3 by passing them as true, in return I should get 1 if both are set or their current values