summaryrefslogtreecommitdiffstatshomepage
path: root/drivers/sdcard/sdcard.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-04-23 11:35:34 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-05-21 17:44:58 +0300
commit1c9ee497562ab49c00d190ff91b6689979f922f4 (patch)
tree241a0dcc471b70f142ad637b35b6b4a69ee2452f /drivers/sdcard/sdcard.py
parentbcf31a39087bd7727e15105363063980120fd528 (diff)
downloadmicropython-1c9ee497562ab49c00d190ff91b6689979f922f4.tar.gz
micropython-1c9ee497562ab49c00d190ff91b6689979f922f4.zip
drivers: Replace deprecated Pin.high()/low() methods with .__call__(1/0).
Diffstat (limited to 'drivers/sdcard/sdcard.py')
-rw-r--r--drivers/sdcard/sdcard.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/sdcard/sdcard.py b/drivers/sdcard/sdcard.py
index cbf4474158..e749d5376f 100644
--- a/drivers/sdcard/sdcard.py
+++ b/drivers/sdcard/sdcard.py
@@ -130,7 +130,7 @@ class SDCard:
raise OSError("timeout waiting for v2 card")
def cmd(self, cmd, arg, crc, final=0, release=True):
- self.cs.low()
+ self.cs(0)
# create and send the command
buf = self.cmdbuf
@@ -150,12 +150,12 @@ class SDCard:
for j in range(final):
self.spi.write(b'\xff')
if release:
- self.cs.high()
+ self.cs(1)
self.spi.write(b'\xff')
return response
# timeout
- self.cs.high()
+ self.cs(1)
self.spi.write(b'\xff')
return -1
@@ -164,15 +164,15 @@ class SDCard:
self.spi.read(1, 0xff) # ignore stuff byte
for _ in range(_CMD_TIMEOUT):
if self.spi.read(1, 0xff)[0] == 0xff:
- self.cs.high()
+ self.cs(1)
self.spi.write(b'\xff')
return 0 # OK
- self.cs.high()
+ self.cs(1)
self.spi.write(b'\xff')
return 1 # timeout
def readinto(self, buf):
- self.cs.low()
+ self.cs(0)
# read until start byte (0xff)
while self.spi.read(1, 0xff)[0] != 0xfe:
@@ -186,11 +186,11 @@ class SDCard:
self.spi.write(b'\xff')
self.spi.write(b'\xff')
- self.cs.high()
+ self.cs(1)
self.spi.write(b'\xff')
def write(self, token, buf):
- self.cs.low()
+ self.cs(0)
# send: start of block, data, checksum
self.spi.read(1, token)
@@ -200,7 +200,7 @@ class SDCard:
# check the response
if (self.spi.read(1, 0xff)[0] & 0x1f) != 0x05:
- self.cs.high()
+ self.cs(1)
self.spi.write(b'\xff')
return
@@ -208,18 +208,18 @@ class SDCard:
while self.spi.read(1, 0xff)[0] == 0:
pass
- self.cs.high()
+ self.cs(1)
self.spi.write(b'\xff')
def write_token(self, token):
- self.cs.low()
+ self.cs(0)
self.spi.read(1, token)
self.spi.write(b'\xff')
# wait for write to finish
while self.spi.read(1, 0xff)[0] == 0x00:
pass
- self.cs.high()
+ self.cs(1)
self.spi.write(b'\xff')
def count(self):