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: MIP8F_SPI_Ver30 mbed
Diff: main.cpp
- Revision:
- 1:e5796aa9f1aa
- Parent:
- 0:33fe30a2b785
- Child:
- 5:069467469900
--- a/main.cpp Tue Sep 04 06:44:01 2018 +0000
+++ b/main.cpp Mon Oct 22 04:03:54 2018 +0000
@@ -1,19 +1,29 @@
/**
- * Copyright 2018 Japan Display Inc.
- *
- * 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.
- */
- #include "stdio.h"
+* @file main.cpp
+* @brief Sample source code for MIP8 diplay.
+* @details
+*
+* Addtional function is Monochome display by 1bit mode of SPI transfer.
+*
+* spi-transfer to Display has 3 mode.
+* 4bit mode is color display, this bit arrange is R,G,B,x. R,G,B = R,G,B subpixel bit. a x bit is Dummy.
+* No ues(3bit mode is color display, this bit arrange is R,G,B. R,G,B = R,G,B subpixel bit. No bit is Dummy.)
+* 1bit mode is monocrome display,high speed refresh mode. a only Green subpixel of bitmap data is transfered.
+* <License>
+* Copyright 2018 Japan Display Inc.
+* 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.
+*/
+#include "stdio.h"
#include "string"
#include "mbed.h"
#include "MIP8F_SPI.h"
@@ -21,7 +31,6 @@
#include "StateSW.h"
#include "TglSW.h"
-
#include "Arial12x12.h"
#include "Arial24x23.h"
#include "Arial28x28.h"
@@ -35,26 +44,24 @@
#define ON 1
#define OFF 0
-
//K64F
SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // mosi,miso,sck,cs
memLCD8 WD(PTD2,PTD3,PTD1,PTD0,PTC4,PTD3); //PTC12); // mosi,miso,clk,cs,disp,power
PwmOut BK(PTC3);
PwmOut COM60HZ(PTC10); //add 20161108
DigitalOut COMSEL(PTA2,0); //add 20161108
-
DigitalOut BLCTRL(PTB10,0); //add 20171115
-
// SW2
StateSW swPWMorOFF(SW2); //PTC6);
InterruptIn PWMorOFF(SW2);
-
// SW3
TglSW HaltSW(SW3); //PTA4);
DigitalIn TexSW(SW3);
+//for debug
+//Serial pc(USBTX, USBRX); // tx, rx
-
+//function prototype
void SD2BUF(char *filepath);
void ifOFFseq(void);
void ifswPWM(void);
@@ -62,6 +69,7 @@
void DispAllDir(const char *fsrc);
void ReadBmp(const char *fsrc, uint32_t FileNum);
uint32_t CntFile(const char *fsrc);
+//Grobal value
int ifMargeTXT = 0;
int width = 400;
int height= 240;
@@ -72,14 +80,13 @@
float bk_timer = 1.0;
int blduty = 0;
int bloff = 0;
-int blctrl_sel = 1; //0:40mA, 1:160mA
+int blctrl_sel = 0; //0:40mA, 1:160mA //Y.S
int main() {
uint32_t filenum=0;
char filepath[40];
-
sd.disk_initialize();
HaltSW.Enable(1);
@@ -130,33 +137,26 @@
BK.period_ms(1); //1ms cycle 20161012
BK.write(0); //low output 20160725 <- high output
- while(1){ //BITMAPS
+ while(1)
+ { //BITMAPS
filenum = CntFile(filepath); //file number read
- for(uint32_t i=0; i<filenum; i++){
+ for(uint32_t i=0; i<filenum; i++)
+ {
ReadBmp(filepath,i);
-
- while(HaltSW.State()){ // VCOM invert when image is still
- // pol++;
- // WD.command( (pol << 6) & 0x40 );
+ while(HaltSW.State()) { // VCOM invert when image is still
+ // pol++;
+ // WD.command( (pol << 6) & 0x40 );
// wait(bk_timer); //1Hz
- }
-/*
- // Brink
- for(char j = 0; j < 8; j++){
- pol = j&0x01;
- EnterOrLeave = (j+1)&0x01;
- WD.command( (pol << 6) | (EnterOrLeave << 3) );
- wait(0.2);
- }
-*/
- HaltSW.Clear();
- WD.writeDISP();
- wait(2);
+ }
+ HaltSW.Clear();
+ //1bit trasfer mode = monochro diplay
+ WD.writeDISP(TrBIT1);
+ wait(2);
}
}
}
-
+//4bit mode
void SD2BUF(char *filepath){
char R8[1],G8[1],B8[1] ,DUMMY[1];
int RGB;
@@ -175,7 +175,7 @@
WD.pixel(x,y,RGB);
}
if( y!=0) // The last data column doesn't need padding
- for(int x=(width*3)%4; (x%4 !=0); x++) fscanf(fp, "%c",DUMMY); // 4byte boundery for every column
+ for(int x=(width*3)%4; (x%4 !=0); x++) fscanf(fp, "%c",DUMMY); // 4byte boundery for every column(only windows bitmap format)
}
}
fclose(fp);