diff --git a/docs/assets/img/related_documents/Arduino_IDE/board_select.webp b/docs/assets/img/related_documents/Arduino_IDE/board_select.webp new file mode 100644 index 00000000..12a6eca7 Binary files /dev/null and b/docs/assets/img/related_documents/Arduino_IDE/board_select.webp differ diff --git a/docs/assets/img/related_documents/Arduino_IDE/search_M5STACK.webp b/docs/assets/img/related_documents/Arduino_IDE/search_M5STACK.webp new file mode 100644 index 00000000..da4a1e77 Binary files /dev/null and b/docs/assets/img/related_documents/Arduino_IDE/search_M5STACK.webp differ diff --git a/docs/en/api/touch.md b/docs/en/api/touch.md new file mode 100644 index 00000000..7937e766 --- /dev/null +++ b/docs/en/api/touch.md @@ -0,0 +1,112 @@ +# TOUCH + +## getPressPoint() + +**Description** + +Get touch coordinates + +**Syntax** + +TouchPoint_t getPressPoint(); + +```arduino +#include + +void setep() { + M5.begin(); +} + +void loop() { + TouchPoint_t coordinate; + coordinate = M5.Touch.getPressPoint(); + Serial.printf("x:%d, y:%d \r\n", coordinate.x, coordinate.y); +} +``` +## ispressed() + +**Description** + +Check that the screen is pressed + +**Syntax** + +bool ispressed(); + +**Example** + +```arduino +#include + +void setup() { + M5.begin(); +} + +void loop() { + if(M5.Touch.ispressed()) { + Serial.println("Pressed"); + } +} +``` + +## HotZone_t* createHotZone() + +**Description** + +Create a touch hotzone + +**Syntax** + +HotZone_t* creatHotZone(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, void (*fun)() = nullptr ); + +**Example** + +```arduino +#include + +void doFunc(void){ + Serial.println("executed doFunc()"); +} + +HotZone Btn(0, 0, 320, 240, &doFunc)); + + + +void setup(){ + M5.begin(); +} +void loop() { + +} + +``` + +## inHotZone() + +**Description** + +Determine if it is in the hot zone + +**Syntax** + +bool inHotZone(TouchPoint_t point); + +**Example** + +```arduino +#include + +HotZone Btn(140, 100, 200, 160); + +void setup() { + M5.begin(); +} + +void loop() { + TouchPoint_t pos = M5.Touch.getPressPoint(); + if(Btn.inHotZone(pos)) { + Serial.printf("%d, %d\r\n", pos.x, pos.y); + } + +} +``` \ No newline at end of file diff --git a/docs/zh_CN/api/touch.md b/docs/zh_CN/api/touch.md new file mode 100644 index 00000000..4fe5c6bd --- /dev/null +++ b/docs/zh_CN/api/touch.md @@ -0,0 +1,112 @@ +# TOUCH + +## getPressPoint() + +**功能** + +获取触摸坐标 + +**函数原型:** + +TouchPoint_t getPressPoint(); + +```arduino +#include + +void setep() { + M5.begin(); +} + +void loop() { + TouchPoint_t coordinate; + coordinate = M5.Touch.getPressPoint(); + Serial.printf("x:%d, y:%d \r\n", coordinate.x, coordinate.y); +} +``` +## ispressed() + +**功能** + +检查屏幕是否按压 + +**函数原型:** + +bool ispressed(); + +**Example** + +```arduino +#include + +void setup() { + M5.begin(); +} + +void loop() { + if(M5.Touch.ispressed()) { + Serial.println("Pressed"); + } +} +``` + +## HotZone_t* createHotZone() + +**功能** + +创建一个触摸热区 + +**函数原型:** + +HotZone_t* creatHotZone(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, void (*fun)() = nullptr ); + +**Example** + +```arduino +#include + +void doFunc(void){ + Serial.println("executed doFunc()"); +} + +HotZone Btn(0, 0, 320, 240, &doFunc)); + + + +void setup(){ + M5.begin(); +} +void loop() { + +} + +``` + +## inHotZone() + +**功能** + +判断是否在热区内 + +**函数原型:** + +bool inHotZone(TouchPoint_t point); + +**Example** + +```arduino +#include + +HotZone Btn(140, 100, 200, 160); + +void setup() { + M5.begin(); +} + +void loop() { + TouchPoint_t pos = M5.Touch.getPressPoint(); + if(Btn.inHotZone(pos)) { + Serial.printf("%d, %d\r\n", pos.x, pos.y); + } + +} +``` \ No newline at end of file diff --git a/docs/zh_CN/arduino/arduino_core2_development.md b/docs/zh_CN/arduino/arduino_core2_development.md index 96eb1f5c..291dcc1f 100644 --- a/docs/zh_CN/arduino/arduino_core2_development.md +++ b/docs/zh_CN/arduino/arduino_core2_development.md @@ -59,66 +59,11 @@ >4.在新弹出的对话框中,输入并搜索 `M5Stack`,点击`安装`(若出现搜索失败的情况,可以尝试重启Arduino程序) - - ->5.选择 `工具`->`开发板:`->`ESP32` - -### For M5Core and M5Stick - - - -### For M5StickC - - - -### For M5StickC PLUS - - - -### For Atom Matrix/Lite - ->ATOM系列目前还未更新板选项,您可以选用M5StickC或ESP32 Pico KIT作为板配置。(注意:选用ESP32-Pico作为板配置时,波特率请采用115200) - - - -## 相关库 - ->不同的硬件设备,有着不同的案例程序库,请根据你所使用的设备选择下载.打开 Arduino IDE, 然后选择 `项目`->`加载库`->`库管理...` - - - -### For M5Core and M5Stick - -?>搜索 `M5Stack` 并安装,如下图所示 - - - -### For M5StickC - -?>搜索 `M5StickC` 并安装,如下图所示 - - - -### For M5StickC PLUS - ->到此页面下载M5StickCPlus的库[M5StickCPlus](https://github.com/m5stack/M5StickC-Plus) ,添加 "M5StickC-Plus.zip"到库管理器中 - - - - - - - ->从例程中找到M5StickCPlus - - - -### For Atom Matrix/Lite - -?>搜索 `M5Atom` 并安装,如下图所示,使用LED可能你还需要安装FastLED库 - - + +>5.选择 `工具`->`开发板:`->`M5Stack-Core2` + +