Skip to content

Commit

Permalink
Add unit example, fix dispaly hzk16 bug
Browse files Browse the repository at this point in the history
Add  Env
Add NCIR
Add RFID
Add USB
Fix EXT_IO bug
Fix Face bug
  • Loading branch information
EeeeBin committed Dec 27, 2018
1 parent 682f3dd commit 86dc023
Show file tree
Hide file tree
Showing 25 changed files with 3,478 additions and 62 deletions.
98 changes: 46 additions & 52 deletions examples/Advanced/Display/HZK16/HZK16.ino
Original file line number Diff line number Diff line change
@@ -1,79 +1,73 @@
#define USE_INTERNAL_HZK
/*
在 src.h 文件中 GbkStr 显示为乱码为正常现象
HZK16为GB2312中文编码格式字库, 需要显示中文建议使用notepad++或其它软件(Arduino IDE 为UTF-8)通过编码GB2312打开str.h
即可修改为个人想要输出中文字符
*/

#include <M5Stack.h>
#include "display_ch.h"
#include "str.h"

DisplayCh displaych;
void setup() {

M5.begin();
// Use HZK16 and ASC16 font set
// NOTE: font file should be copied to your TF card.
M5.Lcd.loadHzk16("/Fonts/HZK16","/Fonts/ASC16");
// Set text with white foreground color and black background color
M5.Lcd.setTextColor(WHITE, BLACK);

displaych.loadHzk16();

displaych.setTextColor(WHITE, BLACK);

// Set text with red highlight color
M5.Lcd.setHighlightColor(RED);
displaych.setHighlightColor(RED);

// Set text size to 1
M5.Lcd.setTextSize(1);
M5.Lcd.setCursor(0,10);
displaych.setTextSize(1);
displaych.setCursor(0,0,1);
displaych.writeHzk(AscStr);
// Print some ASCII text on the screen
M5.Lcd.printf(AscStr);
delay(1000);
// Highlight the text
M5.Lcd.highlight(true);
M5.Lcd.setCursor(0,10);
M5.Lcd.printf(AscStr);

delay(1000);
displaych.highlight(true);
displaych.setCursor(0,32);
displaych.writeHzk(AscStr);
delay(1000);
// Clear screen
M5.Lcd.clear();
//M5.Lcd.clear();
// Turn highlight off
M5.Lcd.highlight(false);
M5.Lcd.setCursor(0,10);
displaych.highlight(false);
displaych.setCursor(0,70);
// print some GBK text on the screen
M5.Lcd.printf(GbkStr);
delay(1000);
M5.Lcd.highlight(true);
M5.Lcd.setCursor(0,10);
M5.Lcd.printf(GbkStr);
displaych.writeHzk(GbkStr);

delay(1000);
M5.Lcd.clear();
displaych.highlight(true);
displaych.setCursor(0,90);
displaych.writeHzk(GbkStr);

// Set text size to 2
M5.Lcd.setTextSize(2);
M5.Lcd.setCursor(0,10);
M5.Lcd.highlight(false);
M5.Lcd.printf(AscStr);
delay(1000);
M5.Lcd.highlight(true);
M5.Lcd.setCursor(0,10);
M5.Lcd.printf(AscStr);
displaych.fillScreen(BLACK);

// Set text size to 2
displaych.setTextSize(2);
displaych.setCursor(0,0);
displaych.highlight(false);
displaych.writeHzk(AscStr);
delay(1000);

M5.Lcd.clear();
M5.Lcd.highlight(false);
M5.Lcd.setCursor(0,10);
M5.Lcd.printf(GbkStr);
displaych.highlight(true);
displaych.setCursor(0,70);
displaych.writeHzk(AscStr);
delay(1000);
M5.Lcd.highlight(true);
M5.Lcd.setCursor(0,10);
M5.Lcd.printf(GbkStr);

//displaych.clear();
displaych.highlight(false);
displaych.setCursor(0,145);
displaych.writeHzk(GbkStr);
delay(1000);
displaych.highlight(true);
displaych.setCursor(0,195);
displaych.writeHzk(GbkStr);


M5.Lcd.clear();
M5.Lcd.highlight(false);

// Set text with non-transparent back color, BLACK as set at the beginning.
M5.Lcd.setTransparentBgColor(false);
M5.Lcd.setCursor(0,10);
M5.Lcd.printf(GbkStr);

// Set text with transparent back color
M5.Lcd.setTransparentBgColor(true);
M5.Lcd.setCursor(0,130);
M5.Lcd.printf(GbkStr);
}

void loop() {
Expand Down
Loading

0 comments on commit 86dc023

Please sign in to comment.