diff --git a/README.md b/README.md index 5636370..6358635 100644 --- a/README.md +++ b/README.md @@ -1,71 +1,40 @@ # M5Stack Library -## Installation Instructions +## Usage +### Installing the USB Driver +- [Download the SiLabs CP2104 Driver](https://www.silabs.com/community/interface/knowledge-base.entry.html/2017/01/10/legacy_os_softwarea-bgvU) -### 1. Install the SiLabs CP2104 Driver -- [Download the SiLabs CP2104 Driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) +### Using with Arduino IDE +Espressif’s official ESP32 Arduino core is hosted here on GitHub: +- [Installing the ESP32 Arduino Core](https://github.com/espressif/arduino-esp32#installation-instructions) -### 2. Using through Arduino IDE +### Download Library -#### [Instructions for Windows](https://github.com/m5stack/m5stack-board-support/blob/master/doc/windows.md) +#### Arduino -#### Instructions for Mac -- Install latest Arduino IDE from [arduino.cc](https://www.arduino.cc/en/Main/Software) -- Open Terminal and execute the following command (copy->paste and hit enter): +#### Using the Arduino IDE Library Manager - ```bash - mkdir -p ~/Documents/Arduino/hardware/espressif && \ - cd ~/Documents/Arduino/hardware/espressif && \ - git clone https://github.com/espressif/arduino-esp32.git esp32 && \ - cd esp32/tools/ && \ - python get.py && \ - cd ~/Documents/Arduino/libraries && \ - git clone https://github.com/m5stack/M5Stack.git - ``` -- Restart Arduino IDE +1. Choose ```Sketch``` -> ```Include Library``` -> ```Manage Libraries...``` +2. Type ```m5stack``` into the search box. +3. Click the row to select the library. +4. Click the ```Install``` button to install the library. +5. Click "File-> Examples". Here are some test programs in "M5Stack->" -#### Instructions for Debian/Ubuntu Linux -- Install latest Arduino IDE from [arduino.cc](https://www.arduino.cc/en/Main/Software) -- Open Terminal and execute the following command (copy->paste and hit enter): +#### Using Git +```sh +cd ~/Documents/Arduino/libraries/ +git clone https://github.com/m5stack/M5Stack.git +``` - ```bash - sudo usermod -a -G dialout $USER && \ - sudo apt-get install git && \ - wget https://bootstrap.pypa.io/get-pip.py && \ - sudo python get-pip.py && \ - sudo pip install pyserial && \ - mkdir -p ~/Arduino/hardware/espressif && \ - cd ~/Arduino/hardware/espressif && \ - git clone https://github.com/espressif/arduino-esp32.git esp32 && \ - cd esp32/tools/ && \ - python get.py && \ - cd ~/Arduino/libraries && \ - git clone https://github.com/m5stack/M5Stack.git - ``` -- Restart Arduino IDE +## API +See [API.md](https://github.com/m5stack/M5Stack/blob/master/src/M5Stack.h#L19). -~~#### Installing with Boards Manager(beta)~~ - -~~Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).~~ - -~~- Install Arduino 1.8.2 from the [Arduino website](http://www.arduino.cc/en/main/software).~~ -~~- Start Arduino and open Preferences window.~~ -~~- Enter ```http://www.m5stack.com/download/package_m5stack_index.json``` into *Additional Board Manager URLs* field. You can add multiple URLs, separating them with commas.~~ -~~- Open Boards Manager from Tools > Board menu and install *ESP32* platform (and don't forget to select your ESP32 board from Tools > Board menu after installation).~~ - -## How to use: - -1. Open the Arduino Application. (If it's already open, you will need to restart it to see changes.) - -2. Click "File-> Examples". Here are some test programs in "M5Stack->" - -3. Depending on the type of board you're using, you need to modify the header file to match. - For example, if you're using a M5Stack. - You just `#include ` +## Examples +See [examples](examples) folder. -## Hardware pinout -### Internal +## Hardware +### Pinout Peripheral Devices | ESP32 ---|--- ILI9341 RST | GPIO33 diff --git a/examples/Advanced/Display/JpegDraw/JpegDraw.ino b/examples/Advanced/Display/JpegDraw/JpegDraw.ino index b2b06a5..d884847 100644 --- a/examples/Advanced/Display/JpegDraw/JpegDraw.ino +++ b/examples/Advanced/Display/JpegDraw/JpegDraw.ino @@ -7,6 +7,7 @@ void setup(void) { //Draw the jpeg file form TF card M5.Lcd.setBrightness(200); M5.Lcd.drawJpgFile(SD, "/p2.jpg"); + // M5.Lcd.drawJpgFile(SD, "/p1.jpg", 20, 30, 40, 50); // M5.Lcd.drawJpgFile(fs::FS &fs, const char *path, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight, uint16_t offX, uint16_t offY, jpeg_div_t scale); } diff --git a/examples/Basics/Display/Display.ino b/examples/Basics/Display/Display.ino index d7e31bd..248797a 100644 --- a/examples/Basics/Display/Display.ino +++ b/examples/Basics/Display/Display.ino @@ -5,7 +5,7 @@ void setup() { // initialize the M5Stack object M5.begin(); - M5.lcd.drawBitmap(0, 0, 320, 240, (uint16_t *)gImage_logoM5); + M5.Lcd.drawBitmap(0, 0, 320, 240, (uint16_t *)gImage_logoM5); delay(500); // Lcd display diff --git a/examples/Basics/FactoryTest/FactoryTest.ino b/examples/Basics/FactoryTest/FactoryTest.ino index 643e62e..d9dff1e 100644 --- a/examples/Basics/FactoryTest/FactoryTest.ino +++ b/examples/Basics/FactoryTest/FactoryTest.ino @@ -104,41 +104,41 @@ void wifi_test() { delay(100); Serial.println("scan start"); - M5.lcd.println("scan start"); + M5.Lcd.println("scan start"); // WiFi.scanNetworks will return the number of networks found int n = WiFi.scanNetworks(); Serial.println("scan done"); - M5.lcd.println("scan done"); + M5.Lcd.println("scan done"); if (n == 0) { Serial.println("no networks found"); - M5.lcd.println("no networks found"); + M5.Lcd.println("no networks found"); } else { Serial.print(n); - M5.lcd.print(n); + M5.Lcd.print(n); Serial.println(" networks found"); - M5.lcd.println(" networks found"); + M5.Lcd.println(" networks found"); for (int i = 0; i < n; ++i) { // Print SSID and RSSI for each network found Serial.print(i + 1); - M5.lcd.print(i + 1); + M5.Lcd.print(i + 1); Serial.print(": "); - M5.lcd.print(": "); + M5.Lcd.print(": "); Serial.print(WiFi.SSID(i)); - M5.lcd.print(WiFi.SSID(i)); + M5.Lcd.print(WiFi.SSID(i)); Serial.print(" ("); - M5.lcd.print(" ("); + M5.Lcd.print(" ("); Serial.print(WiFi.RSSI(i)); - M5.lcd.print(WiFi.RSSI(i)); + M5.Lcd.print(WiFi.RSSI(i)); Serial.print(")"); - M5.lcd.print(")"); + M5.Lcd.print(")"); Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*"); - M5.lcd.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*"); + M5.Lcd.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*"); delay(5); } } Serial.println(""); - M5.lcd.println(""); + M5.Lcd.println(""); } bool gpio_test_flg = 0; @@ -439,7 +439,7 @@ void setup() { Wire.begin(); // Lcd display - M5.lcd.setBrightness(100); + M5.Lcd.setBrightness(100); M5.Lcd.fillScreen(BLACK); M5.Lcd.setCursor(10, 10); M5.Lcd.setTextColor(WHITE); @@ -538,7 +538,7 @@ void setup() { 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)); } for(int i=255; i>=0; i--) { - M5.lcd.setBrightness(i); + M5.Lcd.setBrightness(i); delay(2); } @@ -546,7 +546,7 @@ void setup() { M5.Lcd.setCursor(0, 10); M5.Lcd.fillScreen(BLACK); for(int i=0; i<200; i++) { - M5.lcd.setBrightness(i); + M5.Lcd.setBrightness(i); delay(2); } diff --git a/examples/Basics/Hello/Hello.ino b/examples/Basics/Hello/Hello.ino index a71a586..7adfe16 100644 --- a/examples/Basics/Hello/Hello.ino +++ b/examples/Basics/Hello/Hello.ino @@ -4,10 +4,10 @@ void setup(){ // Initialize the M5Stack object - m5.begin(); + M5.begin(); // LCD display - m5.Lcd.printf("hello world"); + M5.Lcd.printf("hello world"); } // the loop routine runs over and over again forever diff --git a/library.properties b/library.properties index f5e69fc..2479557 100644 --- a/library.properties +++ b/library.properties @@ -2,10 +2,9 @@ name=M5Stack version=0.1.3 author=M5Stack maintainer=Zibin Zheng -sentence=Driver for M5Stack Core development kit +sentence=Library for M5Stack Core development kit paragraph=See more on http://M5Stack.com category=Device Control url=https://github.com/m5stack/m5stack architectures=esp32 includes=M5Stack.h - diff --git a/src/M5Stack.cpp b/src/M5Stack.cpp index 7c3284e..ee2ee9c 100644 --- a/src/M5Stack.cpp +++ b/src/M5Stack.cpp @@ -97,7 +97,6 @@ void M5Stack::powerOFF() { Lcd.sleep(); // ESP32 into deep sleep - uint64_t _wakeupPin_mask = 1ULL << _wakeupPin; USE_SERIAL.printf("Enabling EXT0 wakeup on pins GPIO%d\n", _wakeupPin); esp_deep_sleep_enable_ext0_wakeup((gpio_num_t)_wakeupPin , LOW);