@@ -51,45 +51,13 @@ def __init__(self, spi, chip_select, baudrate=100000, polarity=0, phase=0):
51
51
self .chip_select = chip_select
52
52
self .chip_select .switch_to_output (value = True )
53
53
54
- def read (self , buffer , ** kwargs ):
55
- """
56
- Read into ``buffer`` from the device. The number of bytes read will be the
57
- length of ``buffer``.
58
-
59
- If ``start`` or ``end`` is provided, then the buffer will be sliced
60
- as if ``buffer[start:end]``. This will not cause an allocation like
61
- ``buffer[start:end]`` will so it saves memory.
62
-
63
- :param bytearray buffer: buffer to write into
64
- :param int start: Index to start writing at
65
- :param int end: Index to write up to but not include
66
- """
67
- self .spi .read (buffer , ** kwargs )
68
-
69
- def write (self , buffer , ** kwargs ):
70
- """
71
- Write the bytes from ``buffer`` to the device. Transmits a stop bit if
72
- ``stop`` is set.
73
-
74
- If ``start`` or ``end`` is provided, then the buffer will be sliced
75
- as if ``buffer[start:end]``. This will not cause an allocation like
76
- ``buffer[start:end]`` will so it saves memory.
77
-
78
- :param bytearray buffer: buffer containing the bytes to write
79
- :param int start: Index to start writing from
80
- :param int end: Index to read up to but not include
81
- :param bool stop: If true, output an I2C stop condition after the
82
- buffer is written
83
- """
84
- self .spi .write (buffer , ** kwargs )
85
-
86
54
def __enter__ (self ):
87
55
while not self .spi .try_lock ():
88
56
pass
89
57
self .spi .configure (baudrate = self .baudrate , polarity = self .polarity ,
90
58
phase = self .phase )
91
59
self .chip_select .value = False
92
- return self
60
+ return self . spi
93
61
94
62
def __exit__ (self , * exc ):
95
63
self .chip_select .value = True
0 commit comments