adafruit / Adafruit_CircuitPython_SD

SD card drivers for Adafruit CircuitPython
MIT License
37 stars 17 forks source link

Make compatible with native adafruit_bus_device #43

Closed dhalbert closed 3 years ago

dhalbert commented 3 years ago

Fixes #42.

Make compatible with native adafruit_bus_device module:

@jfabernathy try it out if you like.

Tested on a PyPortal with the latest main CircuitPython build.

dhalbert commented 3 years ago

Thanks @jepler for pointing out my error. My SD card seems to tolerate not actually doing the 74-81 clock cycles and still works. It was easiest to just force CS high inside the with, rather than write extra setup code for the initialization.

jfabernathy commented 3 years ago

I only tested this on the Raspbery Pi Pico. I tested both the simple test that prints out the directory of files, and a program that logs the cpu[0] temperature to the sdcard. Both work after you change the board.??? to match the board.GP? numbers the Pico uses. In my case SCK = GP2, MOSI = GP3, MISO= GP4, and CS=GP5.