Line buffer mode. sammple code with MIP8F_SPI_Ver40

Dependencies:   MIP8F_SPI_Ver40 mbed

Dependents:   MIP8f_FRDM_TransferMode_sample MIP8f_FRDM_Animation_sample

Introduction

Line buffer mode sample with MIP8F_SPI_Ver40 Display some color and monochrome bitmap.

Other information , please refer to https://os.mbed.com/teams/JapanDisplayInc/code/MIP8f_FRDM_sample/

Usage

Copy Setting File and Image to micro SD-CARD. (Same setting File and bitmap of MIP8f_FRDM_sample.)

a) Download the following file corresponding to the target panel, and rename file identifier (.bin -> .zip), and unzip the file on micro SD Card's root directory.

b) Insert micro SD-CARD to FRDM-K64F. c) Upload binary file to FRDM-K64F.and push Reset Button.

Other information

refer to Usage on https://os.mbed.com/teams/JapanDisplayInc/code/MIP8f_FRDM_sample/

this Sample Code (.bin)

/media/uploads/JDI_Mbed_Team/mip8f_frdm_linebuffer_sample.k64f.bin

Committer:
JDI_Mbed_Team
Date:
Tue Nov 06 03:57:02 2018 +0000
Revision:
13:855affe061f7
Parent:
0:33fe30a2b785
Line buffer mode. sample code with MIP8F_SPI_Ver40

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JDI_Mbed_Team 0:33fe30a2b785 1 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 2 /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2014 */
JDI_Mbed_Team 0:33fe30a2b785 3 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 4 /* If a working storage control module is available, it should be */
JDI_Mbed_Team 0:33fe30a2b785 5 /* attached to the FatFs via a glue function rather than modifying it. */
JDI_Mbed_Team 0:33fe30a2b785 6 /* This is an example of glue functions to attach various exsisting */
JDI_Mbed_Team 0:33fe30a2b785 7 /* storage control modules to the FatFs module with a defined API. */
JDI_Mbed_Team 0:33fe30a2b785 8 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 9
JDI_Mbed_Team 0:33fe30a2b785 10 #include "diskio.h"
JDI_Mbed_Team 0:33fe30a2b785 11 #include "mbed_debug.h"
JDI_Mbed_Team 0:33fe30a2b785 12 #include "FATFileSystem.h"
JDI_Mbed_Team 0:33fe30a2b785 13
JDI_Mbed_Team 0:33fe30a2b785 14 using namespace mbed;
JDI_Mbed_Team 0:33fe30a2b785 15
JDI_Mbed_Team 0:33fe30a2b785 16 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 17 /* Get Drive Status */
JDI_Mbed_Team 0:33fe30a2b785 18 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 19
JDI_Mbed_Team 0:33fe30a2b785 20 DSTATUS disk_status (
JDI_Mbed_Team 0:33fe30a2b785 21 BYTE pdrv /* Physical drive nmuber to identify the drive */
JDI_Mbed_Team 0:33fe30a2b785 22 )
JDI_Mbed_Team 0:33fe30a2b785 23 {
JDI_Mbed_Team 0:33fe30a2b785 24 debug_if(FFS_DBG, "disk_status on pdrv [%d]\n", pdrv);
JDI_Mbed_Team 0:33fe30a2b785 25 return (DSTATUS)FATFileSystem::_ffs[pdrv]->disk_status();
JDI_Mbed_Team 0:33fe30a2b785 26 }
JDI_Mbed_Team 0:33fe30a2b785 27
JDI_Mbed_Team 0:33fe30a2b785 28 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 29 /* Inidialize a Drive */
JDI_Mbed_Team 0:33fe30a2b785 30 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 31
JDI_Mbed_Team 0:33fe30a2b785 32 DSTATUS disk_initialize (
JDI_Mbed_Team 0:33fe30a2b785 33 BYTE pdrv /* Physical drive nmuber to identify the drive */
JDI_Mbed_Team 0:33fe30a2b785 34 )
JDI_Mbed_Team 0:33fe30a2b785 35 {
JDI_Mbed_Team 0:33fe30a2b785 36 debug_if(FFS_DBG, "disk_initialize on pdrv [%d]\n", pdrv);
JDI_Mbed_Team 0:33fe30a2b785 37 return (DSTATUS)FATFileSystem::_ffs[pdrv]->disk_initialize();
JDI_Mbed_Team 0:33fe30a2b785 38 }
JDI_Mbed_Team 0:33fe30a2b785 39
JDI_Mbed_Team 0:33fe30a2b785 40 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 41 /* Read Sector(s) */
JDI_Mbed_Team 0:33fe30a2b785 42 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 43
JDI_Mbed_Team 0:33fe30a2b785 44 DRESULT disk_read (
JDI_Mbed_Team 0:33fe30a2b785 45 BYTE pdrv, /* Physical drive nmuber to identify the drive */
JDI_Mbed_Team 0:33fe30a2b785 46 BYTE* buff, /* Data buffer to store read data */
JDI_Mbed_Team 0:33fe30a2b785 47 DWORD sector, /* Sector address in LBA */
JDI_Mbed_Team 0:33fe30a2b785 48 UINT count /* Number of sectors to read */
JDI_Mbed_Team 0:33fe30a2b785 49 )
JDI_Mbed_Team 0:33fe30a2b785 50 {
JDI_Mbed_Team 0:33fe30a2b785 51 debug_if(FFS_DBG, "disk_read(sector %d, count %d) on pdrv [%d]\n", sector, count, pdrv);
JDI_Mbed_Team 0:33fe30a2b785 52 if (FATFileSystem::_ffs[pdrv]->disk_read((uint8_t*)buff, sector, count))
JDI_Mbed_Team 0:33fe30a2b785 53 return RES_PARERR;
JDI_Mbed_Team 0:33fe30a2b785 54 else
JDI_Mbed_Team 0:33fe30a2b785 55 return RES_OK;
JDI_Mbed_Team 0:33fe30a2b785 56 }
JDI_Mbed_Team 0:33fe30a2b785 57
JDI_Mbed_Team 0:33fe30a2b785 58 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 59 /* Write Sector(s) */
JDI_Mbed_Team 0:33fe30a2b785 60 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 61
JDI_Mbed_Team 0:33fe30a2b785 62 #if _USE_WRITE
JDI_Mbed_Team 0:33fe30a2b785 63 DRESULT disk_write (
JDI_Mbed_Team 0:33fe30a2b785 64 BYTE pdrv, /* Physical drive nmuber to identify the drive */
JDI_Mbed_Team 0:33fe30a2b785 65 const BYTE* buff, /* Data to be written */
JDI_Mbed_Team 0:33fe30a2b785 66 DWORD sector, /* Sector address in LBA */
JDI_Mbed_Team 0:33fe30a2b785 67 UINT count /* Number of sectors to write */
JDI_Mbed_Team 0:33fe30a2b785 68 )
JDI_Mbed_Team 0:33fe30a2b785 69 {
JDI_Mbed_Team 0:33fe30a2b785 70 debug_if(FFS_DBG, "disk_write(sector %d, count %d) on pdrv [%d]\n", sector, count, pdrv);
JDI_Mbed_Team 0:33fe30a2b785 71 if (FATFileSystem::_ffs[pdrv]->disk_write((uint8_t*)buff, sector, count))
JDI_Mbed_Team 0:33fe30a2b785 72 return RES_PARERR;
JDI_Mbed_Team 0:33fe30a2b785 73 else
JDI_Mbed_Team 0:33fe30a2b785 74 return RES_OK;
JDI_Mbed_Team 0:33fe30a2b785 75 }
JDI_Mbed_Team 0:33fe30a2b785 76 #endif
JDI_Mbed_Team 0:33fe30a2b785 77
JDI_Mbed_Team 0:33fe30a2b785 78 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 79 /* Miscellaneous Functions */
JDI_Mbed_Team 0:33fe30a2b785 80 /*-----------------------------------------------------------------------*/
JDI_Mbed_Team 0:33fe30a2b785 81
JDI_Mbed_Team 0:33fe30a2b785 82 #if _USE_IOCTL
JDI_Mbed_Team 0:33fe30a2b785 83 DRESULT disk_ioctl (
JDI_Mbed_Team 0:33fe30a2b785 84 BYTE pdrv, /* Physical drive nmuber (0..) */
JDI_Mbed_Team 0:33fe30a2b785 85 BYTE cmd, /* Control code */
JDI_Mbed_Team 0:33fe30a2b785 86 void* buff /* Buffer to send/receive control data */
JDI_Mbed_Team 0:33fe30a2b785 87 )
JDI_Mbed_Team 0:33fe30a2b785 88 {
JDI_Mbed_Team 0:33fe30a2b785 89 debug_if(FFS_DBG, "disk_ioctl(%d)\n", cmd);
JDI_Mbed_Team 0:33fe30a2b785 90 switch(cmd) {
JDI_Mbed_Team 0:33fe30a2b785 91 case CTRL_SYNC:
JDI_Mbed_Team 0:33fe30a2b785 92 if(FATFileSystem::_ffs[pdrv] == NULL) {
JDI_Mbed_Team 0:33fe30a2b785 93 return RES_NOTRDY;
JDI_Mbed_Team 0:33fe30a2b785 94 } else if(FATFileSystem::_ffs[pdrv]->disk_sync()) {
JDI_Mbed_Team 0:33fe30a2b785 95 return RES_ERROR;
JDI_Mbed_Team 0:33fe30a2b785 96 }
JDI_Mbed_Team 0:33fe30a2b785 97 return RES_OK;
JDI_Mbed_Team 0:33fe30a2b785 98 case GET_SECTOR_COUNT:
JDI_Mbed_Team 0:33fe30a2b785 99 if(FATFileSystem::_ffs[pdrv] == NULL) {
JDI_Mbed_Team 0:33fe30a2b785 100 return RES_NOTRDY;
JDI_Mbed_Team 0:33fe30a2b785 101 } else {
JDI_Mbed_Team 0:33fe30a2b785 102 DWORD res = FATFileSystem::_ffs[pdrv]->disk_sectors();
JDI_Mbed_Team 0:33fe30a2b785 103 if(res > 0) {
JDI_Mbed_Team 0:33fe30a2b785 104 *((DWORD*)buff) = res; // minimum allowed
JDI_Mbed_Team 0:33fe30a2b785 105 return RES_OK;
JDI_Mbed_Team 0:33fe30a2b785 106 } else {
JDI_Mbed_Team 0:33fe30a2b785 107 return RES_ERROR;
JDI_Mbed_Team 0:33fe30a2b785 108 }
JDI_Mbed_Team 0:33fe30a2b785 109 }
JDI_Mbed_Team 0:33fe30a2b785 110 case GET_BLOCK_SIZE:
JDI_Mbed_Team 0:33fe30a2b785 111 *((DWORD*)buff) = 1; // default when not known
JDI_Mbed_Team 0:33fe30a2b785 112 return RES_OK;
JDI_Mbed_Team 0:33fe30a2b785 113
JDI_Mbed_Team 0:33fe30a2b785 114 }
JDI_Mbed_Team 0:33fe30a2b785 115 return RES_PARERR;
JDI_Mbed_Team 0:33fe30a2b785 116 }
JDI_Mbed_Team 0:33fe30a2b785 117 #endif