PaulStoffregen / LittleFS

73 stars 20 forks source link

Add simple wrapper classes for SPI and QSPI #39

Closed KurtE closed 2 years ago

KurtE commented 2 years ago

@PaulStoffregen @mjs513 @Defragster

As mentioned earlier on forum thread, here is the simple wrappers I have been using.

Note: I had/have to modify the few sketches that have their own copies of these...

So if you are not sure which type of storage you might have on your different boards, you can use the combine class which includes a member of the different known littlefs clases for SPI or QSPI and the begin method will check one after another until their begin method succeeds

KurtE commented 2 years ago

@PaulStoffregen (and all) I was debating with myself on class names... Currently I have: lfs_qspi and lfs_spi

Alternative are names like LittleFS_SPI which may make more sense, other than they don't themselves derive from LittleFs class

PaulStoffregen commented 2 years ago

Please use LittleFS_SPI and LittleFS_QSPI.

As a bare minimum, these need to inherit FS. Did something turn out to be impractical about inheriting from LittleFS class?

KurtE commented 2 years ago

I had an earlier version like this that I will reproduce. Feel safer deriving from FS, but will still leave a call to get the LittleFS...

PaulStoffregen commented 2 years ago

FS should be fine, just so we can pass instances of these wrapper classes to MTP, and other stuff which will access filesystems.

I need to work on an urgent test fixture issue right now (the joys of manufacturing) but should be able to work on this later today.

KurtE commented 2 years ago

I just pushed up new version that is based off of FS class, I then do overrides of all of the FS methods.

Not sure what you will think of the way to bypass having to check for NULL in these methods....

PaulStoffregen commented 2 years ago

Merging this now. But looks like usedSize() and totalSize() might need a little more work?

KurtE commented 2 years ago

Yep missed those simply pfs->calls will do in morning

Sent from my iPad

On Dec 16, 2021, at 6:30 PM, Paul Stoffregen @.***> wrote:

 Merged #39 into main.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

PaulStoffregen commented 2 years ago

Pretty soon I need to package up a stable 1.56 release. Definitely want to get this in. The USB host MSC stuff probably also makes sense for 1.56, but I want to review the public API before merging. Will do that today or this weekend.

KurtE commented 2 years ago

Pushed up fix #40 to the used/total sizes also ran it through using MTP test sketch

From: Paul Stoffregen @.> Sent: Thursday, December 16, 2021 6:31 PM To: PaulStoffregen/LittleFS @.> Cc: KurtE @.>; Author @.> Subject: Re: [PaulStoffregen/LittleFS] Add simple wrapper classes for SPI and QSPI (PR #39)

Merging this now. But looks like usedSize() and totalSize() might need a little more work?

— Reply to this email directly, view it on GitHub https://github.com/PaulStoffregen/LittleFS/pull/39#issuecomment-996385522 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL4MQGXLYTO3P5VO7ERXCDURKOEPANCNFSM5KGTJGUA . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AAL4MQBNTEO7LYQRNLBMWH3URKOEPA5CNFSM5KGTJGUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHNR2F4Q.gif Message ID: @. @.> >