From ae8dec22708efa4e696a64432dece2f61478a730 Mon Sep 17 00:00:00 2001
From: LiHuashen <854410664@qq.com>
Date: Wed, 13 Feb 2019 16:32:32 +0800
Subject: [PATCH] updated api doc for LCD
---
docs/index.html | 2 +-
docs/zh_CN/api/lcd.md | 338 ++++++++++++++++++++++++++++++------------
2 files changed, 244 insertions(+), 96 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index 8b344c08..9fd3f91e 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -31,7 +31,7 @@
homepage : 'index.md',
loadNavbar : 'navbar.md',
loadSidebar: 'sidebar.md',
- // autoHeader: true,
+ autoHeader: true,
mergeNavbar: true, // for mobile device
nameLink: {
'/en/': '#/en/',
diff --git a/docs/zh_CN/api/lcd.md b/docs/zh_CN/api/lcd.md
index 1428ac9a..f26e6f27 100644
--- a/docs/zh_CN/api/lcd.md
+++ b/docs/zh_CN/api/lcd.md
@@ -1,6 +1,32 @@
# LCD
-*屏幕像素为320x240,以屏幕左上角为原点(0,0)*
+*屏幕像素为 320x240,以屏幕左上角为原点 (0,0)*
+
+### fillScreen(uint16_t color);
+
+**功能:以指定的颜色填充整个屏幕。**
+
+| 参数 | 描述 |
+| --- | --- |
+| color | 颜色值 |
+
+**例程**
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.fillScreen(RED);
+```
+
+
+* * *
-
-### setTextColor(color [, background_color])
+### setTextColor(uint16_t color, uint16_t backgroundcolor);
-**设置显示文本的前景颜色和背景颜色。**
+**功能:设置显示文本的前景颜色和背景颜色。**
| 参数 | 描述 |
| --- | --- |
| color | 文本的前景颜色 |
| background_color| 文本的背景颜色 |
+*如果函数的 background_color 值没给出,则使用当前的背景颜色。*
+
**例程**
```arduino
-// Arduino
+#include
+
+M5.begin();
+
M5.Lcd.setTextColor(RED);
```
-```python
+
* * *
-### lcd.fillScreen(color)
+### setCursor(uint16_t x0, uint16_t y0);
-**以指定的颜色填充整个屏幕。**
-
-| 参数 | 描述 |
-| --- | --- |
-| color | 颜色值 |
+**功能:移动光标位置到 (x0, y0) 处。**
**例程**
```arduino
-// Arduino
-M5.Lcd.fillScreen(RED);
+#include
+
+M5.begin();
+
+M5.Lcd.setCursor(100,100);
+M5.Lcd.print("Hello");
```
-```python
-# MicroPython
-from m5stack import *
-from m5ui import *
-
-lcd.fillScreen(lcd.RED)
-```
-
-
-* * *
-
-### lcd.drawPixel(x, y [,color])
-
-**在位置(x,y)处画点。**
-
-*如果函数的color值没给出,则使用当前的背景颜色。*
-
-| 参数 | 描述 |
-| --- | --- |
-| color | 颜色值 |
-
-**例程**
-```arduino
-// Arduino
-lcd.drawPixel(22,22,RED);
-```
-```python
+
* * *
-### lcd.drawLine(x, y, x1, y1 [,color])
+### drawPixel(int16_t x, int16_t y, uint16_t color);
+
+**功能:在位置(x,y)处画点。**
+
+| 参数 | 描述 |
+| --- | --- |
+| color | 颜色值 |
+
+*如果函数的 color 值没给出,则使用当前的背景颜色。*
+
**例程**
-```python
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.drawPixel(22,22,RED);
+```
+
+
+* * *
+
+### drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
+
+**功能:以指定的颜色从点(x,y)到点(x1,y1)画直线。**
+
+| 参数 | 描述 |
+| --- | --- |
+| color | 颜色值 |
+
+*如果函数的 color 值没给出,则使用当前的背景颜色。*
+
+**例程**
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.drawLine(0,0,12,12,WHITE);
+```
+
-*如果函数的color值没给出,则使用当前的背景颜色。*
+* * *
+
+### drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
+
+**功能:以指定颜色画三角形,顶点分别为(x,y),(x1,y1)和(x2,y2)。**
| 参数 | 描述 |
| --- | --- |
| color | 颜色值 |
+*如果函数的 color 值没给出,则使用当前的背景颜色。*
+
+**例程**
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.drawTriangle(22,22,69,98,51,22,RED);
+```
+
* * *
-### lcd.drawTriangle(x, y, x1, y1, x2, y2 [,color])
+### fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
-**例程**
-```python
-lcd.drawTriangle(22,22,69,98,51,22,lcd.RED)
-```
-
-**以指定颜色画三角形,顶点分别为(x,y),(x1,y1)和(x2,y2)。**
-
-*如果函数的color值没给出,则使用当前的背景颜色。*
+**功能:以指定颜色画填充形式的三角形,顶点分别为(x,y),(x1,y1)和(x2,y2)。**
| 参数 | 描述 |
| --- | --- |
| color | 颜色值 |
-* * *
-
-### lcd.fillTriangle(x, y, x1, y1, x2, y2 [,color])
+*如果函数的 color 值没给出,则使用当前的背景颜色。*
**例程**
-```python
-lcd.fillTriangle(122, 122, 169, 198, 151, 182, lcd.RED)
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.fillTriangle(22,22,69,98,51,22,RED);
```
-**以指定颜色画填充形式的三角形,顶点分别为(x,y),(x1,y1)和(x2,y2)。**
-
-*如果函数的color值没给出,则使用当前的背景颜色。*
-
-| 参数 | 描述 |
-| --- | --- |
-| color | 颜色值 |
+
* * *
-### lcd.drawRect(x, y, w, h, [,color])
-**例程**
-```python
-lcd.drawRect(180, 12, 122, 10, lcd.BLUE)
-```
-**以指定颜色画矩形,其中矩形左上角坐标为(x,y),宽高分别为width和height。**
-*如果函数的color值没给出,则使用当前的背景颜色。*
+### drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
+
+**功能:以指定颜色画矩形,其中矩形左上角坐标为(x,y),宽高分别为width和height。**
| 参数 | 描述 |
| --- | --- |
@@ -164,46 +224,118 @@ lcd.drawRect(180, 12, 122, 10, lcd.BLUE)
| h | 图形高(单位: 像素) |
| color | 颜色值 |
+*如果函数的 color 值没给出,则使用当前的背景颜色。*
+**例程**
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.drawRect(180, 12, 122, 10, BLUE);
+```
+
* * *
-### lcd.drawRoundRect(x, y, w, h, r [,color])
-**例程**
-```python
-lcd.fillRoundRect(180,70,122,10,4,lcd.BLUE)
-```
-**以指定颜色画圆角矩形,其中矩形左上角坐标为(x,y),宽高分别为width和height,圆角半径为r。**
+### fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
-*如果函数的color值没给出,则使用当前的背景颜色。*
+**功能:以指定颜色画填充形式的矩形,其左上角坐标为(x,y),宽高分别为width和height。**
| 参数 | 描述 |
| --- | --- |
| w | 图形宽(单位: 像素) |
| h | 图形高(单位: 像素) |
-| r | 圆角半径 |
| color | 颜色值 |
+*如果函数的 color 值没给出,则使用当前的背景颜色。*
+**例程**
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.fillRect(180, 12, 122, 10, BLUE);
+```
+
* * *
-### lcd.print(‘text’, [x, y])
+
+### drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
+
+**功能:以指定颜色画圆角矩形,其中矩形左上角坐标为(x,y),宽高分别为width和height,圆角半径为radius。**
+
+| 参数 | 描述 |
+| --- | --- |
+| w | 图形宽(单位: 像素) |
+| h | 图形高(单位: 像素) |
+| radius | 圆角半径 |
+| color | 颜色值 |
+
+*如果函数的 color 值没给出,则使用当前的背景颜色。*
+
**例程**
-```python
-lcd.print('this is a print text function', 80, 80)
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.fillRoundRect(180,70,122,10,4,BLUE);
```
-**在(x,y)处开始打印文本(字符串)text。**
+
+
+* * *
+
+### print();
+
+**功能:在屏幕的当前位置开始打印文本(字符串)text。**
| 参数 | 描述 |
| --- | --- |
| text | 要打印的内容 |
+*默认以前景颜色打印指定的内容*
+
+**例程**
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.print("this is a print text function");
+```
+
* * *
-### lcd.clear([color])
+
-
-* * *
+
### Usage
-```python
+```arduino
+#include
+
+M5.begin();
+
+M5.Lcd.fillScreen(BLACK) #set the default background color
+M5.Lcd.drawLine(0, 0, WHITE);
+M5.Lcd.drawTriangle(22, 22, 69, 98, 51, 22, RED);
+M5.Lcd.fillTriangle(122, 122, 169, 198, 151, 182, RED);
+M5.Lcd.drawRect(180, 12, 122, 10, BLUE);
+M5.Lcd.fillRect(180, 30, 122, 10, BLUE);
+M5.Lcd.drawRoundRect(180, 50, 122, 10, 4, BLUE);
+M5.Lcd.fillRoundRect(180, 70, 122, 10, 4, BLUE);
+M5.Lcd.print("this is a print text function");
+```
+
+