Skip to content

Get updates #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Dec 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
56cd8f6
Add HardwareSerial::write(const char *)
me-no-dev Nov 16, 2016
6d097cd
Add definitions for yield() and optimistic_yield()
me-no-dev Nov 16, 2016
7abb15c
reset i2c cmd buffer before read/write
me-no-dev Nov 16, 2016
c026661
Add TwoWire::write(const char *) (#56)
minyk Nov 17, 2016
c82699a
Make Wire inherit Stream
me-no-dev Nov 17, 2016
c30012a
Add Kconfig for IDF and option to disable HAL mutexes
me-no-dev Nov 18, 2016
5703b76
pull sdkconfig early so IDF does not warn about redefinition
me-no-dev Nov 18, 2016
1252f7f
add "monitor" build target for idf
me-no-dev Nov 18, 2016
58ac6fb
update idf libs
me-no-dev Nov 18, 2016
dbf030f
Add Node32s to boards.txt (#63)
lamloei Nov 21, 2016
67fd652
Create pins_arduino.h for Node32s(#64)
lamloei Nov 21, 2016
d8b2290
Add 'fromString(const char*)', 'fromString(const String)' to IPAddres…
minyk Nov 24, 2016
be2a26b
set SCL to OUTPUT_OPEN_DRAIN
me-no-dev Nov 25, 2016
f4c2135
RTC pins have pull up/down elsewhere
me-no-dev Nov 26, 2016
1d1aeec
simplify WiFi boot procedure to prepare for on-demand stack load
me-no-dev Nov 27, 2016
b82d0e1
latest IDF, 240MHz and BLE enabled libs
me-no-dev Nov 27, 2016
57c3650
Disconnect WiFiClient on destruct
me-no-dev Nov 29, 2016
8904f52
Allow phy to be initialized only if WiFi/BLE is used/enabled
me-no-dev Dec 1, 2016
3c81739
need close(sockfd) before sockfd = -1, "_connected = false and close …
hirotakaster Dec 1, 2016
6db0ee1
Optimize GPIO and account for micros overflow in delayMicroseconds
me-no-dev Dec 2, 2016
49f35ff
use esp_random in WMath.cpp
me-no-dev Dec 2, 2016
e77ec63
Fix deprecation warnings in ESP.cpp
me-no-dev Dec 2, 2016
ee36407
Update IDF libs
me-no-dev Dec 2, 2016
6dc3407
Add correct definitions for word
me-no-dev Dec 5, 2016
ba04076
Move definitions to not conflict with C includes
me-no-dev Dec 5, 2016
ee4a825
Add from-scratch Windows installation instructions
me-no-dev Dec 6, 2016
42c1d58
Update windows.md
me-no-dev Dec 6, 2016
13268b9
Update README.md
me-no-dev Dec 6, 2016
48abb79
Remove autostart define overwrite
me-no-dev Dec 7, 2016
758553a
Add analogRead, touchRead, dacWrite and updated esp-idf
me-no-dev Dec 8, 2016
ddb2541
Update README.md
me-no-dev Dec 8, 2016
35e54f2
Add definitions for ADC, Touch and DAC pins
me-no-dev Dec 8, 2016
d1025b6
Update esp32-hal-i2c.c
me-no-dev Dec 9, 2016
f5d6828
Adjust interrupt numbers for GPIO and Touch
me-no-dev Dec 9, 2016
4e458fd
Initial Timers driver
me-no-dev Dec 9, 2016
8e7d00b
i2c revert to old fifo write
me-no-dev Dec 9, 2016
d8e74f2
Format README contents; add instructions for @PlatformIO (#88)
ivankravets Dec 10, 2016
54b1b8b
const correctness (#89)
Palatis Dec 11, 2016
a6c02bc
Add some missing defines
me-no-dev Dec 12, 2016
c336989
Add Gitter badge (#96)
gitter-badger Dec 13, 2016
551e422
Fix typos (#95)
eroniki Dec 13, 2016
7defc6e
Update README.md
me-no-dev Dec 13, 2016
e92634a
Add analogSetAttenuation and analogSetPinAttenuation
me-no-dev Dec 14, 2016
c19fc06
Hopefully fix I2C/Wire
me-no-dev Dec 14, 2016
917a4fd
allow setting internal pull resistors for any mode and enable them fo…
me-no-dev Dec 14, 2016
04e0902
Wire: if we are reading only one byte, do not send empty read command
me-no-dev Dec 14, 2016
b86fb30
cleanup read commands
me-no-dev Dec 14, 2016
668c381
Wire: wait while bus is busy if ack failed
me-no-dev Dec 14, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
menu "Arduino Configuration"

choice MONITOR_BAUD
prompt "Monitor baud rate"
default MONITOR_BAUD_115200B
help
Baud rate to use while monitoring the ESP chip.

config MONITOR_BAUD_9600B
bool "9600 bps"
config MONITOR_BAUD_57600B
bool "57600 bps"
config MONITOR_BAUD_115200B
bool "115200 bps"
config MONITOR_BAUD_230400B
bool "230400 bps"
config MONITOR_BAUD_921600B
bool "921600 bps"
config MONITOR_BAUD_2MB
bool "2 Mbps"
config MONITOR_BAUD_OTHER
bool "Custom baud rate"

endchoice

config MONITOR_BAUD_OTHER_VAL
int "Custom baud rate value" if MONITOR_BAUD_OTHER
default 115200

config MONITOR_BAUD
int
default 9600 if MONITOR_BAUD_9600B
default 57600 if MONITOR_BAUD_57600B
default 115200 if MONITOR_BAUD_115200B
default 230400 if MONITOR_BAUD_230400B
default 921600 if MONITOR_BAUD_921600B
default 2000000 if MONITOR_BAUD_2MB
default MONITOR_BAUD_OTHER_VAL if MONITOR_BAUD_OTHER

config AUTOSTART_ARDUINO
bool "Autostart Arduino setup and loop on boot"
default "n"
help
Enabling this option will implement app_main and start Arduino.
All you need to implement in your main.cpp is setup() and loop()
and include Arduino.h
If disabled, you can call initArduino() to run any preparations
required by the framework

config DISABLE_HAL_LOCKS
bool "Disable mutex locks for HAL"
default "n"
help
Enabling this option will run all hardware abstraction without locks.
While communication with external hardware will be faster, you need to
make sure that there is no option to use the same bus from another thread
or interrupt at the same time. Option is best used with Arduino enabled
and code implemented only in setup/loop and Arduino callbacks

menu "Debug Log Configuration"
choice ARDUHAL_LOG_DEFAULT_LEVEL
bool "Default log level"
default ARDUHAL_LOG_DEFAULT_LEVEL_ERROR
help
Specify how much output to see in logs by default.

config ARDUHAL_LOG_DEFAULT_LEVEL_NONE
bool "No output"
config ARDUHAL_LOG_DEFAULT_LEVEL_ERROR
bool "Error"
config ARDUHAL_LOG_DEFAULT_LEVEL_WARN
bool "Warning"
config ARDUHAL_LOG_DEFAULT_LEVEL_INFO
bool "Info"
config ARDUHAL_LOG_DEFAULT_LEVEL_DEBUG
bool "Debug"
config ARDUHAL_LOG_DEFAULT_LEVEL_VERBOSE
bool "Verbose"
endchoice

config ARDUHAL_LOG_DEFAULT_LEVEL
int
default 0 if ARDUHAL_LOG_DEFAULT_LEVEL_NONE
default 1 if ARDUHAL_LOG_DEFAULT_LEVEL_ERROR
default 2 if ARDUHAL_LOG_DEFAULT_LEVEL_WARN
default 3 if ARDUHAL_LOG_DEFAULT_LEVEL_INFO
default 4 if ARDUHAL_LOG_DEFAULT_LEVEL_DEBUG
default 5 if ARDUHAL_LOG_DEFAULT_LEVEL_VERBOSE

config ARDUHAL_LOG_COLORS
bool "Use ANSI terminal colors in log output"
default "n"
help
Enable ANSI terminal color codes in bootloader output.
In order to view these, your terminal program must support ANSI color codes.

endmenu

config AUTOCONNECT_WIFI
bool "Autoconnect WiFi on boot"
default "n"
depends on AUTOSTART_ARDUINO
help
If enabled, WiFi will connect to the last used SSID (if station was enabled),
else connection will be started only after calling WiFi.begin(ssid, password)

endmenu
3 changes: 3 additions & 0 deletions Makefile.projbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#build with "make flash monitor" to upload and open serial monitor
monitor:
$(Q) miniterm.py --rts 0 --dtr 0 --raw $(ESPPORT) $(CONFIG_MONITOR_BAUD)
140 changes: 120 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
Arduino core for ESP32 WiFi chip
===========================================
# Arduino core for ESP32 WiFi chip

### Development Status
## Need help or have a question? Join the chat at [![https://gitter.im/espressif/arduino-esp32](https://badges.gitter.im/espressif/arduino-esp32.svg)](https://gitter.im/espressif/arduino-esp32?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

- [Development Status](#development-status)
- Installing options:
+ [Using Arduino IDE](#using-arduino-ide)
+ [Using PlatformIO](#using-platformio)
+ [Using as ESP-IDF component](#using-as-esp-idf-component)
- [ESP32Dev Board PINMAP](#esp32dev-board-pinmap)

## Development Status
Not everything is working yet, you can not get it through package manager, but you can give it a go and help us find bugs in the things that are implemented :)

The framework can also be downloaded as component in an IDF project and be used like that.

Things that "should" work:
Things that work:

- pinMode
- digitalRead/digitalWrite
- attachInterrupt/detachInterrupt
- analogRead/touchRead/touchAttachInterrupt
- ledcWrite/sdWrite/dacWrite
- Serial (global Serial is attached to pins 1 and 3 by default, there are another 2 serials that you can attach to any pin)
- SPI (global SPI is attached to VSPI pins by default and HSPI can be attached to any pins)
- Wire (global Wire is attached to pins 21 and 22 by default and there is another I2C bus that you can attach to any pins)
Expand All @@ -18,21 +29,110 @@ Things that "should" work:
WiFiClient, WiFiServer and WiFiUdp are not quite ready yet because there are still some small hiccups in LwIP to be overcome.
You can try WiFiClient but you need to disconnect the client yourself to be sure that connection is closed.

### Installation
- Install Arduino IDE
- Go to Arduino IDE installation directory
- Clone this repository into hardware/espressif/esp32 directory (or clone it elsewhere and create a symlink)
```bash
cd hardware
mkdir espressif
cd espressif
git clone https://github.com/espressif/arduino-esp32.git esp32
```
- Download binary tools (you need Python 2.7)
```bash
cd esp32/tools
python get.py
```
- Restart Arduino
## Using Arduino IDE

###[Instructions for Windows](doc/windows.md)

### 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):

```bash
curl -o get-pip.py https://bootstrap.pypa.io/get-pip.py && \
sudo python get-pip.py && \
sudo pip install pyserial && \
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
```
- Restart Arduino IDE

### 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):

```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
```
- Restart Arduino IDE

## Using PlatformIO

[PlatformIO](http://platformio.org) is an open source ecosystem for IoT
development with cross platform build system, library manager and full support
for Espressif ESP32 development. It works on the popular host OS: Mac OS X, Windows,
Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).

- [What is PlatformIO?](http://docs.platformio.org/page/what-is-platformio.html)
- [PlatformIO IDE](http://platformio.org/platformio-ide)
- Quick Start with [PlatformIO IDE](http://docs.platformio.org/page/ide/atom.html#quick-start) or [PlatformIO Core](http://docs.platformio.org/page/core.html)
- [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/page/ide.html) -
Cloud9, Codeanywehre, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM and Visual Studio
- [Project Examples](https://github.com/platformio/platform-espressif32/tree/develop/examples)

## Using as ESP-IDF component
- Download and install [esp-idf](https://github.com/espressif/esp-idf)
- Create blank idf project (from one of the examples)
- in the project folder, create a folder called components and clone this repository inside

```bash
mkdir -p components && \
cd components && \
git clone https://github.com/espressif/arduino-esp32.git arduino && \
cd .. && \
make menuconfig
```
- ```make menuconfig``` has some Arduino options
- "Autostart Arduino setup and loop on boot"
- If you enable this options, your main.cpp should be formated like any other sketch

```arduino
//file: main.cpp
#include "Arduino.h"

void setup(){
Serial.begin(115200);
}

void loop(){
Serial.println("loop");
delay(1000);
}
```
- Else you need to implement ```app_main()``` and call ```initArduino();``` in it.

Keep in mind that setup() and loop() will not be called in this case

```arduino
//file: main.cpp
#include "Arduino.h"

extern "C" void app_main()
{
initArduino();
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
//do your own thing
}
```
- "Disable mutex locks for HAL"
- If enabled, there will be no protection on the drivers from concurently accessing them from another thread/interrupt/core
- "Autoconnect WiFi on boot"
- If enabled, WiFi will start with the last known configuration
- Else it will wait for WiFi.begin
- ```make flash monitor``` will build, upload and open serial monitor to your board

## ESP32Dev Board PINMAP

![Pin Functions](doc/esp32_pinmap.png)
52 changes: 46 additions & 6 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ esp32.build.core=esp32
esp32.build.variant=esp32
esp32.build.board=ESP32_DEV

esp32.build.f_cpu=160000000L
esp32.build.f_cpu=240000000L
esp32.build.flash_mode=dio
esp32.build.flash_size=4MB

Expand Down Expand Up @@ -57,7 +57,7 @@ esp320.build.core=esp32
esp320.build.variant=esp320
esp320.build.board=ESP320

esp320.build.f_cpu=160000000L
esp320.build.f_cpu=240000000L
esp320.build.flash_mode=qio
esp320.build.flash_size=4MB

Expand Down Expand Up @@ -97,7 +97,7 @@ nano32.build.core=esp32
nano32.build.variant=nano32
nano32.build.board=NANO32

nano32.build.f_cpu=160000000L
nano32.build.f_cpu=240000000L
nano32.build.flash_mode=dio
nano32.build.flash_size=4MB

Expand Down Expand Up @@ -137,7 +137,7 @@ lolin32.build.core=esp32
lolin32.build.variant=lolin32
lolin32.build.board=LoLin32

lolin32.build.f_cpu=160000000L
lolin32.build.f_cpu=240000000L
lolin32.build.flash_mode=dio
lolin32.build.flash_size=4MB

Expand Down Expand Up @@ -177,7 +177,7 @@ espea32.build.core=esp32
espea32.build.variant=espea32
espea32.build.board=ESPea32

espea32.build.f_cpu=160000000L
espea32.build.f_cpu=240000000L
espea32.build.flash_mode=dio
espea32.build.flash_size=4MB

Expand Down Expand Up @@ -217,7 +217,7 @@ quantum.build.core=esp32
quantum.build.variant=quantum
quantum.build.board=QUANTUM

quantum.build.f_cpu=160000000L
quantum.build.f_cpu=240000000L
quantum.build.flash_mode=qio
quantum.build.flash_size=16MB

Expand All @@ -240,3 +240,43 @@ quantum.menu.UploadSpeed.460800.macosx=460800
quantum.menu.UploadSpeed.460800.upload.speed=460800
quantum.menu.UploadSpeed.512000.windows=512000
quantum.menu.UploadSpeed.512000.upload.speed=512000

##############################################################
node32s.name=Node32s

node32s.upload.tool=esptool
node32s.upload.maximum_size=1044464
node32s.upload.maximum_data_size=294912
node32s.upload.wait_for_upload_port=true

node32s.serial.disableDTR=true
node32s.serial.disableRTS=true

node32s.build.mcu=esp32
node32s.build.core=esp32
node32s.build.variant=node32s
node32s.build.board=Node32s

node32s.build.f_cpu=240000000L
node32s.build.flash_mode=dio
node32s.build.flash_size=4MB

node32s.menu.FlashFreq.80=80MHz
node32s.menu.FlashFreq.80.build.flash_freq=80m
node32s.menu.FlashFreq.40=40MHz
node32s.menu.FlashFreq.40.build.flash_freq=40m

node32s.menu.UploadSpeed.921600=921600
node32s.menu.UploadSpeed.921600.upload.speed=921600
node32s.menu.UploadSpeed.115200=115200
node32s.menu.UploadSpeed.115200.upload.speed=115200
node32s.menu.UploadSpeed.256000.windows=256000
node32s.menu.UploadSpeed.256000.upload.speed=256000
node32s.menu.UploadSpeed.230400.windows.upload.speed=256000
node32s.menu.UploadSpeed.230400=230400
node32s.menu.UploadSpeed.230400.upload.speed=230400
node32s.menu.UploadSpeed.460800.linux=460800
node32s.menu.UploadSpeed.460800.macosx=460800
node32s.menu.UploadSpeed.460800.upload.speed=460800
node32s.menu.UploadSpeed.512000.windows=512000
node32s.menu.UploadSpeed.512000.upload.speed=512000
1 change: 0 additions & 1 deletion component.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
COMPONENT_ADD_INCLUDEDIRS := cores/esp32 variants/esp32 libraries/WiFi/src libraries/SPI/src libraries/Wire/src
COMPONENT_PRIV_INCLUDEDIRS := cores/esp32/libb64
COMPONENT_SRCDIRS := cores/esp32/libb64 cores/esp32 variants/esp32 libraries/WiFi/src libraries/SPI/src libraries/Wire/src
include $(IDF_PATH)/make/component_common.mk
CXXFLAGS += -fno-rtti
Loading