SDcard sdcard.py rewrite for efficiency and function
This module has been heavily reworked. I went through the logic, and compared it to the SDCard standard, and found numerous ways it could be made faster, and work more reliably. Lots of code has disappeared. Also, it computes CRC7 on al commands (some cards didn't work without this), and has the option to compute CRC16 on data transfers, if the user provides a suitable function.
Thanks @mendenm -- at first glance this all looks very good. I will try to find some time soon to review in detail.
One quick note... we don't currently have a way to publish .mpy files with native code to mip, so we will need to solve that first. Also we will need a fallback implementation for devices that do not support loading native code.
@jimmo Is there any chance you can take a quick look at the PR to see if you can see why ruff keeps crashing (exiting with error 1)? Running is locally seems to return no problems, but I can't get past the github process.
Thanks.
On Nov 9, 2023, at 10:30 PM, Jim Mussared @.***> wrote:
Thanks @mendenm -- at first glance this all looks very good. I will try to find some time soon to review in detail. One quick note... we don't currently have a way to publish .mpy files with native code to mip, so we will need to solve that first. Also we will need a fallback implementation for devices that do not support loading native code. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@jimmo Is there any chance you can take a quick look at the PR to see if you can see why ruff keeps crashing (exiting with error 1)? Running is locally seems to return no problems, but I can't get past the github process.
Never mind, I got past it.
Thanks.
On Nov 9, 2023, at 10:30 PM, Jim Mussared @.***> wrote:
Thanks @mendenm -- at first glance this all looks very good. I will try to find some time soon to review in detail. One quick note... we don't currently have a way to publish .mpy files with native code to mip, so we will need to solve that first. Also we will need a fallback implementation for devices that do not support loading native code. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
As @jimmo mentioned we don't yet have support for @micropython.viper (or native or asm_thumb) in this repository, because the .py file is compiled to .mpy and that compilation must use a different architecture flag for different target machines, and hence we would need different .mpy files, one for each supported architecture.
So, to make progress with this PR I suggest:
- move the fast crc routines to example/util files which are not included in the
manifest.py, and hence not included in the distributed package - implement only the
crc7function and do it in pure Python - still support passing in a function for CRC16 data checks, the user can then copy the fast
crc16routines if they want to use this feature
I did a massive squash of the git repo, to get rid of all the drafts. I think this should be very close to consistent with comments and request. One thing I did not do was make gb() in _gb(). It's not really that private. Future users may want to parse other fields out the the big status block to get more info about their sdcards.