Kenji Arai / Mbed OS DISCO-F769NI_several_example

Dependencies:   BD_SD_DISCO_F769NI BSP_DISCO_F769NI LCD_DISCO_F769NI TS_DISCO_F769NI USBHost_F769NI

Revision:
3:35ac9ee7d2d6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/z_example/10_DrawBitmap.cpp	Wed Aug 07 05:39:01 2019 +0000
@@ -0,0 +1,76 @@
+/*
+ * Mbed Application program
+ *  SD Card file control function with FatFs on Mbed-os5
+ *
+ * Copyright (c) 2018,'19 Kenji Arai / JH1PJL
+ *  http://www.page.sannet.ne.jp/kenjia/index.html
+ *  https://os.mbed.com/users/kenjiArai/
+ *      Created:    April      7th, 2018
+ *      Revised:    July      25th, 2019
+ */
+
+/*
+    https://os.mbed.com/users/Lightsource/code/DISCO-F746NG_BMP_FROM_SDCARD/
+    https://www.gimp.org/downloads/
+    https://os.mbed.com/questions/69098/how-can-I-load-an-image-to-screen/#answer14107
+ */
+
+#include "select_program.h"
+//#define EXAMPLE_10_BITMAP
+#ifdef EXAMPLE_10_BITMAP
+
+//  Include --------------------------------------------------------------------
+#include    "mbed.h"
+#include    "FATFileSystem.h"
+#include    "SDBlockDeviceDISCOF769NI.h"
+#include    "LCD_DISCO_F769NI.h"
+#include    "mon.h"
+#include    <stdlib.h>
+#include    <stdio.h>
+#include    <string>
+#include    <errno.h>
+
+//  Definition -----------------------------------------------------------------
+#define     USER_SW_ON      1
+
+//  Constructor ----------------------------------------------------------------
+DigitalOut          myled(LED1);
+DigitalIn           user_sw(USER_BUTTON);
+Serial              pc(USBTX, USBRX, 115200);
+LCD_DISCO_F769NI    lcd;
+// Instantiate the Block Device for sd card on DISCO-F769NI
+SDBlockDeviceDISCOF769NI bd;
+FATFileSystem       fs("fs");
+
+//  RAM ------------------------------------------------------------------------
+
+//  ROM / Constant data --------------------------------------------------------
+
+//  Function prototypes --------------------------------------------------------
+extern void drawImage(const char * name, uint16_t x, uint16_t y);
+
+//------------------------------------------------------------------------------
+//  Control Program
+//------------------------------------------------------------------------------
+int main()
+{
+    pc.printf("\x1b[2J\x1b[H %s\r\n %s %s (UTC)\r\n",
+              __FILE__, __DATE__, __TIME__);
+    lcd.Clear(LCD_COLOR_WHITE);
+    //Mounting SD-based filesystem
+    int error = fs.mount(&bd);
+    if (error != 0) {
+        pc.printf("retrun error/Failure. %d\r\n", error);
+    }
+    //Drawing BMP file from SD-card
+    drawImage("/fs/bmp/ty_big.bmp", 160, 200);
+    wait(10.0f);
+    lcd.Clear(LCD_COLOR_WHITE);
+    drawImage("/fs/bmp/ty.bmp", 50, 100);
+    drawImage("/fs/bmp/ty.bmp", 520, 350);
+    drawImage("/fs/bmp/nissan0.bmp", 0, 215);
+    drawImage("/fs/bmp/minion480x272.bmp", 300, 0);
+    mon();
+}
+
+#endif