Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BSP_DISCO_F469NI SD_DISCO_F469NI mbed
Diff: main.cpp
- Revision:
- 2:fdce3ea5ef35
- Parent:
- 0:354f8b7c3755
--- a/main.cpp Fri Mar 18 15:21:59 2016 +0000
+++ b/main.cpp Wed May 17 13:05:57 2017 +0200
@@ -9,23 +9,21 @@
Serial pc(USBTX, USBRX);
#define BLOCK_START_ADDR 0 /* Block start address */
-#define BLOCKSIZE 512 /* Block Size in Bytes */
#define NUM_OF_BLOCKS 5 /* Total number of blocks */
-#define BUFFER_WORDS_SIZE ((BLOCKSIZE * NUM_OF_BLOCKS) >> 2) /* Total data size in bytes */
+#define BUFFER_WORDS_SIZE ((512 * NUM_OF_BLOCKS) >> 2) /* Total data size in bytes */
uint32_t aTxBuffer[BUFFER_WORDS_SIZE];
uint32_t aRxBuffer[BUFFER_WORDS_SIZE];
/* Private function prototypes -----------------------------------------------*/
void SD_main_test(void);
void SD_Detection(void);
-void HAL_Delay(__IO uint32_t Delay);
static void Fill_Buffer(uint32_t *pBuffer, uint32_t uwBufferLenght, uint32_t uwOffset);
static uint8_t Buffercmp(uint32_t* pBuffer1, uint32_t* pBuffer2, uint16_t BufferLength);
int main()
{
- uint8_t SD_state = SD_OK;
+ uint8_t SD_state = MSD_OK;
pc.printf("SD\n");
pc.printf("This example shows how to write\n");
pc.printf("and read data on the microSD and also\n");
@@ -33,7 +31,7 @@
led_red = 0;
SD_state = sd.Init();
- if(SD_state != SD_OK){
+ if(SD_state != MSD_OK){
if(SD_state == MSD_ERROR_SD_NOT_PRESENT){
pc.printf("SD shall be inserted before running test\n");
} else {
@@ -43,7 +41,7 @@
} else {
pc.printf("SD Initialization : OK.\n");
- if(sd.Erase(BLOCK_START_ADDR, (BLOCKSIZE * NUM_OF_BLOCKS)) != SD_OK){
+ if(sd.Erase(BLOCK_START_ADDR, (512 * NUM_OF_BLOCKS)) != MSD_OK){
pc.printf("SD ERASE : FAILED.\n");
pc.printf("SD Test Aborted.\n");
} else {
@@ -52,13 +50,13 @@
/* Fill the buffer to write */
Fill_Buffer(aTxBuffer, BUFFER_WORDS_SIZE, 0x22FF);
- if(sd.WriteBlocks(aTxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS) != SD_OK){
+ if(sd.WriteBlocks(aTxBuffer, BLOCK_START_ADDR, NUM_OF_BLOCKS, SD_DATATIMEOUT) != MSD_OK){
pc.printf("SD WRITE : FAILED.\n");
pc.printf("SD Test Aborted.\n");
} else {
pc.printf("SD WRITE : OK.\n");
- if(sd.ReadBlocks(aRxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS)!= SD_OK){
+ if(sd.ReadBlocks(aRxBuffer, BLOCK_START_ADDR, NUM_OF_BLOCKS, SD_DATATIMEOUT)!= MSD_OK){
pc.printf("SD READ : FAILED.\n");
pc.printf("SD Test Aborted.\n");
} else {
@@ -119,21 +117,3 @@
return 0;
}
-
-
-/**
- * @brief This function provides accurate delay (in milliseconds) based
- * on variable incremented.
- * @note In the default implementation , SysTick timer is the source of time base.
- * It is used to generate interrupts at regular time intervals where uwTick
- * is incremented.
- * @note This function is the modified version of the __weak version contained in
- * stm32f4xx_hal.c
- * @param Delay: specifies the delay time length, in milliseconds.
- * @retval None
- */
-void HAL_Delay(__IO uint32_t Delay)
-{
- wait_ms((int)Delay);
-}
-