Skip to content

Commit

Permalink
Merge pull request #142 from Tinyu-Zhao/master
Browse files Browse the repository at this point in the history
StickC Basic & README update
  • Loading branch information
Tinyu-Zhao authored Sep 3, 2021
2 parents a6f243d + 898813b commit 3e00ecf
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 196 deletions.
50 changes: 8 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
English | [中文](README_cn.md)

<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_content/core/m5stickc_01.png" alt="M5StickC_01" width="350" height="350">
<img src="https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_05.jpg" alt="M5StickC_01" height="350" style="margin-left:20px">

* **For the Detailed documentation of M5StickC, please click [here](https://docs.m5stack.com/#/en/core/m5stickc)**
* **For the Detailed documentation of M5StickC, please [Click here](https://docs.m5stack.com/#/en/core/m5stickc)**

* **In order to buy M5StickC, please click [here](https://www.aliexpress.com/item/New-Arrival-2019-M5StickC-1-of-Limited-Trial-Edition-ESP32-PICO-Mini-IoT-Development-Board-Finger/32985247364.html)**
* **In order to buy M5StickC, please [Click here](https://www.aliexpress.com/item/New-Arrival-2019-M5StickC-1-of-Limited-Trial-Edition-ESP32-PICO-Mini-IoT-Development-Board-Finger/32985247364.html)**


## Description
Expand All @@ -16,50 +15,17 @@ English | [中文](README_cn.md)

**Switching machine operation:** Press for two seconds to turn it on, and press and hold for six seconds to turn it off.

## PinMap
## More Information

**Red LED & IR transmitter & BUTTON A & BUTTON B**
**UIFlow Quick Start**: Please [Click Here](https://docs.m5stack.com/en/quick_start/m5stickc/m5stickc_quick_start_with_uiflow)

<table>
<tr><td>ESP32 chip</td><td>GPIO10</td><td>GPIO9</td><td>GPIO37</td><td>GPIO39</td></tr>
<tr><td>Red LED</td><td>LED pin</td><td> </td><td> </td><td> </td></tr>
<tr><td>IR transmitter</td><td> </td><td>transmitter pin</td><td> </td><td> </td></tr>
<tr><td>BUTTON A</td><td> </td><td> </td><td>button pin</td><td> </td></tr>
<tr><td>BUTTON B</td><td> </td><td> </td><td> </td><td>button pin</td></tr>
</table>
**MicroPyhton API**: Please [Click Here](https://docs.m5stack.com/en/mpy/display/m5stack_lvgl)

**TFT Screen**
**Arduino IDE Development**: Please [Click Here](https://docs.m5stack.com/en/arduino/arduino_development)

*Driver IC: [ST7735S](https://github.com/m5stack/M5-Schematic/blob/master/Core/ST7735S_v1.1.pdf)*
**M5StickC Arduino API**: Please [Click Here](https://docs.m5stack.com/en/api/stickc/system_m5stickc)

*Resolution: 80 * 160*

<table>
<tr><td>ESP32 chip</td><td>GPIO15</td><td>GPIO13</td><td>GPIO23</td><td>GPIO18</td><td>GPIO5</td></tr>
<tr><td>TFT Screen</td><td>TFT_MOSI</td><td>TFT_CLK</td><td>TFT_DC</td><td>TFT_RST</td><td>TFT_CS</td></tr>
</table>

**GROVE interface**

<table>
<tr><td>ESP32 chip</td><td>GPIO33</td><td>GPIO32</td><td>5V</td><td>GND</td></tr>
<tr><td>GROVE interface</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
</table>

**Microphone ([SPM1423](https://github.com/m5stack/M5-Schematic/blob/master/Core/SPM1423HM4H-B.pdf))**

<table>
<tr><td>ESP32 chip</td><td>GPIO0</td><td>GPIO34</td></tr>
<tr><td>Microphone</td><td>SCL</td><td>SDA</td></tr>
</table>

**6-axis IMU ([SH200Q](https://github.com/m5stack/M5-Schematic/blob/master/Core/SH200Q.pdf)) & Power Mangement IC ([AXP192](https://github.com/m5stack/M5-Schematic/blob/master/Core/AXP192%20Datasheet%20v1.13_cn.pdf))**

<table>
<tr><td>ESP32 chip</td><td>GPIO22</td><td>GPIO21</td>
<tr><td>6-axis IMU (SH200Q)</td><td>SCL</td><td>SDA</td>
<tr><td>Power Mangement IC (AXP192)</td><td>SCL</td><td>SDA</td>
</table>
**PinMap**: Please [Click Here](https://docs.m5stack.com/en/core/m5stickc)

**M5StickC top extended IO port**

Expand Down
51 changes: 9 additions & 42 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,27 @@

<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/m5-docs_content/core/m5stickc_01.png" alt="M5StickC_01" width="350" height="350">

* **如果查看 M5StickC 的详细介绍文档,点击[这里](https://docs.m5stack.com/#/zh_CN/core/m5stickc)**
* **如果查看 M5StickC 的详细介绍文档,[点击这里](https://docs.m5stack.com/#/zh_CN/core/m5stickc)**

* **如果想要购买 M5StickC 的话,点击[这里](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.12.7807425e3JNPRr&id=588710395351)**
* **如果想要购买 M5StickC 的话,[点击这里](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.12.7807425e3JNPRr&id=588710395351)**

## 描述

<mark>**M5StickC**</mark> 是一个包含 0.96 寸 **TFT 彩屏** (80 x 160 分辨率)、**红色** LED 灯、按键、**麦克风**、红外发射管、六轴姿态传感器 (SH200Q) 和 80mAH 的电池的小型 **ESP32 开发板**。M5StickC 内的 ESP32 模组 **[ESP32-Pico](https://github.com/m5stack/M5-Schematic/blob/master/Core/esp32-pico-d4_datasheet_cn.pdf)** 还内置了 4MB 的flash。如果 M5StickC 装配上表带底座和表带,你可以将它戴在手腕上。

**开关机操作**短按两秒开机,长按六秒关机。
**开关机操作** 短按两秒开机,长按六秒关机。

## 管脚映射
## 更多信息

**红色 LED & 红外发射管 IR & 按键 BUTTON A & 按键 BUTTON B**
**UIFlow 快速上手**: [点击这里](https://docs.m5stack.com/zh_CN/quick_start/m5stickc/m5stickc_quick_start_with_uiflow)

<table>
<tr><td>ESP32 芯片</td><td>GPIO10</td><td>GPIO9</td><td>GPIO37</td><td>GPIO39</td></tr>
<tr><td>红色 LED</td><td>LED 管脚</td><td> </td><td> </td><td> </td></tr>
<tr><td>红外发射管 IR</td><td> </td><td>发射管引脚</td><td> </td><td> </td></tr>
<tr><td>按键 BUTTON A</td><td> </td><td> </td><td>按键管脚</td><td> </td></tr>
<tr><td>按键 BUTTON B</td><td> </td><td> </td><td> </td><td>按键管脚</td></tr>
</table>
**MicroPyhton API**: [点击这里](https://docs.m5stack.com/zh_CN/mpy/display/m5stack_lvgl)

**TFT 屏幕**
**Arduino IDE 环境搭建**: [点击这里](https://docs.m5stack.com/zh_CN/arduino/arduino_development)

*驱动芯片:[ST7735S](https://github.com/m5stack/M5-Schematic/blob/master/Core/ST7735S_v1.1.pdf)*
**M5StickC Arduino API**: [点击这里](https://docs.m5stack.com/en/api/stickc/system_m5stickc)

*分辨率:80 * 160*

<table>
<tr><td>ESP32 芯片</td><td>GPIO15</td><td>GPIO13</td><td>GPIO23</td><td>GPIO18</td><td>GPIO5</td></tr>
<tr><td>TFT 屏幕</td><td>TFT_MOSI</td><td>TFT_CLK</td><td>TFT_DC</td><td>TFT_RST</td><td>TFT_CS</td></tr>
</table>

**GROVE 接口**

<table>
<tr><td>ESP32 芯片</td><td>GPIO33</td><td>GPIO32</td><td>5V</td><td>GND</td></tr>
<tr><td>GROVE 接口</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
</table>

**麦克风 MIC ([SPM1423](https://github.com/m5stack/M5-Schematic/blob/master/Core/SPM1423HM4H-B.pdf))**

<table>
<tr><td>ESP32 芯片</td><td>GPIO0</td><td>GPIO34</td></tr>
<tr><td>麦克风 MIC</td><td>SCL</td><td>SDA</td></tr>
</table>

**六轴姿态传感器 ([SH200Q](https://github.com/m5stack/M5-Schematic/blob/master/Core/SH200Q.pdf)) & 电源管理芯片 ([AXP192](https://github.com/m5stack/M5-Schematic/blob/master/Core/AXP192%20Datasheet%20v1.13_cn.pdf))**

<table>
<tr><td>ESP32 芯片</td><td>GPIO22</td><td>GPIO21</td>
<tr><td>六轴姿态传感器</td><td>SCL</td><td>SDA</td>
<tr><td>电源管理芯片</td><td>SCL</td><td>SDA</td>
</table>
**引脚地图**: [点击这里](https://docs.m5stack.com/zh_CN/core/m5stickc)

**M5StickC 顶部拓展的 IO 口**

Expand Down
85 changes: 49 additions & 36 deletions examples/Basics/AXP192/AXP192.ino
Original file line number Diff line number Diff line change
@@ -1,45 +1,58 @@
/*
*******************************************************************************
* Copyright (c) 2021 by M5Stack
* Equipped with M5StickC sample source code
* 配套 M5StickC 示例源代码
* Visit the website for more information:https://docs.m5stack.com/en/core/m5stickc
* 获取更多资料请访问:https://docs.m5stack.com/zh_CN/core/m5stickc
*
* describe: APX192.
* date:2021/9/3
*******************************************************************************
*/
#include <M5StickC.h>
#include "AXP192.h"
TFT_eSprite tftSprite = TFT_eSprite(&M5.Lcd);
#include <M5GFX.h>
M5GFX display;

/* After M5StickC is started or reset
the program in the setUp () function will be run, and this part will only be run once.
在 M5StickC 启动或者复位后,即会开始执行setup()函数中的程序,该部分只会执行一次。 */
void setup() {
M5.begin();
M5.Lcd.setRotation(3);
tftSprite.createSprite(160, 80);
tftSprite.setRotation(3);
M5.Axp.EnableCoulombcounter();
M5.begin();
display.begin();
display.setRotation(3);
M5.Axp.EnableCoulombcounter(); //Enable Coulomb counter. 启用库仑计数器
}

/* After the program in setup() runs, it runs the program in loop()
The loop() function is an infinite loop in which the program runs repeatedly
在setup()函数中的程序执行完后,会接着执行loop()函数中的程序
loop()函数是一个死循环,其中的程序会不断的重复运行 */
void loop() {
tftSprite.fillSprite(BLACK);
tftSprite.setCursor(0, 0, 1);
tftSprite.printf("AXP Temp: %.1fC \r\n", M5.Axp.GetTempInAXP192());
tftSprite.setCursor(0, 10);
tftSprite.printf("Bat:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetBatVoltage(), M5.Axp.GetBatCurrent());
tftSprite.setCursor(0, 30);
tftSprite.printf("USB:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetVBusVoltage(), M5.Axp.GetVBusCurrent());
tftSprite.setCursor(0, 50);
tftSprite.printf("5V-In:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetVinVoltage(), M5.Axp.GetVinCurrent());
tftSprite.setCursor(0, 70);
tftSprite.printf("Bat power %.3fmw", M5.Axp.GetBatPower());
tftSprite.pushSprite(0, 0);
display.setCursor(0, 0, 1);
display.printf("AXP Temp: %.1fC \r\n", M5.Axp.GetTempInAXP192());
display.printf("Bat:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetBatVoltage(), M5.Axp.GetBatCurrent());
display.printf("USB:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetVBusVoltage(), M5.Axp.GetVBusCurrent());
display.printf("5V-In:\r\n V: %.3fv I: %.3fma\r\n", M5.Axp.GetVinVoltage(), M5.Axp.GetVinCurrent());
display.printf("Bat power %.3fmw", M5.Axp.GetBatPower());

// 0x01 long press(1s), 0x02 press
if(M5.Axp.GetBtnPress() == 0x02)
{
esp_restart();
}
if(M5.BtnA.wasPressed())
{
// close tft voltage output
M5.Axp.SetLDO2(false);
// close tft lcd voltage output
M5.Axp.SetLDO3(false);
}
M5.Axp.SetChargeCurrent(CURRENT_100MA);
M5.update();
delay(100);
// 0x01 long press(1s), 0x02 press
if(M5.Axp.GetBtnPress() == 0x02)
{
esp_restart();
}

if(M5.BtnA.wasPressed())
{
// close tft voltage output. 关闭 tft 电压输出
M5.Axp.SetLDO2(false);
// close tft lcd voltage output 关闭tft lcd电压输出
M5.Axp.SetLDO3(false);
}

M5.Axp.SetChargeCurrent(CURRENT_100MA); //set charge current(Not recommend to set charge current > 100mA, since Battery is only 80mAh). 设置充电电流(不建议设置充电电流 > 100mA,因为电池只有 80mAh。)

M5.update();
delay(100);
}
33 changes: 22 additions & 11 deletions examples/Basics/Display/Display.ino
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
/*
*******************************************************************************
* Copyright (c) 2021 by M5Stack
* Equipped with M5StickC sample source code
* 配套 M5StickC 示例源代码
* Visit the website for more information:https://docs.m5stack.com/en/core/m5stickc
* 获取更多资料请访问:https://docs.m5stack.com/zh_CN/core/m5stickc
*
* describe: Display.
* date:2021/9/3
*******************************************************************************
*/
#include <M5StickC.h>

// the setup routine runs once when M5StickC starts up
/* After M5StickC is started or reset
the program in the setUp () function will be run, and this part will only be run once.
在 M5StickC 启动或者复位后,即会开始执行setup()函数中的程序,该部分只会执行一次。 */
void setup() {

// initialize the M5StickC object
M5.begin();

// Lcd display
M5.Lcd.fillScreen(WHITE);
delay(500);
Expand All @@ -18,14 +29,14 @@ void setup() {
M5.Lcd.fillScreen(BLACK);
delay(500);

// text print
// text print. 文字打印
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setCursor(0, 10);
M5.Lcd.setTextColor(WHITE);
M5.Lcd.setTextSize(1);
M5.Lcd.printf("Display Test!");

// draw graphic
// draw graphic. 绘图🌹
delay(1000);
M5.Lcd.drawRect(15, 55, 50, 50, BLUE);
delay(1000);
Expand All @@ -37,11 +48,11 @@ void setup() {
delay(1000);
}

// the loop routine runs over and over again forever
/* After the program in setup() runs, it runs the program in loop()
The loop() function is an infinite loop in which the program runs repeatedly
在setup()函数中的程序执行完后,会接着执行loop()函数中的程序
loop()函数是一个死循环,其中的程序会不断的重复运行 */
void loop(){

//rand draw
//rand draw
M5.Lcd.fillTriangle(random(M5.Lcd.width()-1), random(M5.Lcd.height()-1), random(M5.Lcd.width()-1), random(M5.Lcd.height()-1), random(M5.Lcd.width()-1), random(M5.Lcd.height()-1), random(0xfffe));

//M5.update();
}
27 changes: 22 additions & 5 deletions examples/Basics/HelloWorld/HelloWorld.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
/*
*******************************************************************************
* Copyright (c) 2021 by M5Stack
* Equipped with M5StickC sample source code
* 配套 M5StickC 示例源代码
* Visit the website for more information:https://docs.m5stack.com/en/core/m5stickc
* 获取更多资料请访问:https://docs.m5stack.com/zh_CN/core/m5stickc
*
* describe: Display.
* date:2021/9/3
*******************************************************************************
*/
#include <M5StickC.h>

// the setup routine runs once when M5StickC starts up
/* After M5StickC is started or reset
the program in the setUp () function will be run, and this part will only be run once.
在 M5StickC 启动或者复位后,即会开始执行setup()函数中的程序,该部分只会执行一次。 */
void setup(){
// Initialize the M5StickC object
// Initialize the M5StickC object. 初始化 M5StickC 对象
M5.begin();

// LCD display
// LCD display. LCd显示
M5.Lcd.print("Hello World");
}

// the loop routine runs over and over again forever
/* After the program in setup() runs, it runs the program in loop()
The loop() function is an infinite loop in which the program runs repeatedly
在setup()函数中的程序执行完后,会接着执行loop()函数中的程序
loop()函数是一个死循环,其中的程序会不断的重复运行 */
void loop() {
}
}
Loading

0 comments on commit 3e00ecf

Please sign in to comment.