tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
604 stars 188 forks source link

sdcard: support thingplus-rp2040 #405

Closed oflebbe closed 2 years ago

oflebbe commented 2 years ago

The instances of SPI interfaces SPI0, SPI1, ... are pointers to SPI types on rp2040 machines, rather plain values like other machines.

This needs restructuring the sdcard API to take a pointer to the SPI interface rather the SPI type itself.

A different issue is the Serial.DTR signal to be used in the example code. The current UART code does not implement the modem control signals. Here is a workaround for not having this functionality. Maybe it would be simpler to simply remove waiting for serial line to come alive ?

deadprogram commented 2 years ago

This needs restructuring the sdcard API to take a pointer to the SPI interface rather the SPI type itself.

This is a good thing anyhow. Most of the other SPI devices are using the drivers.SPI interface. The only reason the SD care does not (yet?) is because supporting Configure() was not quite as simple, and the SDCard driver needs that to reconfigure the interface to kick up to high-speed.

So in short, this seems like a fine change to make.

Maybe it would be simpler to simply remove waiting for serial line to come alive ?

I am in favor of removing that code as well.

oflebbe commented 2 years ago

Updated PR

deadprogram commented 2 years ago

Thank you for the contribution @oflebbe and for the review @sago35 now merging.