Skip to content

Commit

Permalink
fix(SDHC): Fix SDHC Driver Clock Divider for MAX78002 (#800)
Browse files Browse the repository at this point in the history
Co-authored-by: Sihyung Woo <[email protected]>
  • Loading branch information
Jake-Carter and sihyung-maxim authored Dec 22, 2023
1 parent ade28ae commit 934bdb3
Show file tree
Hide file tree
Showing 21 changed files with 841 additions and 570 deletions.
6 changes: 4 additions & 2 deletions Examples/MAX78002/SDHC_FAT/.cproject
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/PeriphDrivers/Include/${TARGET}/&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/Boards/${TARGET}/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/Boards/${TARGET}/${BOARD}/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/SDHC/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/SDHC/ff13/Source&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/CLI/inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/SDHC/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/SDHC/ff15/Source&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/SDHC/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/MiscDrivers/Camera&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/MiscDrivers/Display&quot;"/>
<listOptionValue builtIn="false" value="&quot;${MAXIM_PATH}/Libraries/MiscDrivers/EEPROM&quot;"/>
Expand Down
11 changes: 4 additions & 7 deletions Examples/MAX78002/SDHC_FAT/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@
"${config:MAXIM_PATH}/Libraries/MiscDrivers/PMIC",
"${config:MAXIM_PATH}/Libraries/MiscDrivers/PushButton",
"${config:MAXIM_PATH}/Libraries/MiscDrivers/Touchscreen",
"${config:MAXIM_PATH}/Libraries/CLI/inc",
"${config:MAXIM_PATH}/Libraries/SDHC/Include",
"${config:MAXIM_PATH}/Libraries/SDHC/ff13/Source",
"${config:MAXIM_PATH}/Libraries/MiscDrivers/EEPROM",
"${config:MAXIM_PATH}/Libraries/MiscDrivers/CODEC"
"${config:MAXIM_PATH}/Libraries/SDHC/ff15/Source"
],
"C_Cpp.default.browse.path": [
"${workspaceFolder}",
Expand All @@ -70,10 +69,8 @@
"${config:MAXIM_PATH}/Libraries/MiscDrivers/PushButton",
"${config:MAXIM_PATH}/Libraries/MiscDrivers/Touchscreen",
"${config:MAXIM_PATH}/Libraries/MiscDrivers",
"${config:MAXIM_PATH}/Libraries/SDHC/ff13/Source",
"${config:MAXIM_PATH}/Libraries/MiscDrivers/ADC",
"${config:MAXIM_PATH}/Libraries/MiscDrivers/EEPROM",
"${config:MAXIM_PATH}/Libraries/MiscDrivers/CODEC"
"${config:MAXIM_PATH}/Libraries/CLI/src",
"${config:MAXIM_PATH}/Libraries/SDHC/ff15/Source"
],
"C_Cpp.default.defines": [

Expand Down
70 changes: 70 additions & 0 deletions Examples/MAX78002/SDHC_FAT/include/app-sdhc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/******************************************************************************
*
* Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. This software
* is proprietary to Analog Devices, Inc. and its licensors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/

#ifndef EXAMPLES_MAX78002_SDHC_FAT_INCLUDE_APP_SDHC_H_
#define EXAMPLES_MAX78002_SDHC_FAT_INCLUDE_APP_SDHC_H_

/***** Includes *****/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include "board.h"
#include "mxc_delay.h"
#include "mxc_device.h"
#include "gpio.h"
#include "uart.h"
#include "ff.h"

/***** Definitions *****/

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define MAXLEN 256

/***** FUNCTION PROTOTYPES *****/

void generateMessage(unsigned length);

int mount();

int umount();

int formatSDHC();

int getSize();

int ls();

int createFile(char *file_name, unsigned int length);

int appendFile(char *file_name, unsigned int length);

int mkdir(char *dir_name);

int cd(char *dir_name);

int deleteFile(char *file_name);

int example();

void waitCardInserted();

#endif // EXAMPLES_MAX78002_SDHC_FAT_INCLUDE_APP_SDHC_H_
54 changes: 54 additions & 0 deletions Examples/MAX78002/SDHC_FAT/include/user-cli.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/******************************************************************************
*
* Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. This software
* is proprietary to Analog Devices, Inc. and its licensors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/

#ifndef EXAMPLES_MAX78002_SDHC_FAT_INCLUDE_USER_CLI_H_
#define EXAMPLES_MAX78002_SDHC_FAT_INCLUDE_USER_CLI_H_

/* -------------------------------------------------- */
// GLOBAL VARIABLE
/* -------------------------------------------------- */
extern const command_t user_commands[];
extern const unsigned int num_user_commands;

/* -------------------------------------------------- */
// FUNCTION PROTOTYPES
/* -------------------------------------------------- */
int handle_size(int argc, char *argv[]);

int handle_format(int argc, char *argv[]);

int handle_mount(int argc, char *argv[]);

int handle_ls(int argc, char *argv[]);

int handle_mkdir(int argc, char *argv[]);

int handle_createfile(int argc, char *argv[]);

int handle_cd(int argc, char *argv[]);

int handle_add_data(int argc, char *argv[]);

int handle_del(int argc, char *argv[]);

int handle_fatfs(int argc, char *argv[]);

int handle_unmount(int argc, char *argv[]);

#endif // EXAMPLES_MAX78002_SDHC_FAT_INCLUDE_USER_CLI_H_
Loading

0 comments on commit 934bdb3

Please sign in to comment.