SRAM demo using ST BSP driver.

Dependencies:   BSP_DISCO_L496AG

Revision:
3:727e0290bde8
Parent:
2:3fbe5f24c51d
diff -r 3fbe5f24c51d -r 727e0290bde8 main.cpp
--- a/main.cpp	Wed Apr 18 08:50:07 2018 +0000
+++ b/main.cpp	Fri Nov 22 16:06:21 2019 +0100
@@ -12,8 +12,6 @@
 __IO uint8_t  write_complete = 0;
 
 static void print_demo_title(void);
-static void print_PASS(void);
-static void print_FAIL(void);
 static void Fill_Buffer(uint16_t *pBuffer, uint32_t uwBufferLength, uint32_t uwOffset);
 static uint8_t Buffercmp(uint16_t* pBuffer1, uint16_t* pBuffer2, uint16_t BufferLength);
 
@@ -21,17 +19,16 @@
 {
     print_demo_title();
 
-    wait(0.2);
+    ThisThread::sleep_for(500);
 
     /*##-1- Configure the SRAM device ##########################################*/
     if (BSP_SRAM_Init() == SRAM_OK) {
         BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"SRAM INIT OK", LEFT_MODE);
     } else {
         BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"SRAM INIT FAIL", LEFT_MODE);
-        print_FAIL();
     }
 
-    wait(0.2);
+    ThisThread::sleep_for(500);
 
     /*##-2- SRAM memory read/write access ######################################*/
 
@@ -45,31 +42,25 @@
         BSP_LCD_DisplayStringAt(0, LINE(6), (uint8_t *)"SRAM WRITE OK", LEFT_MODE);
     } else {
         BSP_LCD_DisplayStringAt(0, LINE(6), (uint8_t *)"SRAM WRITE FAIL", LEFT_MODE);
-        print_FAIL();
     }
 
-    wait(0.2);
+    ThisThread::sleep_for(500);
 
     /* Read back data from the SRAM memory */
     if (BSP_SRAM_ReadData(SRAM_DEVICE_ADDR + SRAM_WRITE_READ_ADDR, sram_aRxBuffer, BUFFER_SIZE) == SRAM_OK) {
         BSP_LCD_DisplayStringAt(0, LINE(7), (uint8_t *)"SRAM READ OK", LEFT_MODE);
     } else {
         BSP_LCD_DisplayStringAt(0, LINE(7), (uint8_t *)"SRAM READ FAIL", LEFT_MODE);
-        print_FAIL();
     }
 
-    wait(0.2);
+    ThisThread::sleep_for(1000);
 
     /* Check read data */
     if (Buffercmp(sram_aRxBuffer, sram_aTxBuffer, BUFFER_SIZE) == 0) {
         BSP_LCD_DisplayStringAt(0, LINE(8), (uint8_t *)"SRAM COMPARE OK", LEFT_MODE);
     } else {
         BSP_LCD_DisplayStringAt(0, LINE(8), (uint8_t *)"SRAM COMPARE FAIL", LEFT_MODE);
-        print_FAIL();
     }
-
-    wait(0.2);
-    print_PASS();
 }
 
 static void print_demo_title(void)
@@ -90,20 +81,6 @@
     BSP_LCD_SetFont(&Font20);
 }
 
-static void print_PASS(void)
-{
-    BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
-    BSP_LCD_SetBackColor(LCD_COLOR_GREEN);
-    BSP_LCD_DisplayStringAt(0, LINE(10), (uint8_t *)"Demo OK", CENTER_MODE);
-    while(1);
-}
-
-static void print_FAIL(void)
-{
-    BSP_LCD_SetBackColor(LCD_COLOR_RED);
-    BSP_LCD_DisplayStringAt(0, LINE(10), (uint8_t *)"Demo FAILED", CENTER_MODE);
-    while(1);
-}
 
 /**
   * @brief  Fills buffer with user predefined data.