Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added API allowing user to choose settings at runtime #49

Closed
wants to merge 6 commits into from

Conversation

AniruddhaKanhere
Copy link
Member

Description

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AniruddhaKanhere AniruddhaKanhere requested a review from a team as a code owner August 1, 2023 19:58
@AniruddhaKanhere AniruddhaKanhere mentioned this pull request Aug 1, 2023
2 tasks
Comment on lines +440 to +447
/**
* Initialize the SD Disk with configurable settings
* @param[in] uxMountFailIgnore ignore fails on mount, set to true when have systems where may not have initialized mount
* @param[in] uxDiskPartition the disk partition number to use
*/
BaseType_t xDiskPartition = 0;

FF_Disk_t * FF_SDDiskInit( const char * pcName )
FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName,
BaseType_t xMountFailIgnore,
BaseType_t xDiskPartition )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One slight change to allow for future proofing this.

Suggest putting all of the settings into a struct:

typedef struct FFInitSettings_s
{
BaseType_t xMountFailIgnore;
BaseType_t xDiskPartition;
} FFInitSettings_t;

And then change the API to:

FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName,
                                       const FFInitSettings_t * settings)

That way you can append to the settings later on without changing the API - as long as the defaults are something reasonable (most likely candidate) the API doesn't have to change for new initialization configuration settings.

@AniruddhaKanhere - you are also missing adding the API to the header file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phelter , yes a good idea to put it into a struct. The only obligation will be to clear all (unused) fields in the struct. Thanks, Hein

@phelter
Copy link
Contributor

phelter commented Aug 8, 2023

@AniruddhaKanhere and @htibosch -

Here's the modifications to the API and a fix for #50 that I'm now using.
https://github.com/FreeRTOS/Lab-Project-FreeRTOS-FAT/compare/main...phelter:Lab-Project-FreeRTOS-FAT:runtime-init-settings?expand=1

Feel free to use this or modify it as needed.

For all implementations but Zynq.2019.3 - uses original implementation - both WithSettings version and not do the same thing. For the Zynq.2019.3 version - you have full control.

@AniruddhaKanhere
Copy link
Member Author

Closing this in favor of: #51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants