Merge pull request #6873 from AlienWiiBF/SDCARD_GENERIC

Update SDCARD driver for generic target
This commit is contained in:
Michael Keller 2018-10-05 08:52:46 +13:00 committed by GitHub
commit a5a0f9aa73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 8 deletions

View File

@ -189,7 +189,7 @@ static bool sdcard_checkInitDone(void)
*/
static void sdcardSdio_init(const sdcardConfig_t *config)
{
sdcard.enabled = config->enabled;
sdcard.enabled = config->mode;
if (!sdcard.enabled) {
sdcard.state = SDCARD_STATE_NOT_PRESENT;
return;

View File

@ -470,7 +470,7 @@ static bool sdcard_checkInitDone(void)
*/
static void sdcardSpi_init(const sdcardConfig_t *config)
{
sdcard.enabled = config->enabled;
sdcard.enabled = config->mode;
if (!sdcard.enabled) {
sdcard.state = SDCARD_STATE_NOT_PRESENT;
return;

View File

@ -635,7 +635,7 @@ void init(void)
#ifdef USE_SDCARD
if (blackboxConfig()->device == BLACKBOX_DEVICE_SDCARD) {
if (sdcardConfig()->enabled) {
if (sdcardConfig()->mode) {
sdcardInsertionDetectInit();
sdcard_init(sdcardConfig());
afatfs_init();

View File

@ -33,12 +33,11 @@
#include "drivers/io.h"
#include "drivers/dma.h"
PG_REGISTER_WITH_RESET_FN(sdcardConfig_t, sdcardConfig, PG_SDCARD_CONFIG, 0);
PG_REGISTER_WITH_RESET_FN(sdcardConfig_t, sdcardConfig, PG_SDCARD_CONFIG, 1);
void pgResetFn_sdcardConfig(sdcardConfig_t *config)
{
config->useDma = false;
config->enabled = 0;
config->device = SPI_DEV_TO_CFG(SPIINVALID);
config->mode = SDCARD_MODE_NONE;
@ -47,7 +46,6 @@ void pgResetFn_sdcardConfig(sdcardConfig_t *config)
#ifdef USE_SDCARD_SDIO
config->mode = SDCARD_MODE_SDIO;
config->enabled = 1;
#endif
#ifdef USE_SDCARD_SPI
@ -56,7 +54,6 @@ void pgResetFn_sdcardConfig(sdcardConfig_t *config)
config->chipSelectTag = IO_TAG(SDCARD_SPI_CS_PIN);
if (spidevice != SPIINVALID && config->chipSelectTag) {
config->enabled = 1;
config->mode = SDCARD_MODE_SPI;
}
#endif

View File

@ -31,7 +31,6 @@ typedef enum {
typedef struct sdcardConfig_s {
uint8_t useDma;
uint8_t enabled;
int8_t device;
ioTag_t cardDetectTag;
ioTag_t chipSelectTag;