-
Notifications
You must be signed in to change notification settings - Fork 47
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
Dynamic configuration #12
Conversation
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.
I've tried the changes in my application and they work fine... many thanks! I've added a few comments which relate to a potential minor tidy up of the interface. I don't think sd_get_by_name() or get_fs_by_name() form a part of it... any more. Apologies, if this is my misunderstanding.
simple_example/hw_config.c
Outdated
FATFS *get_fs_by_name(const char *name) { | ||
for (size_t i = 0; i < sd_get_num(); ++i) | ||
if (0 == strcmp(sd_cards[i].pcName, name)) return &sd_cards[i].fatfs; | ||
DBG_PRINTF("%s: unknown name %s\n", __func__, name); | ||
return NULL; | ||
} |
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.
Possibly redundant? Perhaps get_fs_by_name should be removed from hw_config.h?
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.
OK, I moved sd_get_by_name and get_fs_by_name out of hw_config.
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.
Cheers
simple_example/hw_config.c
Outdated
sd_card_t *sd_get_by_name(const char *const name) { | ||
for (size_t i = 0; i < sd_get_num(); ++i) | ||
if (0 == strcmp(sd_cards[i].pcName, name)) return &sd_cards[i]; | ||
DBG_PRINTF("%s: unknown name %s\n", __func__, name); | ||
return NULL; | ||
} |
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.
Possibly redundant? Perhaps sd_get_by_name should be removed from hw_config.h?
dynamic_config_example/hw_config.cpp
Outdated
sd_card_t *sd_get_by_name(const char *name) { | ||
for (size_t i = 0; i < sd_get_num(); ++i) | ||
if (0 == strcmp(sd_cards[i]->pcName, name)) return sd_cards[i]; | ||
DBG_PRINTF("%s: unknown name %s\n", __func__, name); | ||
return NULL; | ||
} |
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.
Possibly redundant? Perhaps sd_get_by_name should be removed from hw_config.h?
dynamic_config_example/hw_config.cpp
Outdated
FATFS *get_fs_by_name(const char *name) { | ||
for (size_t i = 0; i < sd_get_num(); ++i) | ||
if (0 == strcmp(sd_cards[i]->pcName, name)) return &sd_cards[i]->fatfs; | ||
DBG_PRINTF("%s: unknown name %s\n", __func__, name); | ||
return NULL; | ||
} |
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.
Possibly redundant? Perhaps get_fs_by_name should be removed from hw_config.h?
Move hw_config.c out of FatFs_SPI library so that the library can better function as a submodule.
Add dynamic configuration example in directory dynamic_config_example.