Removed redundant weakref references

Also tweaked a couple of minor bits (SPI bus init mask) and unused
_get_address override
This commit is contained in:
Dave Jones
2016-10-21 10:43:58 +01:00
parent ce6217c14f
commit 4d79dc74db
6 changed files with 7 additions and 9 deletions

View File

@@ -7,7 +7,6 @@ from __future__ import (
str = type('')
import io
import weakref
import warnings
try:

View File

@@ -13,7 +13,6 @@ import mmap
import errno
import struct
import warnings
import weakref
from time import sleep
from threading import Thread, Event, Lock
from collections import Counter

View File

@@ -179,9 +179,6 @@ class PiGPIOPin(PiPin):
self.function = 'input'
self.pull = 'up' if self.factory.pi_info.pulled_up('GPIO%d' % self.number) else 'floating'
def _get_address(self):
return self.factory.address + ('GPIO%d' % self.number,)
def _get_function(self):
return self.GPIO_FUNCTION_NAMES[self.factory.connection.get_mode(self.number)]

View File

@@ -7,7 +7,6 @@ from __future__ import (
str = type('')
import warnings
import weakref
from RPi import GPIO
from .local import LocalPiFactory, LocalPiPin

View File

@@ -8,7 +8,6 @@ str = type('')
import warnings
import weakref
import RPIO
import RPIO.PWM
from RPIO.Exceptions import InvalidChannelException

View File

@@ -64,9 +64,14 @@ class SPISoftwareBus(SharedMixin, Device):
"""
result = []
with self.lock:
shift = operator.lshift if lsb_first else operator.rshift
if lsb_first:
shift = operator.lshift
init_mask = 1
else:
shift = operator.rshift
init_mask = 1 << (bits_per_word - 1)
for write_word in data:
mask = 1 if lsb_first else 1 << (bits_per_word - 1)
mask = init_mask
read_word = 0
for _ in range(bits_per_word):
if self.mosi is not None: