partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
convert_avgpool
Convert Average pooling. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for k...
pytorch2keras/pooling_layers.py
def convert_avgpool(params, w_name, scope_name, inputs, layers, weights, names): """ Convert Average pooling. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionar...
def convert_avgpool(params, w_name, scope_name, inputs, layers, weights, names): """ Convert Average pooling. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionar...
[ "Convert", "Average", "pooling", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/pooling_layers.py#L9-L71
[ "def", "convert_avgpool", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting pooling ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'P'", "+",...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_maxpool3
Convert 3d Max pooling. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for ke...
pytorch2keras/pooling_layers.py
def convert_maxpool3(params, w_name, scope_name, inputs, layers, weights, names): """ Convert 3d Max pooling. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionar...
def convert_maxpool3(params, w_name, scope_name, inputs, layers, weights, names): """ Convert 3d Max pooling. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionar...
[ "Convert", "3d", "Max", "pooling", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/pooling_layers.py#L140-L196
[ "def", "convert_maxpool3", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting pooling ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'P'", "+"...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_adaptive_max_pool2d
Convert convert_adaptive_max_pool2d layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use...
pytorch2keras/pooling_layers.py
def convert_adaptive_max_pool2d(params, w_name, scope_name, inputs, layers, weights, names): """ Convert convert_adaptive_max_pool2d layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node in...
def convert_adaptive_max_pool2d(params, w_name, scope_name, inputs, layers, weights, names): """ Convert convert_adaptive_max_pool2d layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node in...
[ "Convert", "convert_adaptive_max_pool2d", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/pooling_layers.py#L233-L264
[ "def", "convert_adaptive_max_pool2d", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting adaptive_avg_pool2d...'", ")", "if", "names", "==", "'short'", ":", "tf_name",...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_padding
Convert padding layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for ker...
pytorch2keras/padding_layers.py
def convert_padding(params, w_name, scope_name, inputs, layers, weights, names): """ Convert padding layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
def convert_padding(params, w_name, scope_name, inputs, layers, weights, names): """ Convert padding layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
[ "Convert", "padding", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/padding_layers.py#L9-L52
[ "def", "convert_padding", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting padding...'", ")", "if", "params", "[", "'mode'", "]", "==", "'constant'", ":", "# r...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_batchnorm
Convert batch normalization layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short n...
pytorch2keras/normalization_layers.py
def convert_batchnorm(params, w_name, scope_name, inputs, layers, weights, names): """ Convert batch normalization layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layer...
def convert_batchnorm(params, w_name, scope_name, inputs, layers, weights, names): """ Convert batch normalization layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layer...
[ "Convert", "batch", "normalization", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/normalization_layers.py#L9-L61
[ "def", "convert_batchnorm", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting batchnorm ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'BN'", ...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_instancenorm
Convert instance normalization layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use shor...
pytorch2keras/normalization_layers.py
def convert_instancenorm(params, w_name, scope_name, inputs, layers, weights, names): """ Convert instance normalization layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
def convert_instancenorm(params, w_name, scope_name, inputs, layers, weights, names): """ Convert instance normalization layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
[ "Convert", "instance", "normalization", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/normalization_layers.py#L64-L112
[ "def", "convert_instancenorm", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting instancenorm ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'I...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_dropout
Convert dropout. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for keras lay...
pytorch2keras/normalization_layers.py
def convert_dropout(params, w_name, scope_name, inputs, layers, weights, names): """ Convert dropout. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
def convert_dropout(params, w_name, scope_name, inputs, layers, weights, names): """ Convert dropout. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
[ "Convert", "dropout", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/normalization_layers.py#L115-L138
[ "def", "convert_dropout", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting dropout ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'DO'", "+"...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_relu
Convert relu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for keras ...
pytorch2keras/activation_layers.py
def convert_relu(params, w_name, scope_name, inputs, layers, weights, names): """ Convert relu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
def convert_relu(params, w_name, scope_name, inputs, layers, weights, names): """ Convert relu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
[ "Convert", "relu", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L9-L32
[ "def", "convert_relu", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting relu ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'RELU'", "+", ...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_lrelu
Convert leaky relu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for k...
pytorch2keras/activation_layers.py
def convert_lrelu(params, w_name, scope_name, inputs, layers, weights, names): """ Convert leaky relu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
def convert_lrelu(params, w_name, scope_name, inputs, layers, weights, names): """ Convert leaky relu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
[ "Convert", "leaky", "relu", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L35-L59
[ "def", "convert_lrelu", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting lrelu ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'lRELU'", "+",...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_sigmoid
Convert sigmoid layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for ker...
pytorch2keras/activation_layers.py
def convert_sigmoid(params, w_name, scope_name, inputs, layers, weights, names): """ Convert sigmoid layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
def convert_sigmoid(params, w_name, scope_name, inputs, layers, weights, names): """ Convert sigmoid layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
[ "Convert", "sigmoid", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L62-L85
[ "def", "convert_sigmoid", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting sigmoid ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'SIGM'", "...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_softmax
Convert softmax layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for ker...
pytorch2keras/activation_layers.py
def convert_softmax(params, w_name, scope_name, inputs, layers, weights, names): """ Convert softmax layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
def convert_softmax(params, w_name, scope_name, inputs, layers, weights, names): """ Convert softmax layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
[ "Convert", "softmax", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L88-L115
[ "def", "convert_softmax", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting softmax ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'SMAX'", "...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_tanh
Convert tanh layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for keras ...
pytorch2keras/activation_layers.py
def convert_tanh(params, w_name, scope_name, inputs, layers, weights, names): """ Convert tanh layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
def convert_tanh(params, w_name, scope_name, inputs, layers, weights, names): """ Convert tanh layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
[ "Convert", "tanh", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L118-L141
[ "def", "convert_tanh", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting tanh ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'TANH'", "+", ...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_hardtanh
Convert hardtanh layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for ke...
pytorch2keras/activation_layers.py
def convert_hardtanh(params, w_name, scope_name, inputs, layers, weights, names): """ Convert hardtanh layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionar...
def convert_hardtanh(params, w_name, scope_name, inputs, layers, weights, names): """ Convert hardtanh layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionar...
[ "Convert", "hardtanh", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L144-L163
[ "def", "convert_hardtanh", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting hardtanh (clip) ...'", ")", "def", "target_layer", "(", "x", ",", "max_val", "=", "fl...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_selu
Convert selu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for keras ...
pytorch2keras/activation_layers.py
def convert_selu(params, w_name, scope_name, inputs, layers, weights, names): """ Convert selu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
def convert_selu(params, w_name, scope_name, inputs, layers, weights, names): """ Convert selu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
[ "Convert", "selu", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L166-L189
[ "def", "convert_selu", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting selu ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'SELU'", "+", ...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_upsample_bilinear
Convert upsample_bilinear2d layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short n...
pytorch2keras/upsampling_layers.py
def convert_upsample_bilinear(params, w_name, scope_name, inputs, layers, weights, names): """ Convert upsample_bilinear2d layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
def convert_upsample_bilinear(params, w_name, scope_name, inputs, layers, weights, names): """ Convert upsample_bilinear2d layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
[ "Convert", "upsample_bilinear2d", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/upsampling_layers.py#L9-L42
[ "def", "convert_upsample_bilinear", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting upsample...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'U...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_upsample
Convert nearest upsampling layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short na...
pytorch2keras/upsampling_layers.py
def convert_upsample(params, w_name, scope_name, inputs, layers, weights, names): """ Convert nearest upsampling layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers:...
def convert_upsample(params, w_name, scope_name, inputs, layers, weights, names): """ Convert nearest upsampling layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers:...
[ "Convert", "nearest", "upsampling", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/upsampling_layers.py#L45-L78
[ "def", "convert_upsample", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting upsample...'", ")", "if", "params", "[", "'mode'", "]", "!=", "'nearest'", ":", "ra...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
convert_gather
Convert gather (embedding) layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short na...
pytorch2keras/embedding_layers.py
def convert_gather(params, w_name, scope_name, inputs, layers, weights, names): """ Convert gather (embedding) layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: d...
def convert_gather(params, w_name, scope_name, inputs, layers, weights, names): """ Convert gather (embedding) layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: d...
[ "Convert", "gather", "(", "embedding", ")", "layer", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/embedding_layers.py#L9-L42
[ "def", "convert_gather", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting embedding ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'EMBD'", ...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
set_training
A context manager to temporarily set the training mode of 'model' to 'mode', resetting it when we exit the with-block. A no-op if mode is None.
pytorch2keras/converter.py
def set_training(model, mode): """ A context manager to temporarily set the training mode of 'model' to 'mode', resetting it when we exit the with-block. A no-op if mode is None. """ if mode is None: yield return old_mode = model.training if old_mode != mode: mod...
def set_training(model, mode): """ A context manager to temporarily set the training mode of 'model' to 'mode', resetting it when we exit the with-block. A no-op if mode is None. """ if mode is None: yield return old_mode = model.training if old_mode != mode: mod...
[ "A", "context", "manager", "to", "temporarily", "set", "the", "training", "mode", "of", "model", "to", "mode", "resetting", "it", "when", "we", "exit", "the", "with", "-", "block", ".", "A", "no", "-", "op", "if", "mode", "is", "None", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/converter.py#L23-L39
[ "def", "set_training", "(", "model", ",", "mode", ")", ":", "if", "mode", "is", "None", ":", "yield", "return", "old_mode", "=", "model", ".", "training", "if", "old_mode", "!=", "mode", ":", "model", ".", "train", "(", "mode", ")", "try", ":", "yiel...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
pytorch_to_keras
By given pytorch model convert layers with specified convertors. Args: model: pytorch model args: pytorch model arguments input_shapes: keras input shapes (using for each InputLayer) change_ordering: change CHW to HWC training: switch model to training mode verbose: ...
pytorch2keras/converter.py
def pytorch_to_keras( model, args, input_shapes, change_ordering=False, training=False, verbose=False, names=False, ): """ By given pytorch model convert layers with specified convertors. Args: model: pytorch model args: pytorch model arguments input_shapes: keras input shap...
def pytorch_to_keras( model, args, input_shapes, change_ordering=False, training=False, verbose=False, names=False, ): """ By given pytorch model convert layers with specified convertors. Args: model: pytorch model args: pytorch model arguments input_shapes: keras input shap...
[ "By", "given", "pytorch", "model", "convert", "layers", "with", "specified", "convertors", "." ]
nerox8664/pytorch2keras
python
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/converter.py#L147-L368
[ "def", "pytorch_to_keras", "(", "model", ",", "args", ",", "input_shapes", ",", "change_ordering", "=", "False", ",", "training", "=", "False", ",", "verbose", "=", "False", ",", "names", "=", "False", ",", ")", ":", "# PyTorch JIT tracing", "if", "isinstanc...
750eaf747323580e6732d0c5ba9f2f39cb096764
valid
get_platform_pwm
Attempt to return a PWM instance for the platform which the code is being executed on. Currently supports only the Raspberry Pi using the RPi.GPIO library and Beaglebone Black using the Adafruit_BBIO library. Will throw an exception if a PWM instance can't be created for the current platform. The ret...
Adafruit_GPIO/PWM.py
def get_platform_pwm(**keywords): """Attempt to return a PWM instance for the platform which the code is being executed on. Currently supports only the Raspberry Pi using the RPi.GPIO library and Beaglebone Black using the Adafruit_BBIO library. Will throw an exception if a PWM instance can't be creat...
def get_platform_pwm(**keywords): """Attempt to return a PWM instance for the platform which the code is being executed on. Currently supports only the Raspberry Pi using the RPi.GPIO library and Beaglebone Black using the Adafruit_BBIO library. Will throw an exception if a PWM instance can't be creat...
[ "Attempt", "to", "return", "a", "PWM", "instance", "for", "the", "platform", "which", "the", "code", "is", "being", "executed", "on", ".", "Currently", "supports", "only", "the", "Raspberry", "Pi", "using", "the", "RPi", ".", "GPIO", "library", "and", "Bea...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/PWM.py#L112-L128
[ "def", "get_platform_pwm", "(", "*", "*", "keywords", ")", ":", "plat", "=", "Platform", ".", "platform_detect", "(", ")", "if", "plat", "==", "Platform", ".", "RASPBERRY_PI", ":", "import", "RPi", ".", "GPIO", "return", "RPi_PWM_Adapter", "(", "RPi", ".",...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
RPi_PWM_Adapter.start
Enable PWM output on specified pin. Set to intiial percent duty cycle value (0.0 to 100.0) and frequency (in Hz).
Adafruit_GPIO/PWM.py
def start(self, pin, dutycycle, frequency_hz=2000): """Enable PWM output on specified pin. Set to intiial percent duty cycle value (0.0 to 100.0) and frequency (in Hz). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0...
def start(self, pin, dutycycle, frequency_hz=2000): """Enable PWM output on specified pin. Set to intiial percent duty cycle value (0.0 to 100.0) and frequency (in Hz). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0...
[ "Enable", "PWM", "output", "on", "specified", "pin", ".", "Set", "to", "intiial", "percent", "duty", "cycle", "value", "(", "0", ".", "0", "to", "100", ".", "0", ")", "and", "frequency", "(", "in", "Hz", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/PWM.py#L42-L53
[ "def", "start", "(", "self", ",", "pin", ",", "dutycycle", ",", "frequency_hz", "=", "2000", ")", ":", "if", "dutycycle", "<", "0.0", "or", "dutycycle", ">", "100.0", ":", "raise", "ValueError", "(", "'Invalid duty cycle value, must be between 0.0 to 100.0 (inclus...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
RPi_PWM_Adapter.set_duty_cycle
Set percent duty cycle of PWM output on specified pin. Duty cycle must be a value 0.0 to 100.0 (inclusive).
Adafruit_GPIO/PWM.py
def set_duty_cycle(self, pin, dutycycle): """Set percent duty cycle of PWM output on specified pin. Duty cycle must be a value 0.0 to 100.0 (inclusive). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0.0 to 100.0 (inc...
def set_duty_cycle(self, pin, dutycycle): """Set percent duty cycle of PWM output on specified pin. Duty cycle must be a value 0.0 to 100.0 (inclusive). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0.0 to 100.0 (inc...
[ "Set", "percent", "duty", "cycle", "of", "PWM", "output", "on", "specified", "pin", ".", "Duty", "cycle", "must", "be", "a", "value", "0", ".", "0", "to", "100", ".", "0", "(", "inclusive", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/PWM.py#L55-L63
[ "def", "set_duty_cycle", "(", "self", ",", "pin", ",", "dutycycle", ")", ":", "if", "dutycycle", "<", "0.0", "or", "dutycycle", ">", "100.0", ":", "raise", "ValueError", "(", "'Invalid duty cycle value, must be between 0.0 to 100.0 (inclusive).'", ")", "if", "pin", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
RPi_PWM_Adapter.set_frequency
Set frequency (in Hz) of PWM output on specified pin.
Adafruit_GPIO/PWM.py
def set_frequency(self, pin, frequency_hz): """Set frequency (in Hz) of PWM output on specified pin.""" if pin not in self.pwm: raise ValueError('Pin {0} is not configured as a PWM. Make sure to first call start for the pin.'.format(pin)) self.pwm[pin].ChangeFrequency(frequency_hz)
def set_frequency(self, pin, frequency_hz): """Set frequency (in Hz) of PWM output on specified pin.""" if pin not in self.pwm: raise ValueError('Pin {0} is not configured as a PWM. Make sure to first call start for the pin.'.format(pin)) self.pwm[pin].ChangeFrequency(frequency_hz)
[ "Set", "frequency", "(", "in", "Hz", ")", "of", "PWM", "output", "on", "specified", "pin", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/PWM.py#L65-L69
[ "def", "set_frequency", "(", "self", ",", "pin", ",", "frequency_hz", ")", ":", "if", "pin", "not", "in", "self", ".", "pwm", ":", "raise", "ValueError", "(", "'Pin {0} is not configured as a PWM. Make sure to first call start for the pin.'", ".", "format", "(", "p...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
RPi_PWM_Adapter.stop
Stop PWM output on specified pin.
Adafruit_GPIO/PWM.py
def stop(self, pin): """Stop PWM output on specified pin.""" if pin not in self.pwm: raise ValueError('Pin {0} is not configured as a PWM. Make sure to first call start for the pin.'.format(pin)) self.pwm[pin].stop() del self.pwm[pin]
def stop(self, pin): """Stop PWM output on specified pin.""" if pin not in self.pwm: raise ValueError('Pin {0} is not configured as a PWM. Make sure to first call start for the pin.'.format(pin)) self.pwm[pin].stop() del self.pwm[pin]
[ "Stop", "PWM", "output", "on", "specified", "pin", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/PWM.py#L71-L76
[ "def", "stop", "(", "self", ",", "pin", ")", ":", "if", "pin", "not", "in", "self", ".", "pwm", ":", "raise", "ValueError", "(", "'Pin {0} is not configured as a PWM. Make sure to first call start for the pin.'", ".", "format", "(", "pin", ")", ")", "self", "."...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BBIO_PWM_Adapter.start
Enable PWM output on specified pin. Set to intiial percent duty cycle value (0.0 to 100.0) and frequency (in Hz).
Adafruit_GPIO/PWM.py
def start(self, pin, dutycycle, frequency_hz=2000): """Enable PWM output on specified pin. Set to intiial percent duty cycle value (0.0 to 100.0) and frequency (in Hz). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0...
def start(self, pin, dutycycle, frequency_hz=2000): """Enable PWM output on specified pin. Set to intiial percent duty cycle value (0.0 to 100.0) and frequency (in Hz). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0...
[ "Enable", "PWM", "output", "on", "specified", "pin", ".", "Set", "to", "intiial", "percent", "duty", "cycle", "value", "(", "0", ".", "0", "to", "100", ".", "0", ")", "and", "frequency", "(", "in", "Hz", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/PWM.py#L87-L93
[ "def", "start", "(", "self", ",", "pin", ",", "dutycycle", ",", "frequency_hz", "=", "2000", ")", ":", "if", "dutycycle", "<", "0.0", "or", "dutycycle", ">", "100.0", ":", "raise", "ValueError", "(", "'Invalid duty cycle value, must be between 0.0 to 100.0 (inclus...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BBIO_PWM_Adapter.set_duty_cycle
Set percent duty cycle of PWM output on specified pin. Duty cycle must be a value 0.0 to 100.0 (inclusive).
Adafruit_GPIO/PWM.py
def set_duty_cycle(self, pin, dutycycle): """Set percent duty cycle of PWM output on specified pin. Duty cycle must be a value 0.0 to 100.0 (inclusive). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0.0 to 100.0 (inc...
def set_duty_cycle(self, pin, dutycycle): """Set percent duty cycle of PWM output on specified pin. Duty cycle must be a value 0.0 to 100.0 (inclusive). """ if dutycycle < 0.0 or dutycycle > 100.0: raise ValueError('Invalid duty cycle value, must be between 0.0 to 100.0 (inc...
[ "Set", "percent", "duty", "cycle", "of", "PWM", "output", "on", "specified", "pin", ".", "Duty", "cycle", "must", "be", "a", "value", "0", ".", "0", "to", "100", ".", "0", "(", "inclusive", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/PWM.py#L95-L101
[ "def", "set_duty_cycle", "(", "self", ",", "pin", ",", "dutycycle", ")", ":", "if", "dutycycle", "<", "0.0", "or", "dutycycle", ">", "100.0", ":", "raise", "ValueError", "(", "'Invalid duty cycle value, must be between 0.0 to 100.0 (inclusive).'", ")", "self", ".", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
platform_detect
Detect if running on the Raspberry Pi or Beaglebone Black and return the platform type. Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or UNKNOWN.
Adafruit_GPIO/Platform.py
def platform_detect(): """Detect if running on the Raspberry Pi or Beaglebone Black and return the platform type. Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or UNKNOWN.""" # Handle Raspberry Pi pi = pi_version() if pi is not None: return RASPBERRY_PI # Handle Beaglebone Black # TO...
def platform_detect(): """Detect if running on the Raspberry Pi or Beaglebone Black and return the platform type. Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or UNKNOWN.""" # Handle Raspberry Pi pi = pi_version() if pi is not None: return RASPBERRY_PI # Handle Beaglebone Black # TO...
[ "Detect", "if", "running", "on", "the", "Raspberry", "Pi", "or", "Beaglebone", "Black", "and", "return", "the", "platform", "type", ".", "Will", "return", "RASPBERRY_PI", "BEAGLEBONE_BLACK", "or", "UNKNOWN", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/Platform.py#L31-L62
[ "def", "platform_detect", "(", ")", ":", "# Handle Raspberry Pi", "pi", "=", "pi_version", "(", ")", "if", "pi", "is", "not", "None", ":", "return", "RASPBERRY_PI", "# Handle Beaglebone Black", "# TODO: Check the Beaglebone Black /proc/cpuinfo value instead of reading", "# ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
SpiDev.set_bit_order
Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first.
Adafruit_GPIO/SPI.py
def set_bit_order(self, order): """Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first. """ if order == MSBFIRST: self._device.lsbfirst = False elif order == LSBF...
def set_bit_order(self, order): """Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first. """ if order == MSBFIRST: self._device.lsbfirst = False elif order == LSBF...
[ "Set", "order", "of", "bits", "to", "be", "read", "/", "written", "over", "serial", "lines", ".", "Should", "be", "either", "MSBFIRST", "for", "most", "-", "significant", "first", "or", "LSBFIRST", "for", "least", "-", "signifcant", "first", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L63-L73
[ "def", "set_bit_order", "(", "self", ",", "order", ")", ":", "if", "order", "==", "MSBFIRST", ":", "self", ".", "_device", ".", "lsbfirst", "=", "False", "elif", "order", "==", "LSBFIRST", ":", "self", ".", "_device", ".", "lsbfirst", "=", "True", "els...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
SpiDevMraa.set_mode
Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
Adafruit_GPIO/SPI.py
def set_mode(self,mode): """Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus """ if mode < 0 or mode > 3: raise Valu...
def set_mode(self,mode): """Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus """ if mode < 0 or mode > 3: raise Valu...
[ "Set", "SPI", "mode", "which", "controls", "clock", "polarity", "and", "phase", ".", "Should", "be", "a", "numeric", "value", "0", "1", "2", "or", "3", ".", "See", "wikipedia", "page", "for", "details", "on", "meaning", ":", "http", ":", "//", "en", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L111-L118
[ "def", "set_mode", "(", "self", ",", "mode", ")", ":", "if", "mode", "<", "0", "or", "mode", ">", "3", ":", "raise", "ValueError", "(", "'Mode must be a value 0, 1, 2, or 3.'", ")", "self", ".", "_device", ".", "mode", "(", "mode", ")" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BitBang.set_mode
Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
Adafruit_GPIO/SPI.py
def set_mode(self, mode): """Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus """ if mode < 0 or mode > 3: raise Val...
def set_mode(self, mode): """Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus """ if mode < 0 or mode > 3: raise Val...
[ "Set", "SPI", "mode", "which", "controls", "clock", "polarity", "and", "phase", ".", "Should", "be", "a", "numeric", "value", "0", "1", "2", "or", "3", ".", "See", "wikipedia", "page", "for", "details", "on", "meaning", ":", "http", ":", "//", "en", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L179-L199
[ "def", "set_mode", "(", "self", ",", "mode", ")", ":", "if", "mode", "<", "0", "or", "mode", ">", "3", ":", "raise", "ValueError", "(", "'Mode must be a value 0, 1, 2, or 3.'", ")", "if", "mode", "&", "0x02", ":", "# Clock is normally high in mode 2 and 3.", "...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BitBang.set_bit_order
Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first.
Adafruit_GPIO/SPI.py
def set_bit_order(self, order): """Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first. """ # Set self._mask to the bitmask which points at the appropriate bit to # read or w...
def set_bit_order(self, order): """Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first. """ # Set self._mask to the bitmask which points at the appropriate bit to # read or w...
[ "Set", "order", "of", "bits", "to", "be", "read", "/", "written", "over", "serial", "lines", ".", "Should", "be", "either", "MSBFIRST", "for", "most", "-", "significant", "first", "or", "LSBFIRST", "for", "least", "-", "signifcant", "first", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L201-L218
[ "def", "set_bit_order", "(", "self", ",", "order", ")", ":", "# Set self._mask to the bitmask which points at the appropriate bit to", "# read or write, and appropriate left/right shift operator function for", "# reading/writing.", "if", "order", "==", "MSBFIRST", ":", "self", ".",...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BitBang.write
Half-duplex SPI write. If assert_ss is True, the SS line will be asserted low, the specified bytes will be clocked out the MOSI line, and if deassert_ss is True the SS line be put back high.
Adafruit_GPIO/SPI.py
def write(self, data, assert_ss=True, deassert_ss=True): """Half-duplex SPI write. If assert_ss is True, the SS line will be asserted low, the specified bytes will be clocked out the MOSI line, and if deassert_ss is True the SS line be put back high. """ # Fail MOSI is not speci...
def write(self, data, assert_ss=True, deassert_ss=True): """Half-duplex SPI write. If assert_ss is True, the SS line will be asserted low, the specified bytes will be clocked out the MOSI line, and if deassert_ss is True the SS line be put back high. """ # Fail MOSI is not speci...
[ "Half", "-", "duplex", "SPI", "write", ".", "If", "assert_ss", "is", "True", "the", "SS", "line", "will", "be", "asserted", "low", "the", "specified", "bytes", "will", "be", "clocked", "out", "the", "MOSI", "line", "and", "if", "deassert_ss", "is", "True...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L224-L246
[ "def", "write", "(", "self", ",", "data", ",", "assert_ss", "=", "True", ",", "deassert_ss", "=", "True", ")", ":", "# Fail MOSI is not specified.", "if", "self", ".", "_mosi", "is", "None", ":", "raise", "RuntimeError", "(", "'Write attempted with no MOSI pin s...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BitBang.read
Half-duplex SPI read. If assert_ss is true, the SS line will be asserted low, the specified length of bytes will be clocked in the MISO line, and if deassert_ss is true the SS line will be put back high. Bytes which are read will be returned as a bytearray object.
Adafruit_GPIO/SPI.py
def read(self, length, assert_ss=True, deassert_ss=True): """Half-duplex SPI read. If assert_ss is true, the SS line will be asserted low, the specified length of bytes will be clocked in the MISO line, and if deassert_ss is true the SS line will be put back high. Bytes which are read w...
def read(self, length, assert_ss=True, deassert_ss=True): """Half-duplex SPI read. If assert_ss is true, the SS line will be asserted low, the specified length of bytes will be clocked in the MISO line, and if deassert_ss is true the SS line will be put back high. Bytes which are read w...
[ "Half", "-", "duplex", "SPI", "read", ".", "If", "assert_ss", "is", "true", "the", "SS", "line", "will", "be", "asserted", "low", "the", "specified", "length", "of", "bytes", "will", "be", "clocked", "in", "the", "MISO", "line", "and", "if", "deassert_ss...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L248-L283
[ "def", "read", "(", "self", ",", "length", ",", "assert_ss", "=", "True", ",", "deassert_ss", "=", "True", ")", ":", "if", "self", ".", "_miso", "is", "None", ":", "raise", "RuntimeError", "(", "'Read attempted with no MISO pin specified.'", ")", "if", "asse...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BitBang.transfer
Full-duplex SPI read and write. If assert_ss is true, the SS line will be asserted low, the specified bytes will be clocked out the MOSI line while bytes will also be read from the MISO line, and if deassert_ss is true the SS line will be put back high. Bytes which are read will be ret...
Adafruit_GPIO/SPI.py
def transfer(self, data, assert_ss=True, deassert_ss=True): """Full-duplex SPI read and write. If assert_ss is true, the SS line will be asserted low, the specified bytes will be clocked out the MOSI line while bytes will also be read from the MISO line, and if deassert_ss is true the S...
def transfer(self, data, assert_ss=True, deassert_ss=True): """Full-duplex SPI read and write. If assert_ss is true, the SS line will be asserted low, the specified bytes will be clocked out the MOSI line while bytes will also be read from the MISO line, and if deassert_ss is true the S...
[ "Full", "-", "duplex", "SPI", "read", "and", "write", ".", "If", "assert_ss", "is", "true", "the", "SS", "line", "will", "be", "asserted", "low", "the", "specified", "bytes", "will", "be", "clocked", "out", "the", "MOSI", "line", "while", "bytes", "will"...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/SPI.py#L285-L328
[ "def", "transfer", "(", "self", ",", "data", ",", "assert_ss", "=", "True", ",", "deassert_ss", "=", "True", ")", ":", "if", "self", ".", "_mosi", "is", "None", ":", "raise", "RuntimeError", "(", "'Write attempted with no MOSI pin specified.'", ")", "if", "s...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
MCP230xxBase.setup
Set the input or output mode for a specified pin. Mode should be either GPIO.OUT or GPIO.IN.
Adafruit_GPIO/MCP230xx.py
def setup(self, pin, value): """Set the input or output mode for a specified pin. Mode should be either GPIO.OUT or GPIO.IN. """ self._validate_pin(pin) # Set bit to 1 for input or 0 for output. if value == GPIO.IN: self.iodir[int(pin/8)] |= 1 << (int(pin%8))...
def setup(self, pin, value): """Set the input or output mode for a specified pin. Mode should be either GPIO.OUT or GPIO.IN. """ self._validate_pin(pin) # Set bit to 1 for input or 0 for output. if value == GPIO.IN: self.iodir[int(pin/8)] |= 1 << (int(pin%8))...
[ "Set", "the", "input", "or", "output", "mode", "for", "a", "specified", "pin", ".", "Mode", "should", "be", "either", "GPIO", ".", "OUT", "or", "GPIO", ".", "IN", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L54-L66
[ "def", "setup", "(", "self", ",", "pin", ",", "value", ")", ":", "self", ".", "_validate_pin", "(", "pin", ")", "# Set bit to 1 for input or 0 for output.", "if", "value", "==", "GPIO", ".", "IN", ":", "self", ".", "iodir", "[", "int", "(", "pin", "/", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
MCP230xxBase.output_pins
Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values.
Adafruit_GPIO/MCP230xx.py
def output_pins(self, pins): """Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values. """ [self._validate_pin(pin) for pin in pins.keys()] # Set each c...
def output_pins(self, pins): """Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values. """ [self._validate_pin(pin) for pin in pins.keys()] # Set each c...
[ "Set", "multiple", "pins", "high", "or", "low", "at", "once", ".", "Pins", "should", "be", "a", "dict", "of", "pin", "name", "to", "pin", "value", "(", "HIGH", "/", "True", "for", "1", "LOW", "/", "False", "for", "0", ")", ".", "All", "provided", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L75-L88
[ "def", "output_pins", "(", "self", ",", "pins", ")", ":", "[", "self", ".", "_validate_pin", "(", "pin", ")", "for", "pin", "in", "pins", ".", "keys", "(", ")", "]", "# Set each changed pin's bit.", "for", "pin", ",", "value", "in", "iter", "(", "pins"...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
MCP230xxBase.input_pins
Read multiple pins specified in the given list and return list of pin values GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low.
Adafruit_GPIO/MCP230xx.py
def input_pins(self, pins): """Read multiple pins specified in the given list and return list of pin values GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low. """ [self._validate_pin(pin) for pin in pins] # Get GPIO state. self.gpio = self._device....
def input_pins(self, pins): """Read multiple pins specified in the given list and return list of pin values GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low. """ [self._validate_pin(pin) for pin in pins] # Get GPIO state. self.gpio = self._device....
[ "Read", "multiple", "pins", "specified", "in", "the", "given", "list", "and", "return", "list", "of", "pin", "values", "GPIO", ".", "HIGH", "/", "True", "if", "the", "pin", "is", "pulled", "high", "or", "GPIO", ".", "LOW", "/", "False", "if", "pulled",...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L97-L105
[ "def", "input_pins", "(", "self", ",", "pins", ")", ":", "[", "self", ".", "_validate_pin", "(", "pin", ")", "for", "pin", "in", "pins", "]", "# Get GPIO state.", "self", ".", "gpio", "=", "self", ".", "_device", ".", "readList", "(", "self", ".", "G...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
MCP230xxBase.pullup
Turn on the pull-up resistor for the specified pin if enabled is True, otherwise turn off the pull-up resistor.
Adafruit_GPIO/MCP230xx.py
def pullup(self, pin, enabled): """Turn on the pull-up resistor for the specified pin if enabled is True, otherwise turn off the pull-up resistor. """ self._validate_pin(pin) if enabled: self.gppu[int(pin/8)] |= 1 << (int(pin%8)) else: self.gppu[in...
def pullup(self, pin, enabled): """Turn on the pull-up resistor for the specified pin if enabled is True, otherwise turn off the pull-up resistor. """ self._validate_pin(pin) if enabled: self.gppu[int(pin/8)] |= 1 << (int(pin%8)) else: self.gppu[in...
[ "Turn", "on", "the", "pull", "-", "up", "resistor", "for", "the", "specified", "pin", "if", "enabled", "is", "True", "otherwise", "turn", "off", "the", "pull", "-", "up", "resistor", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L108-L117
[ "def", "pullup", "(", "self", ",", "pin", ",", "enabled", ")", ":", "self", ".", "_validate_pin", "(", "pin", ")", "if", "enabled", ":", "self", ".", "gppu", "[", "int", "(", "pin", "/", "8", ")", "]", "|=", "1", "<<", "(", "int", "(", "pin", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
MCP230xxBase.write_gpio
Write the specified byte value to the GPIO registor. If no value specified the current buffered value will be written.
Adafruit_GPIO/MCP230xx.py
def write_gpio(self, gpio=None): """Write the specified byte value to the GPIO registor. If no value specified the current buffered value will be written. """ if gpio is not None: self.gpio = gpio self._device.writeList(self.GPIO, self.gpio)
def write_gpio(self, gpio=None): """Write the specified byte value to the GPIO registor. If no value specified the current buffered value will be written. """ if gpio is not None: self.gpio = gpio self._device.writeList(self.GPIO, self.gpio)
[ "Write", "the", "specified", "byte", "value", "to", "the", "GPIO", "registor", ".", "If", "no", "value", "specified", "the", "current", "buffered", "value", "will", "be", "written", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L119-L125
[ "def", "write_gpio", "(", "self", ",", "gpio", "=", "None", ")", ":", "if", "gpio", "is", "not", "None", ":", "self", ".", "gpio", "=", "gpio", "self", ".", "_device", ".", "writeList", "(", "self", ".", "GPIO", ",", "self", ".", "gpio", ")" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
MCP230xxBase.write_iodir
Write the specified byte value to the IODIR registor. If no value specified the current buffered value will be written.
Adafruit_GPIO/MCP230xx.py
def write_iodir(self, iodir=None): """Write the specified byte value to the IODIR registor. If no value specified the current buffered value will be written. """ if iodir is not None: self.iodir = iodir self._device.writeList(self.IODIR, self.iodir)
def write_iodir(self, iodir=None): """Write the specified byte value to the IODIR registor. If no value specified the current buffered value will be written. """ if iodir is not None: self.iodir = iodir self._device.writeList(self.IODIR, self.iodir)
[ "Write", "the", "specified", "byte", "value", "to", "the", "IODIR", "registor", ".", "If", "no", "value", "specified", "the", "current", "buffered", "value", "will", "be", "written", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L127-L133
[ "def", "write_iodir", "(", "self", ",", "iodir", "=", "None", ")", ":", "if", "iodir", "is", "not", "None", ":", "self", ".", "iodir", "=", "iodir", "self", ".", "_device", ".", "writeList", "(", "self", ".", "IODIR", ",", "self", ".", "iodir", ")"...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
MCP230xxBase.write_gppu
Write the specified byte value to the GPPU registor. If no value specified the current buffered value will be written.
Adafruit_GPIO/MCP230xx.py
def write_gppu(self, gppu=None): """Write the specified byte value to the GPPU registor. If no value specified the current buffered value will be written. """ if gppu is not None: self.gppu = gppu self._device.writeList(self.GPPU, self.gppu)
def write_gppu(self, gppu=None): """Write the specified byte value to the GPPU registor. If no value specified the current buffered value will be written. """ if gppu is not None: self.gppu = gppu self._device.writeList(self.GPPU, self.gppu)
[ "Write", "the", "specified", "byte", "value", "to", "the", "GPPU", "registor", ".", "If", "no", "value", "specified", "the", "current", "buffered", "value", "will", "be", "written", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/MCP230xx.py#L135-L141
[ "def", "write_gppu", "(", "self", ",", "gppu", "=", "None", ")", ":", "if", "gppu", "is", "not", "None", ":", "self", ".", "gppu", "=", "gppu", "self", ".", "_device", ".", "writeList", "(", "self", ".", "GPPU", ",", "self", ".", "gppu", ")" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
disable_FTDI_driver
Disable the FTDI drivers for the current platform. This is necessary because they will conflict with libftdi and accessing the FT232H. Note you can enable the FTDI drivers again by calling enable_FTDI_driver.
Adafruit_GPIO/FT232H.py
def disable_FTDI_driver(): """Disable the FTDI drivers for the current platform. This is necessary because they will conflict with libftdi and accessing the FT232H. Note you can enable the FTDI drivers again by calling enable_FTDI_driver. """ logger.debug('Disabling FTDI driver.') if sys.platf...
def disable_FTDI_driver(): """Disable the FTDI drivers for the current platform. This is necessary because they will conflict with libftdi and accessing the FT232H. Note you can enable the FTDI drivers again by calling enable_FTDI_driver. """ logger.debug('Disabling FTDI driver.') if sys.platf...
[ "Disable", "the", "FTDI", "drivers", "for", "the", "current", "platform", ".", "This", "is", "necessary", "because", "they", "will", "conflict", "with", "libftdi", "and", "accessing", "the", "FT232H", ".", "Note", "you", "can", "enable", "the", "FTDI", "driv...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L52-L69
[ "def", "disable_FTDI_driver", "(", ")", ":", "logger", ".", "debug", "(", "'Disabling FTDI driver.'", ")", "if", "sys", ".", "platform", "==", "'darwin'", ":", "logger", ".", "debug", "(", "'Detected Mac OSX'", ")", "# Mac OS commands to disable FTDI driver.", "_che...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
enable_FTDI_driver
Re-enable the FTDI drivers for the current platform.
Adafruit_GPIO/FT232H.py
def enable_FTDI_driver(): """Re-enable the FTDI drivers for the current platform.""" logger.debug('Enabling FTDI driver.') if sys.platform == 'darwin': logger.debug('Detected Mac OSX') # Mac OS commands to enable FTDI driver. _check_running_as_root() subprocess.check_call('ke...
def enable_FTDI_driver(): """Re-enable the FTDI drivers for the current platform.""" logger.debug('Enabling FTDI driver.') if sys.platform == 'darwin': logger.debug('Detected Mac OSX') # Mac OS commands to enable FTDI driver. _check_running_as_root() subprocess.check_call('ke...
[ "Re", "-", "enable", "the", "FTDI", "drivers", "for", "the", "current", "platform", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L72-L86
[ "def", "enable_FTDI_driver", "(", ")", ":", "logger", ".", "debug", "(", "'Enabling FTDI driver.'", ")", "if", "sys", ".", "platform", "==", "'darwin'", ":", "logger", ".", "debug", "(", "'Detected Mac OSX'", ")", "# Mac OS commands to enable FTDI driver.", "_check_...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
enumerate_device_serials
Return a list of all FT232H device serial numbers connected to the machine. You can use these serial numbers to open a specific FT232H device by passing it to the FT232H initializer's serial parameter.
Adafruit_GPIO/FT232H.py
def enumerate_device_serials(vid=FT232H_VID, pid=FT232H_PID): """Return a list of all FT232H device serial numbers connected to the machine. You can use these serial numbers to open a specific FT232H device by passing it to the FT232H initializer's serial parameter. """ try: # Create a libf...
def enumerate_device_serials(vid=FT232H_VID, pid=FT232H_PID): """Return a list of all FT232H device serial numbers connected to the machine. You can use these serial numbers to open a specific FT232H device by passing it to the FT232H initializer's serial parameter. """ try: # Create a libf...
[ "Return", "a", "list", "of", "all", "FT232H", "device", "serial", "numbers", "connected", "to", "the", "machine", ".", "You", "can", "use", "these", "serial", "numbers", "to", "open", "a", "specific", "FT232H", "device", "by", "passing", "it", "to", "the",...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L96-L124
[ "def", "enumerate_device_serials", "(", "vid", "=", "FT232H_VID", ",", "pid", "=", "FT232H_PID", ")", ":", "try", ":", "# Create a libftdi context.", "ctx", "=", "None", "ctx", "=", "ftdi", ".", "new", "(", ")", "# Enumerate FTDI devices.", "device_list", "=", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.close
Close the FTDI device. Will be automatically called when the program ends.
Adafruit_GPIO/FT232H.py
def close(self): """Close the FTDI device. Will be automatically called when the program ends.""" if self._ctx is not None: ftdi.free(self._ctx) self._ctx = None
def close(self): """Close the FTDI device. Will be automatically called when the program ends.""" if self._ctx is not None: ftdi.free(self._ctx) self._ctx = None
[ "Close", "the", "FTDI", "device", ".", "Will", "be", "automatically", "called", "when", "the", "program", "ends", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L171-L175
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_ctx", "is", "not", "None", ":", "ftdi", ".", "free", "(", "self", ".", "_ctx", ")", "self", ".", "_ctx", "=", "None" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H._write
Helper function to call write_data on the provided FTDI device and verify it succeeds.
Adafruit_GPIO/FT232H.py
def _write(self, string): """Helper function to call write_data on the provided FTDI device and verify it succeeds. """ # Get modem status. Useful to enable for debugging. #ret, status = ftdi.poll_modem_status(self._ctx) #if ret == 0: # logger.debug('Modem status ...
def _write(self, string): """Helper function to call write_data on the provided FTDI device and verify it succeeds. """ # Get modem status. Useful to enable for debugging. #ret, status = ftdi.poll_modem_status(self._ctx) #if ret == 0: # logger.debug('Modem status ...
[ "Helper", "function", "to", "call", "write_data", "on", "the", "provided", "FTDI", "device", "and", "verify", "it", "succeeds", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L177-L198
[ "def", "_write", "(", "self", ",", "string", ")", ":", "# Get modem status. Useful to enable for debugging.", "#ret, status = ftdi.poll_modem_status(self._ctx)", "#if ret == 0:", "#\tlogger.debug('Modem status {0:02X}'.format(status))", "#else:", "#\tlogger.debug('Modem status error {0}'.f...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H._check
Helper function to call the provided command on the FTDI device and verify the response matches the expected value.
Adafruit_GPIO/FT232H.py
def _check(self, command, *args): """Helper function to call the provided command on the FTDI device and verify the response matches the expected value. """ ret = command(self._ctx, *args) logger.debug('Called ftdi_{0} and got response {1}.'.format(command.__name__, ret)) ...
def _check(self, command, *args): """Helper function to call the provided command on the FTDI device and verify the response matches the expected value. """ ret = command(self._ctx, *args) logger.debug('Called ftdi_{0} and got response {1}.'.format(command.__name__, ret)) ...
[ "Helper", "function", "to", "call", "the", "provided", "command", "on", "the", "FTDI", "device", "and", "verify", "the", "response", "matches", "the", "expected", "value", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L200-L207
[ "def", "_check", "(", "self", ",", "command", ",", "*", "args", ")", ":", "ret", "=", "command", "(", "self", ".", "_ctx", ",", "*", "args", ")", "logger", ".", "debug", "(", "'Called ftdi_{0} and got response {1}.'", ".", "format", "(", "command", ".", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H._poll_read
Helper function to continuously poll reads on the FTDI device until an expected number of bytes are returned. Will throw a timeout error if no data is received within the specified number of timeout seconds. Returns the read data as a string if successful, otherwise raises an execption.
Adafruit_GPIO/FT232H.py
def _poll_read(self, expected, timeout_s=5.0): """Helper function to continuously poll reads on the FTDI device until an expected number of bytes are returned. Will throw a timeout error if no data is received within the specified number of timeout seconds. Returns the read data as a s...
def _poll_read(self, expected, timeout_s=5.0): """Helper function to continuously poll reads on the FTDI device until an expected number of bytes are returned. Will throw a timeout error if no data is received within the specified number of timeout seconds. Returns the read data as a s...
[ "Helper", "function", "to", "continuously", "poll", "reads", "on", "the", "FTDI", "device", "until", "an", "expected", "number", "of", "bytes", "are", "returned", ".", "Will", "throw", "a", "timeout", "error", "if", "no", "data", "is", "received", "within", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L209-L232
[ "def", "_poll_read", "(", "self", ",", "expected", ",", "timeout_s", "=", "5.0", ")", ":", "start", "=", "time", ".", "time", "(", ")", "# Start with an empty response buffer.", "response", "=", "bytearray", "(", "expected", ")", "index", "=", "0", "# Loop c...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H._mpsse_enable
Enable MPSSE mode on the FTDI device.
Adafruit_GPIO/FT232H.py
def _mpsse_enable(self): """Enable MPSSE mode on the FTDI device.""" # Reset MPSSE by sending mask = 0 and mode = 0 self._check(ftdi.set_bitmode, 0, 0) # Enable MPSSE by sending mask = 0 and mode = 2 self._check(ftdi.set_bitmode, 0, 2)
def _mpsse_enable(self): """Enable MPSSE mode on the FTDI device.""" # Reset MPSSE by sending mask = 0 and mode = 0 self._check(ftdi.set_bitmode, 0, 0) # Enable MPSSE by sending mask = 0 and mode = 2 self._check(ftdi.set_bitmode, 0, 2)
[ "Enable", "MPSSE", "mode", "on", "the", "FTDI", "device", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L234-L239
[ "def", "_mpsse_enable", "(", "self", ")", ":", "# Reset MPSSE by sending mask = 0 and mode = 0", "self", ".", "_check", "(", "ftdi", ".", "set_bitmode", ",", "0", ",", "0", ")", "# Enable MPSSE by sending mask = 0 and mode = 2", "self", ".", "_check", "(", "ftdi", "...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H._mpsse_sync
Synchronize buffers with MPSSE by sending bad opcode and reading expected error response. Should be called once after enabling MPSSE.
Adafruit_GPIO/FT232H.py
def _mpsse_sync(self, max_retries=10): """Synchronize buffers with MPSSE by sending bad opcode and reading expected error response. Should be called once after enabling MPSSE.""" # Send a bad/unknown command (0xAB), then read buffer until bad command # response is found. self._w...
def _mpsse_sync(self, max_retries=10): """Synchronize buffers with MPSSE by sending bad opcode and reading expected error response. Should be called once after enabling MPSSE.""" # Send a bad/unknown command (0xAB), then read buffer until bad command # response is found. self._w...
[ "Synchronize", "buffers", "with", "MPSSE", "by", "sending", "bad", "opcode", "and", "reading", "expected", "error", "response", ".", "Should", "be", "called", "once", "after", "enabling", "MPSSE", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L241-L257
[ "def", "_mpsse_sync", "(", "self", ",", "max_retries", "=", "10", ")", ":", "# Send a bad/unknown command (0xAB), then read buffer until bad command", "# response is found.", "self", ".", "_write", "(", "'\\xAB'", ")", "# Keep reading until bad command response (0xFA 0xAB) is ret...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.mpsse_set_clock
Set the clock speed of the MPSSE engine. Can be any value from 450hz to 30mhz and will pick that speed or the closest speed below it.
Adafruit_GPIO/FT232H.py
def mpsse_set_clock(self, clock_hz, adaptive=False, three_phase=False): """Set the clock speed of the MPSSE engine. Can be any value from 450hz to 30mhz and will pick that speed or the closest speed below it. """ # Disable clock divisor by 5 to enable faster speeds on FT232H. se...
def mpsse_set_clock(self, clock_hz, adaptive=False, three_phase=False): """Set the clock speed of the MPSSE engine. Can be any value from 450hz to 30mhz and will pick that speed or the closest speed below it. """ # Disable clock divisor by 5 to enable faster speeds on FT232H. se...
[ "Set", "the", "clock", "speed", "of", "the", "MPSSE", "engine", ".", "Can", "be", "any", "value", "from", "450hz", "to", "30mhz", "and", "will", "pick", "that", "speed", "or", "the", "closest", "speed", "below", "it", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L259-L287
[ "def", "mpsse_set_clock", "(", "self", ",", "clock_hz", ",", "adaptive", "=", "False", ",", "three_phase", "=", "False", ")", ":", "# Disable clock divisor by 5 to enable faster speeds on FT232H.", "self", ".", "_write", "(", "'\\x8A'", ")", "# Turn on/off adaptive cloc...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.mpsse_read_gpio
Read both GPIO bus states and return a 16 bit value with their state. D0-D7 are the lower 8 bits and C0-C7 are the upper 8 bits.
Adafruit_GPIO/FT232H.py
def mpsse_read_gpio(self): """Read both GPIO bus states and return a 16 bit value with their state. D0-D7 are the lower 8 bits and C0-C7 are the upper 8 bits. """ # Send command to read low byte and high byte. self._write('\x81\x83') # Wait for 2 byte response. da...
def mpsse_read_gpio(self): """Read both GPIO bus states and return a 16 bit value with their state. D0-D7 are the lower 8 bits and C0-C7 are the upper 8 bits. """ # Send command to read low byte and high byte. self._write('\x81\x83') # Wait for 2 byte response. da...
[ "Read", "both", "GPIO", "bus", "states", "and", "return", "a", "16", "bit", "value", "with", "their", "state", ".", "D0", "-", "D7", "are", "the", "lower", "8", "bits", "and", "C0", "-", "C7", "are", "the", "upper", "8", "bits", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L289-L301
[ "def", "mpsse_read_gpio", "(", "self", ")", ":", "# Send command to read low byte and high byte.", "self", ".", "_write", "(", "'\\x81\\x83'", ")", "# Wait for 2 byte response.", "data", "=", "self", ".", "_poll_read", "(", "2", ")", "# Assemble response into 16 bit value...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.mpsse_gpio
Return command to update the MPSSE GPIO state to the current direction and level.
Adafruit_GPIO/FT232H.py
def mpsse_gpio(self): """Return command to update the MPSSE GPIO state to the current direction and level. """ level_low = chr(self._level & 0xFF) level_high = chr((self._level >> 8) & 0xFF) dir_low = chr(self._direction & 0xFF) dir_high = chr((self._direction >...
def mpsse_gpio(self): """Return command to update the MPSSE GPIO state to the current direction and level. """ level_low = chr(self._level & 0xFF) level_high = chr((self._level >> 8) & 0xFF) dir_low = chr(self._direction & 0xFF) dir_high = chr((self._direction >...
[ "Return", "command", "to", "update", "the", "MPSSE", "GPIO", "state", "to", "the", "current", "direction", "and", "level", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L303-L311
[ "def", "mpsse_gpio", "(", "self", ")", ":", "level_low", "=", "chr", "(", "self", ".", "_level", "&", "0xFF", ")", "level_high", "=", "chr", "(", "(", "self", ".", "_level", ">>", "8", ")", "&", "0xFF", ")", "dir_low", "=", "chr", "(", "self", "....
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.setup
Set the input or output mode for a specified pin. Mode should be either OUT or IN.
Adafruit_GPIO/FT232H.py
def setup(self, pin, mode): """Set the input or output mode for a specified pin. Mode should be either OUT or IN.""" self._setup_pin(pin, mode) self.mpsse_write_gpio()
def setup(self, pin, mode): """Set the input or output mode for a specified pin. Mode should be either OUT or IN.""" self._setup_pin(pin, mode) self.mpsse_write_gpio()
[ "Set", "the", "input", "or", "output", "mode", "for", "a", "specified", "pin", ".", "Mode", "should", "be", "either", "OUT", "or", "IN", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L339-L343
[ "def", "setup", "(", "self", ",", "pin", ",", "mode", ")", ":", "self", ".", "_setup_pin", "(", "pin", ",", "mode", ")", "self", ".", "mpsse_write_gpio", "(", ")" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.setup_pins
Setup multiple pins as inputs or outputs at once. Pins should be a dict of pin name to pin mode (IN or OUT). Optional starting values of pins can be provided in the values dict (with pin name to pin value).
Adafruit_GPIO/FT232H.py
def setup_pins(self, pins, values={}, write=True): """Setup multiple pins as inputs or outputs at once. Pins should be a dict of pin name to pin mode (IN or OUT). Optional starting values of pins can be provided in the values dict (with pin name to pin value). """ # General imp...
def setup_pins(self, pins, values={}, write=True): """Setup multiple pins as inputs or outputs at once. Pins should be a dict of pin name to pin mode (IN or OUT). Optional starting values of pins can be provided in the values dict (with pin name to pin value). """ # General imp...
[ "Setup", "multiple", "pins", "as", "inputs", "or", "outputs", "at", "once", ".", "Pins", "should", "be", "a", "dict", "of", "pin", "name", "to", "pin", "mode", "(", "IN", "or", "OUT", ")", ".", "Optional", "starting", "values", "of", "pins", "can", "...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L345-L356
[ "def", "setup_pins", "(", "self", ",", "pins", ",", "values", "=", "{", "}", ",", "write", "=", "True", ")", ":", "# General implementation that can be improved by subclasses.", "for", "pin", ",", "mode", "in", "iter", "(", "pins", ".", "items", "(", ")", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.output
Set the specified pin the provided high/low value. Value should be either HIGH/LOW or a boolean (true = high).
Adafruit_GPIO/FT232H.py
def output(self, pin, value): """Set the specified pin the provided high/low value. Value should be either HIGH/LOW or a boolean (true = high).""" if pin < 0 or pin > 15: raise ValueError('Pin must be between 0 and 15 (inclusive).') self._output_pin(pin, value) self....
def output(self, pin, value): """Set the specified pin the provided high/low value. Value should be either HIGH/LOW or a boolean (true = high).""" if pin < 0 or pin > 15: raise ValueError('Pin must be between 0 and 15 (inclusive).') self._output_pin(pin, value) self....
[ "Set", "the", "specified", "pin", "the", "provided", "high", "/", "low", "value", ".", "Value", "should", "be", "either", "HIGH", "/", "LOW", "or", "a", "boolean", "(", "true", "=", "high", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L364-L370
[ "def", "output", "(", "self", ",", "pin", ",", "value", ")", ":", "if", "pin", "<", "0", "or", "pin", ">", "15", ":", "raise", "ValueError", "(", "'Pin must be between 0 and 15 (inclusive).'", ")", "self", ".", "_output_pin", "(", "pin", ",", "value", ")...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.output_pins
Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values.
Adafruit_GPIO/FT232H.py
def output_pins(self, pins, write=True): """Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values. """ for pin, value in iter(pins.items()): self._o...
def output_pins(self, pins, write=True): """Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values. """ for pin, value in iter(pins.items()): self._o...
[ "Set", "multiple", "pins", "high", "or", "low", "at", "once", ".", "Pins", "should", "be", "a", "dict", "of", "pin", "name", "to", "pin", "value", "(", "HIGH", "/", "True", "for", "1", "LOW", "/", "False", "for", "0", ")", ".", "All", "provided", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L372-L380
[ "def", "output_pins", "(", "self", ",", "pins", ",", "write", "=", "True", ")", ":", "for", "pin", ",", "value", "in", "iter", "(", "pins", ".", "items", "(", ")", ")", ":", "self", ".", "_output_pin", "(", "pin", ",", "value", ")", "if", "write"...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
FT232H.input_pins
Read multiple pins specified in the given list and return list of pin values GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low.
Adafruit_GPIO/FT232H.py
def input_pins(self, pins): """Read multiple pins specified in the given list and return list of pin values GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low.""" if [pin for pin in pins if pin < 0 or pin > 15]: raise ValueError('Pin must be between 0 and 15 (i...
def input_pins(self, pins): """Read multiple pins specified in the given list and return list of pin values GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low.""" if [pin for pin in pins if pin < 0 or pin > 15]: raise ValueError('Pin must be between 0 and 15 (i...
[ "Read", "multiple", "pins", "specified", "in", "the", "given", "list", "and", "return", "list", "of", "pin", "values", "GPIO", ".", "HIGH", "/", "True", "if", "the", "pin", "is", "pulled", "high", "or", "GPIO", ".", "LOW", "/", "False", "if", "pulled",...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L387-L393
[ "def", "input_pins", "(", "self", ",", "pins", ")", ":", "if", "[", "pin", "for", "pin", "in", "pins", "if", "pin", "<", "0", "or", "pin", ">", "15", "]", ":", "raise", "ValueError", "(", "'Pin must be between 0 and 15 (inclusive).'", ")", "_pins", "=", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
SPI.set_mode
Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
Adafruit_GPIO/FT232H.py
def set_mode(self, mode): """Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus """ if mode < 0 or mode > 3: raise Val...
def set_mode(self, mode): """Set SPI mode which controls clock polarity and phase. Should be a numeric value 0, 1, 2, or 3. See wikipedia page for details on meaning: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus """ if mode < 0 or mode > 3: raise Val...
[ "Set", "SPI", "mode", "which", "controls", "clock", "polarity", "and", "phase", ".", "Should", "be", "a", "numeric", "value", "0", "1", "2", "or", "3", ".", "See", "wikipedia", "page", "for", "details", "on", "meaning", ":", "http", ":", "//", "en", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L423-L455
[ "def", "set_mode", "(", "self", ",", "mode", ")", ":", "if", "mode", "<", "0", "or", "mode", ">", "3", ":", "raise", "ValueError", "(", "'Mode must be a value 0, 1, 2, or 3.'", ")", "if", "mode", "==", "0", ":", "# Mode 0 captures on rising clock, propagates on ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
SPI.set_bit_order
Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first.
Adafruit_GPIO/FT232H.py
def set_bit_order(self, order): """Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first. """ if order == MSBFIRST: self.lsbfirst = 0 elif order == LSBFIRST: ...
def set_bit_order(self, order): """Set order of bits to be read/written over serial lines. Should be either MSBFIRST for most-significant first, or LSBFIRST for least-signifcant first. """ if order == MSBFIRST: self.lsbfirst = 0 elif order == LSBFIRST: ...
[ "Set", "order", "of", "bits", "to", "be", "read", "/", "written", "over", "serial", "lines", ".", "Should", "be", "either", "MSBFIRST", "for", "most", "-", "significant", "first", "or", "LSBFIRST", "for", "least", "-", "signifcant", "first", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L457-L467
[ "def", "set_bit_order", "(", "self", ",", "order", ")", ":", "if", "order", "==", "MSBFIRST", ":", "self", ".", "lsbfirst", "=", "0", "elif", "order", "==", "LSBFIRST", ":", "self", ".", "lsbfirst", "=", "1", "else", ":", "raise", "ValueError", "(", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
SPI.write
Half-duplex SPI write. The specified array of bytes will be clocked out the MOSI line.
Adafruit_GPIO/FT232H.py
def write(self, data): """Half-duplex SPI write. The specified array of bytes will be clocked out the MOSI line. """ #check for hardware limit of FT232H and similar MPSSE chips if (len(data) > 65536): print('the FTDI chip is limited to 65536 bytes (64 KB) of input/ou...
def write(self, data): """Half-duplex SPI write. The specified array of bytes will be clocked out the MOSI line. """ #check for hardware limit of FT232H and similar MPSSE chips if (len(data) > 65536): print('the FTDI chip is limited to 65536 bytes (64 KB) of input/ou...
[ "Half", "-", "duplex", "SPI", "write", ".", "The", "specified", "array", "of", "bytes", "will", "be", "clocked", "out", "the", "MOSI", "line", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L469-L499
[ "def", "write", "(", "self", ",", "data", ")", ":", "#check for hardware limit of FT232H and similar MPSSE chips", "if", "(", "len", "(", "data", ")", ">", "65536", ")", ":", "print", "(", "'the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!'", "...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
SPI.read
Half-duplex SPI read. The specified length of bytes will be clocked in the MISO line and returned as a bytearray object.
Adafruit_GPIO/FT232H.py
def read(self, length): """Half-duplex SPI read. The specified length of bytes will be clocked in the MISO line and returned as a bytearray object. """ #check for hardware limit of FT232H and similar MPSSE chips if (1 > length > 65536): print('the FTDI chip is limite...
def read(self, length): """Half-duplex SPI read. The specified length of bytes will be clocked in the MISO line and returned as a bytearray object. """ #check for hardware limit of FT232H and similar MPSSE chips if (1 > length > 65536): print('the FTDI chip is limite...
[ "Half", "-", "duplex", "SPI", "read", ".", "The", "specified", "length", "of", "bytes", "will", "be", "clocked", "in", "the", "MISO", "line", "and", "returned", "as", "a", "bytearray", "object", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L501-L534
[ "def", "read", "(", "self", ",", "length", ")", ":", "#check for hardware limit of FT232H and similar MPSSE chips", "if", "(", "1", ">", "length", ">", "65536", ")", ":", "print", "(", "'the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!'", ")", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
SPI.bulkread
Half-duplex SPI write then read. Send command and payload to slave as bytearray then consequently read out response from the slave for length in bytes. Designed for use with NOR or NAND flash chips, and possibly SD cards...etc... Read command is cut in half and performed twice in series to p...
Adafruit_GPIO/FT232H.py
def bulkread(self, data = [], lengthR = 'None', readmode = 1): """Half-duplex SPI write then read. Send command and payload to slave as bytearray then consequently read out response from the slave for length in bytes. Designed for use with NOR or NAND flash chips, and possibly SD cards...etc...
def bulkread(self, data = [], lengthR = 'None', readmode = 1): """Half-duplex SPI write then read. Send command and payload to slave as bytearray then consequently read out response from the slave for length in bytes. Designed for use with NOR or NAND flash chips, and possibly SD cards...etc...
[ "Half", "-", "duplex", "SPI", "write", "then", "read", ".", "Send", "command", "and", "payload", "to", "slave", "as", "bytearray", "then", "consequently", "read", "out", "response", "from", "the", "slave", "for", "length", "in", "bytes", ".", "Designed", "...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L536-L586
[ "def", "bulkread", "(", "self", ",", "data", "=", "[", "]", ",", "lengthR", "=", "'None'", ",", "readmode", "=", "1", ")", ":", "#check for hardware limit of FT232H and similar MPSSE chips", "if", "(", "1", ">", "lengthR", ">", "65536", ")", "|", "(", "len...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
SPI.transfer
Full-duplex SPI read and write. The specified array of bytes will be clocked out the MOSI line, while simultaneously bytes will be read from the MISO line. Read bytes will be returned as a bytearray object.
Adafruit_GPIO/FT232H.py
def transfer(self, data): """Full-duplex SPI read and write. The specified array of bytes will be clocked out the MOSI line, while simultaneously bytes will be read from the MISO line. Read bytes will be returned as a bytearray object. """ #check for hardware limit of FT232H an...
def transfer(self, data): """Full-duplex SPI read and write. The specified array of bytes will be clocked out the MOSI line, while simultaneously bytes will be read from the MISO line. Read bytes will be returned as a bytearray object. """ #check for hardware limit of FT232H an...
[ "Full", "-", "duplex", "SPI", "read", "and", "write", ".", "The", "specified", "array", "of", "bytes", "will", "be", "clocked", "out", "the", "MOSI", "line", "while", "simultaneously", "bytes", "will", "be", "read", "from", "the", "MISO", "line", ".", "R...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L588-L627
[ "def", "transfer", "(", "self", ",", "data", ")", ":", "#check for hardware limit of FT232H and similar MPSSE chips", "if", "(", "len", "(", "data", ")", ">", "65536", ")", ":", "print", "(", "'the FTDI chip is limited to 65536 bytes (64 KB) of input/output per command!'", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice._idle
Put I2C lines into idle state.
Adafruit_GPIO/FT232H.py
def _idle(self): """Put I2C lines into idle state.""" # Put the I2C lines into an idle state with SCL and SDA high. self._ft232h.setup_pins({0: GPIO.OUT, 1: GPIO.OUT, 2: GPIO.IN}, {0: GPIO.HIGH, 1: GPIO.HIGH})
def _idle(self): """Put I2C lines into idle state.""" # Put the I2C lines into an idle state with SCL and SDA high. self._ft232h.setup_pins({0: GPIO.OUT, 1: GPIO.OUT, 2: GPIO.IN}, {0: GPIO.HIGH, 1: GPIO.HIGH})
[ "Put", "I2C", "lines", "into", "idle", "state", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L648-L652
[ "def", "_idle", "(", "self", ")", ":", "# Put the I2C lines into an idle state with SCL and SDA high.", "self", ".", "_ft232h", ".", "setup_pins", "(", "{", "0", ":", "GPIO", ".", "OUT", ",", "1", ":", "GPIO", ".", "OUT", ",", "2", ":", "GPIO", ".", "IN", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice._transaction_end
End I2C transaction and get response bytes, including ACKs.
Adafruit_GPIO/FT232H.py
def _transaction_end(self): """End I2C transaction and get response bytes, including ACKs.""" # Ask to return response bytes immediately. self._command.append('\x87') # Send the entire command to the MPSSE. self._ft232h._write(''.join(self._command)) # Read response bytes...
def _transaction_end(self): """End I2C transaction and get response bytes, including ACKs.""" # Ask to return response bytes immediately. self._command.append('\x87') # Send the entire command to the MPSSE. self._ft232h._write(''.join(self._command)) # Read response bytes...
[ "End", "I2C", "transaction", "and", "get", "response", "bytes", "including", "ACKs", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L660-L667
[ "def", "_transaction_end", "(", "self", ")", ":", "# Ask to return response bytes immediately.", "self", ".", "_command", ".", "append", "(", "'\\x87'", ")", "# Send the entire command to the MPSSE.", "self", ".", "_ft232h", ".", "_write", "(", "''", ".", "join", "(...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice._i2c_start
Send I2C start signal. Must be called within a transaction start/end.
Adafruit_GPIO/FT232H.py
def _i2c_start(self): """Send I2C start signal. Must be called within a transaction start/end. """ # Set SCL high and SDA low, repeat 4 times to stay in this state for a # short period of time. self._ft232h.output_pins({0: GPIO.HIGH, 1: GPIO.LOW}, write=False) self._comma...
def _i2c_start(self): """Send I2C start signal. Must be called within a transaction start/end. """ # Set SCL high and SDA low, repeat 4 times to stay in this state for a # short period of time. self._ft232h.output_pins({0: GPIO.HIGH, 1: GPIO.LOW}, write=False) self._comma...
[ "Send", "I2C", "start", "signal", ".", "Must", "be", "called", "within", "a", "transaction", "start", "/", "end", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L669-L678
[ "def", "_i2c_start", "(", "self", ")", ":", "# Set SCL high and SDA low, repeat 4 times to stay in this state for a", "# short period of time.", "self", ".", "_ft232h", ".", "output_pins", "(", "{", "0", ":", "GPIO", ".", "HIGH", ",", "1", ":", "GPIO", ".", "LOW", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice._i2c_idle
Set I2C signals to idle state with SCL and SDA at a high value. Must be called within a transaction start/end.
Adafruit_GPIO/FT232H.py
def _i2c_idle(self): """Set I2C signals to idle state with SCL and SDA at a high value. Must be called within a transaction start/end. """ self._ft232h.output_pins({0: GPIO.HIGH, 1: GPIO.HIGH}, write=False) self._command.append(self._ft232h.mpsse_gpio() * _REPEAT_DELAY)
def _i2c_idle(self): """Set I2C signals to idle state with SCL and SDA at a high value. Must be called within a transaction start/end. """ self._ft232h.output_pins({0: GPIO.HIGH, 1: GPIO.HIGH}, write=False) self._command.append(self._ft232h.mpsse_gpio() * _REPEAT_DELAY)
[ "Set", "I2C", "signals", "to", "idle", "state", "with", "SCL", "and", "SDA", "at", "a", "high", "value", ".", "Must", "be", "called", "within", "a", "transaction", "start", "/", "end", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L680-L685
[ "def", "_i2c_idle", "(", "self", ")", ":", "self", ".", "_ft232h", ".", "output_pins", "(", "{", "0", ":", "GPIO", ".", "HIGH", ",", "1", ":", "GPIO", ".", "HIGH", "}", ",", "write", "=", "False", ")", "self", ".", "_command", ".", "append", "(",...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice._i2c_stop
Send I2C stop signal. Must be called within a transaction start/end.
Adafruit_GPIO/FT232H.py
def _i2c_stop(self): """Send I2C stop signal. Must be called within a transaction start/end. """ # Set SCL low and SDA low for a short period. self._ft232h.output_pins({0: GPIO.LOW, 1: GPIO.LOW}, write=False) self._command.append(self._ft232h.mpsse_gpio() * _REPEAT_DELAY) ...
def _i2c_stop(self): """Send I2C stop signal. Must be called within a transaction start/end. """ # Set SCL low and SDA low for a short period. self._ft232h.output_pins({0: GPIO.LOW, 1: GPIO.LOW}, write=False) self._command.append(self._ft232h.mpsse_gpio() * _REPEAT_DELAY) ...
[ "Send", "I2C", "stop", "signal", ".", "Must", "be", "called", "within", "a", "transaction", "start", "/", "end", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L687-L698
[ "def", "_i2c_stop", "(", "self", ")", ":", "# Set SCL low and SDA low for a short period.", "self", ".", "_ft232h", ".", "output_pins", "(", "{", "0", ":", "GPIO", ".", "LOW", ",", "1", ":", "GPIO", ".", "LOW", "}", ",", "write", "=", "False", ")", "self...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice._i2c_read_bytes
Read the specified number of bytes from the I2C bus. Length is the number of bytes to read (must be 1 or more).
Adafruit_GPIO/FT232H.py
def _i2c_read_bytes(self, length=1): """Read the specified number of bytes from the I2C bus. Length is the number of bytes to read (must be 1 or more). """ for i in range(length-1): # Read a byte and send ACK. self._command.append('\x20\x00\x00\x13\x00\x00') ...
def _i2c_read_bytes(self, length=1): """Read the specified number of bytes from the I2C bus. Length is the number of bytes to read (must be 1 or more). """ for i in range(length-1): # Read a byte and send ACK. self._command.append('\x20\x00\x00\x13\x00\x00') ...
[ "Read", "the", "specified", "number", "of", "bytes", "from", "the", "I2C", "bus", ".", "Length", "is", "the", "number", "of", "bytes", "to", "read", "(", "must", "be", "1", "or", "more", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L700-L716
[ "def", "_i2c_read_bytes", "(", "self", ",", "length", "=", "1", ")", ":", "for", "i", "in", "range", "(", "length", "-", "1", ")", ":", "# Read a byte and send ACK.", "self", ".", "_command", ".", "append", "(", "'\\x20\\x00\\x00\\x13\\x00\\x00'", ")", "# Ma...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice._i2c_write_bytes
Write the specified number of bytes to the chip.
Adafruit_GPIO/FT232H.py
def _i2c_write_bytes(self, data): """Write the specified number of bytes to the chip.""" for byte in data: # Write byte. self._command.append(str(bytearray((0x11, 0x00, 0x00, byte)))) # Make sure pins are back in idle state with clock low and data high. se...
def _i2c_write_bytes(self, data): """Write the specified number of bytes to the chip.""" for byte in data: # Write byte. self._command.append(str(bytearray((0x11, 0x00, 0x00, byte)))) # Make sure pins are back in idle state with clock low and data high. se...
[ "Write", "the", "specified", "number", "of", "bytes", "to", "the", "chip", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L718-L729
[ "def", "_i2c_write_bytes", "(", "self", ",", "data", ")", ":", "for", "byte", "in", "data", ":", "# Write byte.", "self", ".", "_command", ".", "append", "(", "str", "(", "bytearray", "(", "(", "0x11", ",", "0x00", ",", "0x00", ",", "byte", ")", ")",...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice.ping
Attempt to detect if a device at this address is present on the I2C bus. Will send out the device's address for writing and verify an ACK is received. Returns true if the ACK is received, and false if not.
Adafruit_GPIO/FT232H.py
def ping(self): """Attempt to detect if a device at this address is present on the I2C bus. Will send out the device's address for writing and verify an ACK is received. Returns true if the ACK is received, and false if not. """ self._idle() self._transaction_start() ...
def ping(self): """Attempt to detect if a device at this address is present on the I2C bus. Will send out the device's address for writing and verify an ACK is received. Returns true if the ACK is received, and false if not. """ self._idle() self._transaction_start() ...
[ "Attempt", "to", "detect", "if", "a", "device", "at", "this", "address", "is", "present", "on", "the", "I2C", "bus", ".", "Will", "send", "out", "the", "device", "s", "address", "for", "writing", "and", "verify", "an", "ACK", "is", "received", ".", "Re...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L748-L761
[ "def", "ping", "(", "self", ")", ":", "self", ".", "_idle", "(", ")", "self", ".", "_transaction_start", "(", ")", "self", ".", "_i2c_start", "(", ")", "self", ".", "_i2c_write_bytes", "(", "[", "self", ".", "_address_byte", "(", "False", ")", "]", "...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice.writeRaw8
Write an 8-bit value on the bus (without register).
Adafruit_GPIO/FT232H.py
def writeRaw8(self, value): """Write an 8-bit value on the bus (without register).""" value = value & 0xFF self._idle() self._transaction_start() self._i2c_start() self._i2c_write_bytes([self._address_byte(False), value]) self._i2c_stop() response = self._...
def writeRaw8(self, value): """Write an 8-bit value on the bus (without register).""" value = value & 0xFF self._idle() self._transaction_start() self._i2c_start() self._i2c_write_bytes([self._address_byte(False), value]) self._i2c_stop() response = self._...
[ "Write", "an", "8", "-", "bit", "value", "on", "the", "bus", "(", "without", "register", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L763-L772
[ "def", "writeRaw8", "(", "self", ",", "value", ")", ":", "value", "=", "value", "&", "0xFF", "self", ".", "_idle", "(", ")", "self", ".", "_transaction_start", "(", ")", "self", ".", "_i2c_start", "(", ")", "self", ".", "_i2c_write_bytes", "(", "[", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice.write16
Write a 16-bit value to the specified register.
Adafruit_GPIO/FT232H.py
def write16(self, register, value, little_endian=True): """Write a 16-bit value to the specified register.""" value = value & 0xFFFF value_low = value & 0xFF value_high = (value >> 8) & 0xFF if not little_endian: value_low, value_high = value_high, value_low ...
def write16(self, register, value, little_endian=True): """Write a 16-bit value to the specified register.""" value = value & 0xFFFF value_low = value & 0xFF value_high = (value >> 8) & 0xFF if not little_endian: value_low, value_high = value_high, value_low ...
[ "Write", "a", "16", "-", "bit", "value", "to", "the", "specified", "register", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L785-L799
[ "def", "write16", "(", "self", ",", "register", ",", "value", ",", "little_endian", "=", "True", ")", ":", "value", "=", "value", "&", "0xFFFF", "value_low", "=", "value", "&", "0xFF", "value_high", "=", "(", "value", ">>", "8", ")", "&", "0xFF", "if...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice.writeList
Write bytes to the specified register.
Adafruit_GPIO/FT232H.py
def writeList(self, register, data): """Write bytes to the specified register.""" self._idle() self._transaction_start() self._i2c_start() self._i2c_write_bytes([self._address_byte(False), register] + data) self._i2c_stop() response = self._transaction_end() ...
def writeList(self, register, data): """Write bytes to the specified register.""" self._idle() self._transaction_start() self._i2c_start() self._i2c_write_bytes([self._address_byte(False), register] + data) self._i2c_stop() response = self._transaction_end() ...
[ "Write", "bytes", "to", "the", "specified", "register", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L801-L809
[ "def", "writeList", "(", "self", ",", "register", ",", "data", ")", ":", "self", ".", "_idle", "(", ")", "self", ".", "_transaction_start", "(", ")", "self", ".", "_i2c_start", "(", ")", "self", ".", "_i2c_write_bytes", "(", "[", "self", ".", "_address...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice.readList
Read a length number of bytes from the specified register. Results will be returned as a bytearray.
Adafruit_GPIO/FT232H.py
def readList(self, register, length): """Read a length number of bytes from the specified register. Results will be returned as a bytearray.""" if length <= 0: raise ValueError("Length must be at least 1 byte.") self._idle() self._transaction_start() self._i2...
def readList(self, register, length): """Read a length number of bytes from the specified register. Results will be returned as a bytearray.""" if length <= 0: raise ValueError("Length must be at least 1 byte.") self._idle() self._transaction_start() self._i2...
[ "Read", "a", "length", "number", "of", "bytes", "from", "the", "specified", "register", ".", "Results", "will", "be", "returned", "as", "a", "bytearray", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L811-L827
[ "def", "readList", "(", "self", ",", "register", ",", "length", ")", ":", "if", "length", "<=", "0", ":", "raise", "ValueError", "(", "\"Length must be at least 1 byte.\"", ")", "self", ".", "_idle", "(", ")", "self", ".", "_transaction_start", "(", ")", "...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice.readRaw8
Read an 8-bit value on the bus (without register).
Adafruit_GPIO/FT232H.py
def readRaw8(self): """Read an 8-bit value on the bus (without register).""" self._idle() self._transaction_start() self._i2c_start() self._i2c_write_bytes([self._address_byte(False)]) self._i2c_stop() self._i2c_idle() self._i2c_start() self._i2c_w...
def readRaw8(self): """Read an 8-bit value on the bus (without register).""" self._idle() self._transaction_start() self._i2c_start() self._i2c_write_bytes([self._address_byte(False)]) self._i2c_stop() self._i2c_idle() self._i2c_start() self._i2c_w...
[ "Read", "an", "8", "-", "bit", "value", "on", "the", "bus", "(", "without", "register", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L829-L843
[ "def", "readRaw8", "(", "self", ")", ":", "self", ".", "_idle", "(", ")", "self", ".", "_transaction_start", "(", ")", "self", ".", "_i2c_start", "(", ")", "self", ".", "_i2c_write_bytes", "(", "[", "self", ".", "_address_byte", "(", "False", ")", "]",...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice.readS8
Read a signed byte from the specified register.
Adafruit_GPIO/FT232H.py
def readS8(self, register): """Read a signed byte from the specified register.""" result = self.readU8(register) if result > 127: result -= 256 return result
def readS8(self, register): """Read a signed byte from the specified register.""" result = self.readU8(register) if result > 127: result -= 256 return result
[ "Read", "a", "signed", "byte", "from", "the", "specified", "register", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L861-L866
[ "def", "readS8", "(", "self", ",", "register", ")", ":", "result", "=", "self", ".", "readU8", "(", "register", ")", "if", "result", ">", "127", ":", "result", "-=", "256", "return", "result" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
I2CDevice.readS16
Read a signed 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).
Adafruit_GPIO/FT232H.py
def readS16(self, register, little_endian=True): """Read a signed 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).""" result = self.readU16(register, little_endian) if result > 32767: res...
def readS16(self, register, little_endian=True): """Read a signed 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).""" result = self.readU16(register, little_endian) if result > 32767: res...
[ "Read", "a", "signed", "16", "-", "bit", "value", "from", "the", "specified", "register", "with", "the", "specified", "endianness", "(", "default", "little", "endian", "or", "least", "significant", "byte", "first", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/FT232H.py#L889-L896
[ "def", "readS16", "(", "self", ",", "register", ",", "little_endian", "=", "True", ")", ":", "result", "=", "self", ".", "readU16", "(", "register", ",", "little_endian", ")", "if", "result", ">", "32767", ":", "result", "-=", "65536", "return", "result"...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
get_default_bus
Return the default bus number based on the device platform. For a Raspberry Pi either bus 0 or 1 (based on the Pi revision) will be returned. For a Beaglebone Black the first user accessible bus, 1, will be returned.
Adafruit_GPIO/I2C.py
def get_default_bus(): """Return the default bus number based on the device platform. For a Raspberry Pi either bus 0 or 1 (based on the Pi revision) will be returned. For a Beaglebone Black the first user accessible bus, 1, will be returned. """ plat = Platform.platform_detect() if plat == Pla...
def get_default_bus(): """Return the default bus number based on the device platform. For a Raspberry Pi either bus 0 or 1 (based on the Pi revision) will be returned. For a Beaglebone Black the first user accessible bus, 1, will be returned. """ plat = Platform.platform_detect() if plat == Pla...
[ "Return", "the", "default", "bus", "number", "based", "on", "the", "device", "platform", ".", "For", "a", "Raspberry", "Pi", "either", "bus", "0", "or", "1", "(", "based", "on", "the", "Pi", "revision", ")", "will", "be", "returned", ".", "For", "a", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L40-L57
[ "def", "get_default_bus", "(", ")", ":", "plat", "=", "Platform", ".", "platform_detect", "(", ")", "if", "plat", "==", "Platform", ".", "RASPBERRY_PI", ":", "if", "Platform", ".", "pi_revision", "(", ")", "==", "1", ":", "# Revision 1 Pi uses I2C bus 0.", "...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
get_i2c_device
Return an I2C device for the specified address and on the specified bus. If busnum isn't specified, the default I2C bus for the platform will attempt to be detected.
Adafruit_GPIO/I2C.py
def get_i2c_device(address, busnum=None, i2c_interface=None, **kwargs): """Return an I2C device for the specified address and on the specified bus. If busnum isn't specified, the default I2C bus for the platform will attempt to be detected. """ if busnum is None: busnum = get_default_bus() ...
def get_i2c_device(address, busnum=None, i2c_interface=None, **kwargs): """Return an I2C device for the specified address and on the specified bus. If busnum isn't specified, the default I2C bus for the platform will attempt to be detected. """ if busnum is None: busnum = get_default_bus() ...
[ "Return", "an", "I2C", "device", "for", "the", "specified", "address", "and", "on", "the", "specified", "bus", ".", "If", "busnum", "isn", "t", "specified", "the", "default", "I2C", "bus", "for", "the", "platform", "will", "attempt", "to", "be", "detected"...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L59-L66
[ "def", "get_i2c_device", "(", "address", ",", "busnum", "=", "None", ",", "i2c_interface", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "busnum", "is", "None", ":", "busnum", "=", "get_default_bus", "(", ")", "return", "Device", "(", "address", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
require_repeated_start
Enable repeated start conditions for I2C register reads. This is the normal behavior for I2C, however on some platforms like the Raspberry Pi there are bugs which disable repeated starts unless explicitly enabled with this function. See this thread for more details: http://www.raspberrypi.org/forums...
Adafruit_GPIO/I2C.py
def require_repeated_start(): """Enable repeated start conditions for I2C register reads. This is the normal behavior for I2C, however on some platforms like the Raspberry Pi there are bugs which disable repeated starts unless explicitly enabled with this function. See this thread for more details: ...
def require_repeated_start(): """Enable repeated start conditions for I2C register reads. This is the normal behavior for I2C, however on some platforms like the Raspberry Pi there are bugs which disable repeated starts unless explicitly enabled with this function. See this thread for more details: ...
[ "Enable", "repeated", "start", "conditions", "for", "I2C", "register", "reads", ".", "This", "is", "the", "normal", "behavior", "for", "I2C", "however", "on", "some", "platforms", "like", "the", "Raspberry", "Pi", "there", "are", "bugs", "which", "disable", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L68-L82
[ "def", "require_repeated_start", "(", ")", ":", "plat", "=", "Platform", ".", "platform_detect", "(", ")", "if", "plat", "==", "Platform", ".", "RASPBERRY_PI", "and", "os", ".", "path", ".", "exists", "(", "'/sys/module/i2c_bcm2708/parameters/combined'", ")", ":...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
Device.writeRaw8
Write an 8-bit value on the bus (without register).
Adafruit_GPIO/I2C.py
def writeRaw8(self, value): """Write an 8-bit value on the bus (without register).""" value = value & 0xFF self._bus.write_byte(self._address, value) self._logger.debug("Wrote 0x%02X", value)
def writeRaw8(self, value): """Write an 8-bit value on the bus (without register).""" value = value & 0xFF self._bus.write_byte(self._address, value) self._logger.debug("Wrote 0x%02X", value)
[ "Write", "an", "8", "-", "bit", "value", "on", "the", "bus", "(", "without", "register", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L106-L111
[ "def", "writeRaw8", "(", "self", ",", "value", ")", ":", "value", "=", "value", "&", "0xFF", "self", ".", "_bus", ".", "write_byte", "(", "self", ".", "_address", ",", "value", ")", "self", ".", "_logger", ".", "debug", "(", "\"Wrote 0x%02X\"", ",", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
Device.write8
Write an 8-bit value to the specified register.
Adafruit_GPIO/I2C.py
def write8(self, register, value): """Write an 8-bit value to the specified register.""" value = value & 0xFF self._bus.write_byte_data(self._address, register, value) self._logger.debug("Wrote 0x%02X to register 0x%02X", value, register)
def write8(self, register, value): """Write an 8-bit value to the specified register.""" value = value & 0xFF self._bus.write_byte_data(self._address, register, value) self._logger.debug("Wrote 0x%02X to register 0x%02X", value, register)
[ "Write", "an", "8", "-", "bit", "value", "to", "the", "specified", "register", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L113-L118
[ "def", "write8", "(", "self", ",", "register", ",", "value", ")", ":", "value", "=", "value", "&", "0xFF", "self", ".", "_bus", ".", "write_byte_data", "(", "self", ".", "_address", ",", "register", ",", "value", ")", "self", ".", "_logger", ".", "de...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
Device.write16
Write a 16-bit value to the specified register.
Adafruit_GPIO/I2C.py
def write16(self, register, value): """Write a 16-bit value to the specified register.""" value = value & 0xFFFF self._bus.write_word_data(self._address, register, value) self._logger.debug("Wrote 0x%04X to register pair 0x%02X, 0x%02X", value, register, register+1)
def write16(self, register, value): """Write a 16-bit value to the specified register.""" value = value & 0xFFFF self._bus.write_word_data(self._address, register, value) self._logger.debug("Wrote 0x%04X to register pair 0x%02X, 0x%02X", value, register, register+1)
[ "Write", "a", "16", "-", "bit", "value", "to", "the", "specified", "register", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L120-L125
[ "def", "write16", "(", "self", ",", "register", ",", "value", ")", ":", "value", "=", "value", "&", "0xFFFF", "self", ".", "_bus", ".", "write_word_data", "(", "self", ".", "_address", ",", "register", ",", "value", ")", "self", ".", "_logger", ".", ...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
Device.writeList
Write bytes to the specified register.
Adafruit_GPIO/I2C.py
def writeList(self, register, data): """Write bytes to the specified register.""" self._bus.write_i2c_block_data(self._address, register, data) self._logger.debug("Wrote to register 0x%02X: %s", register, data)
def writeList(self, register, data): """Write bytes to the specified register.""" self._bus.write_i2c_block_data(self._address, register, data) self._logger.debug("Wrote to register 0x%02X: %s", register, data)
[ "Write", "bytes", "to", "the", "specified", "register", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L127-L131
[ "def", "writeList", "(", "self", ",", "register", ",", "data", ")", ":", "self", ".", "_bus", ".", "write_i2c_block_data", "(", "self", ".", "_address", ",", "register", ",", "data", ")", "self", ".", "_logger", ".", "debug", "(", "\"Wrote to register 0x%0...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
Device.readList
Read a length number of bytes from the specified register. Results will be returned as a bytearray.
Adafruit_GPIO/I2C.py
def readList(self, register, length): """Read a length number of bytes from the specified register. Results will be returned as a bytearray.""" results = self._bus.read_i2c_block_data(self._address, register, length) self._logger.debug("Read the following from register 0x%02X: %s", ...
def readList(self, register, length): """Read a length number of bytes from the specified register. Results will be returned as a bytearray.""" results = self._bus.read_i2c_block_data(self._address, register, length) self._logger.debug("Read the following from register 0x%02X: %s", ...
[ "Read", "a", "length", "number", "of", "bytes", "from", "the", "specified", "register", ".", "Results", "will", "be", "returned", "as", "a", "bytearray", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L133-L139
[ "def", "readList", "(", "self", ",", "register", ",", "length", ")", ":", "results", "=", "self", ".", "_bus", ".", "read_i2c_block_data", "(", "self", ".", "_address", ",", "register", ",", "length", ")", "self", ".", "_logger", ".", "debug", "(", "\"...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
Device.readRaw8
Read an 8-bit value on the bus (without register).
Adafruit_GPIO/I2C.py
def readRaw8(self): """Read an 8-bit value on the bus (without register).""" result = self._bus.read_byte(self._address) & 0xFF self._logger.debug("Read 0x%02X", result) return result
def readRaw8(self): """Read an 8-bit value on the bus (without register).""" result = self._bus.read_byte(self._address) & 0xFF self._logger.debug("Read 0x%02X", result) return result
[ "Read", "an", "8", "-", "bit", "value", "on", "the", "bus", "(", "without", "register", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L141-L146
[ "def", "readRaw8", "(", "self", ")", ":", "result", "=", "self", ".", "_bus", ".", "read_byte", "(", "self", ".", "_address", ")", "&", "0xFF", "self", ".", "_logger", ".", "debug", "(", "\"Read 0x%02X\"", ",", "result", ")", "return", "result" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
Device.readU8
Read an unsigned byte from the specified register.
Adafruit_GPIO/I2C.py
def readU8(self, register): """Read an unsigned byte from the specified register.""" result = self._bus.read_byte_data(self._address, register) & 0xFF self._logger.debug("Read 0x%02X from register 0x%02X", result, register) return result
def readU8(self, register): """Read an unsigned byte from the specified register.""" result = self._bus.read_byte_data(self._address, register) & 0xFF self._logger.debug("Read 0x%02X from register 0x%02X", result, register) return result
[ "Read", "an", "unsigned", "byte", "from", "the", "specified", "register", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L148-L153
[ "def", "readU8", "(", "self", ",", "register", ")", ":", "result", "=", "self", ".", "_bus", ".", "read_byte_data", "(", "self", ".", "_address", ",", "register", ")", "&", "0xFF", "self", ".", "_logger", ".", "debug", "(", "\"Read 0x%02X from register 0x%...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
Device.readU16
Read an unsigned 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).
Adafruit_GPIO/I2C.py
def readU16(self, register, little_endian=True): """Read an unsigned 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).""" result = self._bus.read_word_data(self._address,register) & 0xFFFF self._logge...
def readU16(self, register, little_endian=True): """Read an unsigned 16-bit value from the specified register, with the specified endianness (default little endian, or least significant byte first).""" result = self._bus.read_word_data(self._address,register) & 0xFFFF self._logge...
[ "Read", "an", "unsigned", "16", "-", "bit", "value", "from", "the", "specified", "register", "with", "the", "specified", "endianness", "(", "default", "little", "endian", "or", "least", "significant", "byte", "first", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L162-L173
[ "def", "readU16", "(", "self", ",", "register", ",", "little_endian", "=", "True", ")", ":", "result", "=", "self", ".", "_bus", ".", "read_word_data", "(", "self", ".", "_address", ",", "register", ")", "&", "0xFFFF", "self", ".", "_logger", ".", "deb...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
get_platform_gpio
Attempt to return a GPIO instance for the platform which the code is being executed on. Currently supports only the Raspberry Pi using the RPi.GPIO library and Beaglebone Black using the Adafruit_BBIO library. Will throw an exception if a GPIO instance can't be created for the current platform. The r...
Adafruit_GPIO/GPIO.py
def get_platform_gpio(**keywords): """Attempt to return a GPIO instance for the platform which the code is being executed on. Currently supports only the Raspberry Pi using the RPi.GPIO library and Beaglebone Black using the Adafruit_BBIO library. Will throw an exception if a GPIO instance can't be cr...
def get_platform_gpio(**keywords): """Attempt to return a GPIO instance for the platform which the code is being executed on. Currently supports only the Raspberry Pi using the RPi.GPIO library and Beaglebone Black using the Adafruit_BBIO library. Will throw an exception if a GPIO instance can't be cr...
[ "Attempt", "to", "return", "a", "GPIO", "instance", "for", "the", "platform", "which", "the", "code", "is", "being", "executed", "on", ".", "Currently", "supports", "only", "the", "Raspberry", "Pi", "using", "the", "RPi", ".", "GPIO", "library", "and", "Be...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L408-L429
[ "def", "get_platform_gpio", "(", "*", "*", "keywords", ")", ":", "plat", "=", "Platform", ".", "platform_detect", "(", ")", "if", "plat", "==", "Platform", ".", "RASPBERRY_PI", ":", "import", "RPi", ".", "GPIO", "return", "RPiGPIOAdapter", "(", "RPi", ".",...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BaseGPIO.output_pins
Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values.
Adafruit_GPIO/GPIO.py
def output_pins(self, pins): """Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values. """ # General implementation just loops through pins and writes them out ...
def output_pins(self, pins): """Set multiple pins high or low at once. Pins should be a dict of pin name to pin value (HIGH/True for 1, LOW/False for 0). All provided pins will be set to the given values. """ # General implementation just loops through pins and writes them out ...
[ "Set", "multiple", "pins", "high", "or", "low", "at", "once", ".", "Pins", "should", "be", "a", "dict", "of", "pin", "name", "to", "pin", "value", "(", "HIGH", "/", "True", "for", "1", "LOW", "/", "False", "for", "0", ")", ".", "All", "provided", ...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L81-L91
[ "def", "output_pins", "(", "self", ",", "pins", ")", ":", "# General implementation just loops through pins and writes them out", "# manually. This is not optimized, but subclasses can choose to implement", "# a more optimal batch output implementation. See the MCP230xx class for", "# exampl...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
BaseGPIO.setup_pins
Setup multiple pins as inputs or outputs at once. Pins should be a dict of pin name to pin type (IN or OUT).
Adafruit_GPIO/GPIO.py
def setup_pins(self, pins): """Setup multiple pins as inputs or outputs at once. Pins should be a dict of pin name to pin type (IN or OUT). """ # General implementation that can be optimized by derived classes. for pin, value in iter(pins.items()): self.setup(pin, va...
def setup_pins(self, pins): """Setup multiple pins as inputs or outputs at once. Pins should be a dict of pin name to pin type (IN or OUT). """ # General implementation that can be optimized by derived classes. for pin, value in iter(pins.items()): self.setup(pin, va...
[ "Setup", "multiple", "pins", "as", "inputs", "or", "outputs", "at", "once", ".", "Pins", "should", "be", "a", "dict", "of", "pin", "name", "to", "pin", "type", "(", "IN", "or", "OUT", ")", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L93-L99
[ "def", "setup_pins", "(", "self", ",", "pins", ")", ":", "# General implementation that can be optimized by derived classes.", "for", "pin", ",", "value", "in", "iter", "(", "pins", ".", "items", "(", ")", ")", ":", "self", ".", "setup", "(", "pin", ",", "va...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
RPiGPIOAdapter.setup
Set the input or output mode for a specified pin. Mode should be either OUTPUT or INPUT.
Adafruit_GPIO/GPIO.py
def setup(self, pin, mode, pull_up_down=PUD_OFF): """Set the input or output mode for a specified pin. Mode should be either OUTPUT or INPUT. """ self.rpi_gpio.setup(pin, self._dir_mapping[mode], pull_up_down=self._pud_mapping[pull_up_down])
def setup(self, pin, mode, pull_up_down=PUD_OFF): """Set the input or output mode for a specified pin. Mode should be either OUTPUT or INPUT. """ self.rpi_gpio.setup(pin, self._dir_mapping[mode], pull_up_down=self._pud_mapping[pull_up_down])
[ "Set", "the", "input", "or", "output", "mode", "for", "a", "specified", "pin", ".", "Mode", "should", "be", "either", "OUTPUT", "or", "INPUT", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L183-L188
[ "def", "setup", "(", "self", ",", "pin", ",", "mode", ",", "pull_up_down", "=", "PUD_OFF", ")", ":", "self", ".", "rpi_gpio", ".", "setup", "(", "pin", ",", "self", ".", "_dir_mapping", "[", "mode", "]", ",", "pull_up_down", "=", "self", ".", "_pud_m...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
RPiGPIOAdapter.add_event_detect
Enable edge detection events for a particular GPIO channel. Pin should be type IN. Edge must be RISING, FALLING or BOTH. Callback is a function for the event. Bouncetime is switch bounce timeout in ms for callback
Adafruit_GPIO/GPIO.py
def add_event_detect(self, pin, edge, callback=None, bouncetime=-1): """Enable edge detection events for a particular GPIO channel. Pin should be type IN. Edge must be RISING, FALLING or BOTH. Callback is a function for the event. Bouncetime is switch bounce timeout in ms for callba...
def add_event_detect(self, pin, edge, callback=None, bouncetime=-1): """Enable edge detection events for a particular GPIO channel. Pin should be type IN. Edge must be RISING, FALLING or BOTH. Callback is a function for the event. Bouncetime is switch bounce timeout in ms for callba...
[ "Enable", "edge", "detection", "events", "for", "a", "particular", "GPIO", "channel", ".", "Pin", "should", "be", "type", "IN", ".", "Edge", "must", "be", "RISING", "FALLING", "or", "BOTH", ".", "Callback", "is", "a", "function", "for", "the", "event", "...
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L209-L220
[ "def", "add_event_detect", "(", "self", ",", "pin", ",", "edge", ",", "callback", "=", "None", ",", "bouncetime", "=", "-", "1", ")", ":", "kwargs", "=", "{", "}", "if", "callback", ":", "kwargs", "[", "'callback'", "]", "=", "callback", "if", "bounc...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
RPiGPIOAdapter.wait_for_edge
Wait for an edge. Pin should be type IN. Edge must be RISING, FALLING or BOTH.
Adafruit_GPIO/GPIO.py
def wait_for_edge(self, pin, edge): """Wait for an edge. Pin should be type IN. Edge must be RISING, FALLING or BOTH. """ self.rpi_gpio.wait_for_edge(pin, self._edge_mapping[edge])
def wait_for_edge(self, pin, edge): """Wait for an edge. Pin should be type IN. Edge must be RISING, FALLING or BOTH. """ self.rpi_gpio.wait_for_edge(pin, self._edge_mapping[edge])
[ "Wait", "for", "an", "edge", ".", "Pin", "should", "be", "type", "IN", ".", "Edge", "must", "be", "RISING", "FALLING", "or", "BOTH", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L241-L245
[ "def", "wait_for_edge", "(", "self", ",", "pin", ",", "edge", ")", ":", "self", ".", "rpi_gpio", ".", "wait_for_edge", "(", "pin", ",", "self", ".", "_edge_mapping", "[", "edge", "]", ")" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
RPiGPIOAdapter.cleanup
Clean up GPIO event detection for specific pin, or all pins if none is specified.
Adafruit_GPIO/GPIO.py
def cleanup(self, pin=None): """Clean up GPIO event detection for specific pin, or all pins if none is specified. """ if pin is None: self.rpi_gpio.cleanup() else: self.rpi_gpio.cleanup(pin)
def cleanup(self, pin=None): """Clean up GPIO event detection for specific pin, or all pins if none is specified. """ if pin is None: self.rpi_gpio.cleanup() else: self.rpi_gpio.cleanup(pin)
[ "Clean", "up", "GPIO", "event", "detection", "for", "specific", "pin", "or", "all", "pins", "if", "none", "is", "specified", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L247-L254
[ "def", "cleanup", "(", "self", ",", "pin", "=", "None", ")", ":", "if", "pin", "is", "None", ":", "self", ".", "rpi_gpio", ".", "cleanup", "(", ")", "else", ":", "self", ".", "rpi_gpio", ".", "cleanup", "(", "pin", ")" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
AdafruitBBIOAdapter.add_event_callback
Add a callback for an event already defined using add_event_detect(). Pin should be type IN. Bouncetime is switch bounce timeout in ms for callback
Adafruit_GPIO/GPIO.py
def add_event_callback(self, pin, callback, bouncetime=-1): """Add a callback for an event already defined using add_event_detect(). Pin should be type IN. Bouncetime is switch bounce timeout in ms for callback """ kwargs = {} if bouncetime > 0: kwargs['boun...
def add_event_callback(self, pin, callback, bouncetime=-1): """Add a callback for an event already defined using add_event_detect(). Pin should be type IN. Bouncetime is switch bounce timeout in ms for callback """ kwargs = {} if bouncetime > 0: kwargs['boun...
[ "Add", "a", "callback", "for", "an", "event", "already", "defined", "using", "add_event_detect", "()", ".", "Pin", "should", "be", "type", "IN", ".", "Bouncetime", "is", "switch", "bounce", "timeout", "in", "ms", "for", "callback" ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L318-L326
[ "def", "add_event_callback", "(", "self", ",", "pin", ",", "callback", ",", "bouncetime", "=", "-", "1", ")", ":", "kwargs", "=", "{", "}", "if", "bouncetime", ">", "0", ":", "kwargs", "[", "'bouncetime'", "]", "=", "bouncetime", "self", ".", "bbio_gpi...
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
AdafruitBBIOAdapter.wait_for_edge
Wait for an edge. Pin should be type IN. Edge must be RISING, FALLING or BOTH.
Adafruit_GPIO/GPIO.py
def wait_for_edge(self, pin, edge): """Wait for an edge. Pin should be type IN. Edge must be RISING, FALLING or BOTH. """ self.bbio_gpio.wait_for_edge(pin, self._edge_mapping[edge])
def wait_for_edge(self, pin, edge): """Wait for an edge. Pin should be type IN. Edge must be RISING, FALLING or BOTH. """ self.bbio_gpio.wait_for_edge(pin, self._edge_mapping[edge])
[ "Wait", "for", "an", "edge", ".", "Pin", "should", "be", "type", "IN", ".", "Edge", "must", "be", "RISING", "FALLING", "or", "BOTH", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L335-L339
[ "def", "wait_for_edge", "(", "self", ",", "pin", ",", "edge", ")", ":", "self", ".", "bbio_gpio", ".", "wait_for_edge", "(", "pin", ",", "self", ".", "_edge_mapping", "[", "edge", "]", ")" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4
valid
AdafruitBBIOAdapter.cleanup
Clean up GPIO event detection for specific pin, or all pins if none is specified.
Adafruit_GPIO/GPIO.py
def cleanup(self, pin=None): """Clean up GPIO event detection for specific pin, or all pins if none is specified. """ if pin is None: self.bbio_gpio.cleanup() else: self.bbio_gpio.cleanup(pin)
def cleanup(self, pin=None): """Clean up GPIO event detection for specific pin, or all pins if none is specified. """ if pin is None: self.bbio_gpio.cleanup() else: self.bbio_gpio.cleanup(pin)
[ "Clean", "up", "GPIO", "event", "detection", "for", "specific", "pin", "or", "all", "pins", "if", "none", "is", "specified", "." ]
adafruit/Adafruit_Python_GPIO
python
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/GPIO.py#L341-L348
[ "def", "cleanup", "(", "self", ",", "pin", "=", "None", ")", ":", "if", "pin", "is", "None", ":", "self", ".", "bbio_gpio", ".", "cleanup", "(", ")", "else", ":", "self", ".", "bbio_gpio", ".", "cleanup", "(", "pin", ")" ]
a92a23d6b5869663b2bc1ccf78bb11585076a9c4