-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conversation
/** | ||
* 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 ) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
@AniruddhaKanhere and @htibosch - Here's the modifications to the API and a fix for #50 that I'm now using. 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. |
Closing this in favor of: #51 |
Description
Test Steps
Checklist:
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.