Convert from String to Bits

bits = pcb.string2bits(t, txt)

Converts from a string to a value, using a table of names.

Parameter Type Description
t table Table of bit field names
txt string String to convert
Returns Type Description
bits integer Bit field value

e.g.

pcb._reasons = { [0]='WAKEUP1', [1]='WAKEUP2'... [15]='COLD'}

bits = pcb.string2bits(pcb._reasons, 'WAKEUP2, COLD')