make_setter

baseband.base.header.make_setter(word_index, bit_index, bit_length, default=None)[source] [edit on github]

Construct a function that uses a value to set specific bits in a header.

The function will act on a tuple/array of words, setting given bits from a given word using a value.

The parameters are just those that define header keywords.

Parameters:
word_indexint

Index into the tuple of words passed to the function.

bit_indexint

Index to the starting bit of the part to be extracted.

bit_lengthint

Number of bits to be extracted.

defaultint or bool or None

Possible default value to use in function if no default is passed on.

Returns:
setterfunction

To be used as setter(words, value).