Signal

See the Signal Entity for generic information.

class brainstem.entity.Signal(module, index)[source]

Interface to digital pins configured to produce square wave signals. This class is designed to allow for square waves at various frequencies and duty cycles. Control is defined by specifying the wave period as (T3Time) and the active portion of the cycle as (T2Time). See the entity overview section of the reference for more detail regarding the timing.

getEnable()[source]

Get the Enable/Disable of the signal.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuebool

True to enable, false to disable

Return type:

brainstem.result.Result

getInvert()[source]

Get the invert status the signal output.

Normal mode is High on t0 then low at t2. Inverted mode is Low at t0 on period start and high at t2.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valuebool

True to invert, false for normal mode.

Return type:

brainstem.result.Result

getT2Time()[source]

Get the signal active period or T2 in nanoseconds.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valueunsigned int

Integer not larger than unsigned 32 bit max value representing the wave active period in nanoseconds.

Return type:

brainstem.result.Result

getT3Time()[source]

Get the signal period or T3 in nanoseconds.

Returns:

Object containing error code and returned value on success.
errorunsigned byte

An error result from the list of defined error codes

valueunsigned int

Integer not larger than unsigned 32 bit max value representing the wave period in nanoseconds.

Return type:

brainstem.result.Result

setEnable(enable)[source]

Enable/Disable the signal output.

Parameters:

enable (bool) – True to enable, false to disable

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setInvert(invert)[source]

Invert the signal output.

Normal mode is High on t0 then low at t2. Inverted mode is Low at t0 on period start and high at t2.

Parameters:

invert (bool) – True to invert, false for normal mode.

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setT2Time(t2_nsec)[source]

Set the signal active period or T2 in nanoseconds.

Parameters:

t2_nsec (unsigned int) – Integer not larger than unsigned 32 bit max value representing the wave active period in nanoseconds.

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte

setT3Time(t3_nsec)[source]

Set the signal period or T3 in nanoseconds.

Parameters:

t3_nsec (unsigned int) – Integer not larger than unsigned 32 bit max value representing the wave period in nanoseconds.

Returns:

An error result from the list of defined error codes in brainstem.result.Result

Return type:

unsigned byte