Commit Graph

361 Commits

Author SHA1 Message Date
Me No Dev
f5cacfee1a
Remove extra connects from Client.h (#3191) 2019-09-09 09:36:22 +03:00
Jeroen88
f71a4bd406 Bugfix/detect baudrate (#3188)
* Expose uartStartDetectBaudrate(uart_t *) in esp32-hal-uart.h and call it from HardwareSerial::begin() if baudrate detection is requested (by passing a baudrate of 0) to solve baudrate detection problems

* Avoid a division by zero error in uartGetBaudRate()
2019-09-09 00:59:32 +03:00
Me No Dev
5f77b0108b
Fix return of Print::print(timeinfo, format) (#3189) 2019-09-09 00:36:30 +03:00
Tijs van Roon
717ca79ecb #3181 printf double vsnprintf() fix, malloc, va_end (#3184)
* Use loc_buf for small strings, check for error return from vsnprintf

* cleanup arg when bailing out of new

* Use malloc/free instead of new/delete in printf

* Return actual bytes written in printf

* FIX: write before free
2019-09-08 23:49:32 +03:00
Me No Dev
80ea521940
Add support for 160MHz rated CPUs (#3135)
Some ESP32 chips are rated only to 160MHz. This change adds support for them and does not allow frequency to be switched to 240MHz
2019-09-05 12:30:43 +03:00
Earle F. Philhower, III
fd089d8fd3 Pull in ESP8266 String::replace() fixes, others (#3143)
Pull in bugfixes from the ESP8266 repo for problems in the SSO
implementation of replace().  See the following patches for full
details:

54240d2cc5 (diff-8d9e71e16d437343017df828f0528f63)
78a1a66e6d (diff-8d9e71e16d437343017df828f0528f63)
4e9358445a (diff-8d9e71e16d437343017df828f0528f63)

Fixes #3140
2019-08-27 20:05:36 +03:00
Roman Savrulin
03066e42ef Flush UART RX queue too (#3009) 2019-08-20 16:48:52 +03:00
lbernstone
cd5257ad78 ESP.getCpuFreqMHz fix (#3007)
* ESP.getCpuFreqMHz was returning the CONFIG_ variable.  Now calls the getCpuFrequencyMhz function.

* Changed the Esp function to uint32_t to match
2019-08-20 16:48:26 +03:00
A C SREEDHAR REDDY
2a1fde7736 Include stdint for uint16_t (#3069) 2019-08-20 16:39:31 +03:00
Mike Dunston
007a93ec7e Update Print.cpp (#3060)
#2891
2019-08-20 16:36:04 +03:00
Brian Park
56ce580b0e Fix incorrect definition of FPSTR() and move from pgmspace.h to WString.h (#1371) (#2961) 2019-07-17 10:16:47 +03:00
chuck todd
d2816b2f32 Fix Unused Variable Warning (#2940)
Some Debugging variables were enabled at ERROR level instead of DEBUG.  Specifically `tAfter` and `tBefore`
2019-07-09 19:24:35 +03:00
Artur Bieniek
89feacb813 Fix map() division by zero (#2848) 2019-06-05 13:48:13 +02:00
Angus Gratton
2f249edb8e Use std::abs for a float-compatible abs() function (#2738)
* Other Arduino cores uses a macro to redefine libc abs() to take any
  type, meaning abs(-3.3) == 3.3 not the normal libc result of 3.

* 1e4bf14a3 (#1783) replaced similar min, max macros with c++ stdlib. However
  this change includes <algorithm> after the line which defines the abs() macro.
  <algorithm> includes <cstdlib> which undefines abs() and re-defines it.

* This means abs() becomes the plain libc version again which only takes
  integers, so abs(-3.3) == 3. As reported here:
  https://github.com/espressif/esp-idf/issues/3405

This fix tries to keep in the spirit of #1783 by using libstdc++. The other
option would be to include <cstdlib> before defining the abs() macro, so it
doesn't get undef-ed again later on.
2019-05-11 11:18:39 +03:00
Earle F. Philhower, III
bd57ff4ab4 StreamString SSO fix (#2736)
As found by @mongozmaki in https://github.com/esp8266/Arduino/pull/6035

With SSO implementation in String, StreamString::write generates wrong
strings under some circumstances.  Reason is that String::len() returns
strlen(sso_buf) if SSO=true but with newly written data
(in StreamString::write) the null-termination missing at the time len()
is called.

Furthermore, len() is called twice which is inefficient if SSO=true.
2019-05-11 11:16:05 +03:00
Me No Dev
50d142950d
Update esp32-hal-rmt.c 2019-05-01 20:10:41 +03:00
Earle F. Philhower, III
d13de284b8 Undo the redefinition of FPSTR from 8266 merge (#2726)
Fixes Arduino.h redefinition errors.
2019-04-30 16:52:14 +03:00
Earle F. Philhower, III
ab309e40d5 Copy ESP8266 String w/SSO to ESP32 repo (#2715)
I redid the ESP8266 WString library to enable small string optimization
(SSO) a while back, and think it would be helpful even on the ESP32 with
its higher memory complement.

SSO avoids lots of tiny mallocs() on the heap which cause fragmentation
by using the memory in the class object itself to store the actual
string and only mallocing() for buffers that are larger than what can
fit in thie class object.  Modern C++ std::string implementations have
this optimization as well, but since we're using Arduino strings we had
to roll our own.
2019-04-26 19:41:42 +03:00
Dirk O. Kaar
119ece2b0f Portability from ESP8266, virtual Stream member functions. (#2701) 2019-04-23 17:56:49 +03:00
me-no-dev
9a9ff62216 Add connect with timeout to Client class 2019-04-15 18:01:43 +02:00
me-no-dev
fa74767b2e Allow selecting in IDF the running core for Arduino's core tasks 2019-04-13 17:13:13 +02:00
me-no-dev
6dab3f6777 Fix LEDC channels above 8 not properly clearing
Fixes: https://github.com/espressif/arduino-esp32/issues/2660
2019-04-12 17:49:44 +02:00
Victor Aprea
25c0b52212 Alternative Improve _uploadReadByte (#2656)
* add opportunity for more than one retry to _uploadReadByte

* an alternative timeout-based method to making _uploadReadByte more resilient

* move timing variables in the correct scope

* implement and use client.getTimeout instead of hard-coded timeout in _uploadReadByte

* add missing return

* some refactoring to address respecting the timeout in a potentially deadlocked connection

* fix spelling in comment

* address review comments; move impl to cpp file for getTimeout, and remove local variable for currentMillis

* remove redundant cast

* need to check for timeout outside the inner while as well

* update WebUpdate example to print something in unexpected callback condition

* update log_e messages per review comments
2019-04-12 12:45:35 +02:00
chuck todd
91508030d8 Hide log_v behind conditional define, reduce excessive logging (#2641)
@cyberman54 from #2250 recommended reducing unnecessary logging.
2019-04-10 02:43:21 +02:00
A C SREEDHAR REDDY
0906bf580f update getLocalTime(). (#2629)
* update getLocalTime().

* change count to millis in getLocalTime

* timeout logic.
2019-04-10 02:39:14 +02:00
lbernstone
8e8c5035ea Added rmtDeinit to header. Fixes #2585 (#2587)
* Added rmtDeinit to header. Fixes #2585

* oops.  missing ;
2019-04-09 21:09:40 +02:00
Mike Dunston
f3c1a91f8e adding uartRxActive to expose the RX state machine status as a boolean value (#2457) 2019-03-03 15:47:24 +01:00
lbernstone
2bb32bd4b0 Unbiased random (#2468)
* An example to read high frequency analog data using i2s_adc

* Changed random() to use Lemire's method for bounding
2019-02-18 12:18:49 +02:00
Me No Dev
010a7c60f7
Update IDF to abea9e4c0 (#2458)
* Update IDF to abea9e4c0

* Update esptool

* Enable PSRAM for PICO D4

* Enable APP_ROLLBACK_ENABLE
2019-02-14 16:49:30 +01:00
Nguyen Hong Thiet
c0345eafbf fix missing the first bit in HC589 shift in (#2448) 2019-02-14 13:11:08 +01:00
Jeroen88
71ec3c3e31 Correct millis() error causes by micros() overflow every about 72 minutes (#2438) 2019-02-14 13:09:51 +01:00
chuck todd
8ec76405b9 Fix compile warning, esp32-hal-i2c.c (#2434)
@tread-Qualitrol discovered this error.
2019-02-14 13:09:05 +01:00
HanCheol Cho
8cbc60edbc fixed rmt receive data pointer position. (#2353) 2019-01-22 17:29:32 +08:00
Me No Dev
6cf307dbd1
Fix copy/paste error in RMT
Fixes: https://github.com/espressif/arduino-esp32/issues/2316
2019-01-14 19:30:07 +08:00
me-no-dev
81844f5360 Add API to feed the loop WDT (call from loop only) 2019-01-12 13:02:38 +01:00
chuck todd
9a7946e685 I2C fix READ of zero bytes hardware hang (#2301)
The i2c peripheral will hang if a READ request is issued with a zero data length.  The peripheral
drops into a continuous timeout interrupt response.  The STOP command can not be set out to the I2C
bus. The SLAVE device correctly ACK'd the address byte, with READ bit set, it has control of the SDA
 pin.  The ESP32 send out the next SCL HIGH pulse but, since the SLAVE is in READ Mode, and the First
bit it is sending happened to be a ZERO, the ESP32 cannot send the STOP.  When it releases SDA during
the SCL HIGH, the pin does not change state.  The pin stays low because the SLAVE is outputing a LOW!
The ESP32 drops into a perminent WAIT state waiting for SDA to go HIGH (the STOP).

**esp32-hal-i2c.c**
* add databuff length checks to `i2cRead()` and `i2cWrite()`
2019-01-10 21:37:13 +01:00
me-no-dev
70656aa129 fix leak in log_printf 2019-01-09 21:37:31 +01:00
Me No Dev
2fd39b1aff
Handle APB frequency change (#2250)
* Add APB change callbacks and move cpu code to own file

* Properly set esp_timer and FreeRTOS tick dividers

* Improve updated devisors

* No need to update REF_TICK yet

* Add initial handling for UART baud change

* fix uartWriteBuf and uartDetectBaudrate

* trigger callbacks even when APB did not change

* toggle UART ISR on CPU change

* add XTAL freq getter and add cpu freq validation

* Support CPU frequency changes in I2C (#2287)

**esp32-hal-i2c.c**
* add callback for cpu frequency changes
* adjust fifo thresholds based on cpu frequency and i2c bus frequency
* reduce i2c bus frequency if differential is too small
**Wire.h**
* version to 1.1.0

* Implement clock change for the other peripherals

* remove bad CPU clock values from the menu

* Add note to CPU freqs that support WiFi and BT
2019-01-09 10:07:54 +01:00
me-no-dev
28ea39cf05 Add WDT API for Core 0 and disable it while SPIFFS is formatting 2018-12-28 21:14:46 +02:00
Me No Dev
f49c854ff3
Update IDF to 97eecfa, enable reboot on WDT and add WDT API (#2248)
* Update IDF to 97eecfa and enable reboot on WDT

* Add API to enable/disable WDT for Core 1 and Arduino Loop
2018-12-28 20:37:33 +02:00
me-no-dev
879388e170 Update esp32-hal-gpio.c
fix copy/paste error
2018-12-28 19:14:15 +02:00
Me No Dev
1085e9a8f0
Fix bad multiplier calculation 2018-12-24 13:55:08 +02:00
Tomasz Ścisłowicz
5af139bb74 HardwareSerial - add changeBaudRate method (#2223)
* Add updateBaudRate to hardware serial

* remove flush

* Fix tab
2018-12-23 21:15:06 +02:00
atanisoft
4f9a90fa0e fix #2232 and #2033 (#2233) 2018-12-23 19:06:43 +02:00
chuck todd
310e78e6fd Support CPU frequency changes (#2222)
The I2C hardware has limitations on min and max bus frequency directly related to CPU frequency, bus speed cannot be greater than 1/100 CPU clock, nor less than CPU clock / 8192.
2018-12-20 08:56:02 +01:00
Me No Dev
c827bb4177
CPU and APB Frequency support (#2220)
* Add support to HAL for APB frequencies different than 80MHz

* Add support for CPU frequencies in the IDE board menu

* Switch to fast set_config

* Add method to uart so debug can be reassigned after apb frequency switch

* Return real APB frequency
2018-12-20 01:57:32 +01:00
me-no-dev
3e66aeff84 Handle better 160MHz cpu clock 2018-12-18 22:04:02 +01:00
me-no-dev
66d33f792c Add support for CPU Frequency switching
Experimental!
2018-12-18 20:04:16 +01:00
atanisoft
39836f12df correct bounds checking in Print::printf to avoid corner case of len=64 (#2204) 2018-12-16 17:09:26 +01:00
Me No Dev
6f6ee98188
Update ESP-IDF da2116f + esp32-camera f8f26ab + BLE b232e7f (#2194)
* ESP-IDF da2116f + esp32-camera f8f26ab +BLE b232e7f

* Fix fail compilation due to missing cpp guard
2018-12-15 17:38:34 +01:00
Jeroen88
1289f4be4b Add MD5 computation to Esp and add request header with MD5 hash of the running sketch to HTTPUpdate (#2176) 2018-12-11 02:06:58 +01:00
Andy Horner
70f000da71 Fix a compilation error if Bluetooth not enabled (#2172) 2018-12-10 10:11:37 +01:00
Jeroen88
884e417a49 Fix HTTPUpdate flash size check and add SPIFFS size check (#2161)
* Fix error in PR #2048: if ::available() is called before ::connect() _rxBuffer is not initialised

* Fixed flash size check and added SPIFFS size check

* Rewriting ESP.getFreeSketchSpace(), moving code from HTTPUpdate.cpp
2018-12-06 20:39:52 +01:00
Luc
ce340faf94 Clean warnings when all warning enabled (#2112)
* Clean warnings when all warning enabled

Not used variables / functions due to debug log

Dual define with different values :
cores\esp32/binary.h
#define B110 6
#define B1000000 64

tools/sdk/include/newlib/sys/termios.h
#define B110        3
#define B1000000   23

Local variable returned in WiFiclient Secure

* change due to deprecated function

* Update with proper variable and label

* Update esp32-hal-i2c.c

* Apply changes requested

* Fix warnings due to #define conflict thanks @atanisoft
2018-11-29 11:34:55 +01:00
me-no-dev
fcd734a13c Some fixes found by gcc 8 2018-11-28 00:35:43 +01:00
Jamie Parkinson
e609c78f20 Initialize detectedBaudRate to prevent compilation errors (#2101) 2018-11-26 23:22:37 +01:00
Bert Melis
44ca2ee976 Fix uart TX flushing (#2029)
wait for FSM to return idle
2018-11-19 17:04:05 +01:00
lbernstone
af79e18ecb Added ESP:: functions for sketch size (#2028)
* Added ESP:: functions for sketch size

* Fixed free space name to match ESP8266
2018-11-19 17:03:36 +01:00
Marcel Kottmann
259ff80d60 use libbase64 macro to calculate base64 length (#2007) 2018-11-19 17:01:38 +01:00
Jeroen88
233d31bed2 Added baudrate detection to esp32-hal-uart and HardwareSerial (#1961)
* Added baudrate detection to esp32-hal-uart and HardwareSerial

* Solved compiler warning for uartResizeRxBuffer()

* Add unit to header variable name (timeout_ms)

* Reverting accidentally changed files to master

* Add small delay after baudrate detection
2018-11-19 16:51:55 +01:00
Terry J Myers
1bc1e8c602 Update WString.cpp (#1936) 2018-11-19 16:45:09 +01:00
Terry J Myers
2132d9f809 Update WString.h (#1935) 2018-11-19 16:44:53 +01:00
Mark D
f12df4c719 allow component projects to compile with CONFIG_DISABLE_HAL_LOCKS (#1880) 2018-11-19 16:39:42 +01:00
chuck todd
e5ea089a7f Reduce resource requirements, Share Interrupt (#1877)
#1869 exposed a resource exhaustion issue. The current HAL layer for I2C support is designed to use a shared interrupt, But, during debugging to solve the interrupt overloading condition identified in #1588, and the generation of pr #1717, the interrupt allocation parameters were changed.  This change was unnecessary, the code will work successfully with shared interrupts.  So, there is no need to assign a private interrupt for each I2C peripheral.
2018-09-21 08:40:01 +02:00
Me No Dev
96822d783f
Update IDF to 3.2-3276a13 and esptool.py to 2.5.0 (#1878)
* TX Flow Control and Code cleanup

* Use semaphore instead of delay

TX functionality is done.

* Use single buffer and empty queue on exit

* Fix compile issues because of LwIP code relocation

* Add temporary header to fix Azure not compiling

* Fix AsyncUDP early init

* AsyncUDP Multicast fixes

* Add source mac address and rework multicast

* Allow redefinition of default pins for Serials 1 and 2

* Update IDF to 3276a13

* Update esptool.py to 2.5.0

* Fix sketches

* Fix log level in BluetoothSetial
2018-09-21 08:39:36 +02:00
david-cermak
4e96bffe0e Initial version of rmt driver (#1525)
* rmt driver initial version

* supporting conti mode plus interrupts

* using conitnous mode for sending more data

* working continous mode

* rmt driver cleanup after conti mode

* initial version of rmt driver

* adding a simple example

* adding channel and block locks

* modified of rmt interface for simpler/easier usage

* adding header sentinels, split interface to common and additional settings

* Fixes per code review + support for rx callback mode

* renamed internal structures and enums, fixed formatting

* cmake support for rmt

* refactored tx-conti interrupts to function to make it more readable

* added Tx and Rx examples

* added license headers

* minor updates per review

* used struct access, renamed defines, corrected diagram
2018-09-17 23:19:27 +02:00
hreintke
ea61563c69 Functional interrupt (#1728)
* Initial

* Implementation

* Add to CMakelist.txt

* Add example

* Add IRAM_ATTR
2018-09-17 23:13:58 +02:00
hreintke
5be3078b76 InterruptArg should take voidFuncPtrArg as argument (#1776) 2018-09-17 23:10:13 +02:00
Junxiao Shi
1e4bf14a3e cores: replace max, min, round macros with imports from std (#1783)
fixes #1734
2018-09-17 21:33:01 +02:00
Baruch Nissenbaum
a6a9a518a7 _uart_isr use wr_addr != rd_addr as test for internal queue not empty (#1849) 2018-09-17 21:19:51 +02:00
Adam Coddington
ce61074802 Add functionality allowing rxBuffer of HardwareSerial to be changed in size via HardwareSerial::setRxBufferSize. (#1855) 2018-09-17 21:16:18 +02:00
me-no-dev
80c110ece7 Add more methods to access memory properties 2018-08-18 17:10:35 +02:00
me-no-dev
65511b23d3 Add separate method to get free PSRAM and report only internal in getFreeHeap 2018-08-18 16:34:41 +02:00
chuck todd
9db207afbe Improve bus recovery (#1767)
If the esp32 is reset during a i2c read cycle the slave device may be in control of the SDA line.  

If the SDA line is held low, the esp32 cannot issue a START or STOP to recover the bus. 

The previous code did not correctly configure the SCL output pin, and it cycled SCL 9 times with SDA Low.  Since the slave device was in a READ cycle, it just continued outputting the bits of the current byte.  When the ACK/NAK bit space occurred, The low output value of SDA was interpreted as ACK so the slave device continued with the next byte.  It never terminated the READ cycle. 

This new code will correctly recover from an interrupted READ
2018-08-18 08:50:59 +02:00
chuck todd
b05430cfd9 Wire ReSTART fix, with others (#1717)
* ReSTART fix, Sequencing fix

pr #1665 introduce a problem with ReSTART, when solving this problem I found an interaction between the TxFifo refill, RxFifo empty and CMD[] fill.  during certain sequences a dataqueue command would be skipped, this skipping resulted in a mismatch between the contents of the TxFifo and the i2c command sequence.  The problem manifested as an ACK error. 
In addition to this required bug fix I propose:
* `Wire.begin()` be changed from a `void` to a `bool` this will allow the reset functionality of `Wire.begin()` to be reported.  Currently `Wire.begin()` attempts to reset the i2c Peripheral, but cannot report success/failure.
* `Wire.busy()` be added. this `bool` function returns the hardware status of the bus. This status can be use in multi-master environments for application level interleaving of commands, also in single master environment, it can be used to detect a 'hung' bus.  With the functional change to `Wire.begin()` this allows app level recover of a hung bus.
* `Wire.lastError()` value updated for all errors, previously when interleaving `Wire.endTransmission(false)` and `Wire.readTransmission(false)`, the 128 byte `Wire.write()` buffer was exhausted without generating and error(very exotic). I discovered this error when I created a sequence of directed reads to a EEPROM. Each directed read used 2 bytes of the 128 byte `write()` buffer, so after 64 consecutive ReSTART writes with ReSTART reads, `Wire()`  had no room to record the directed address bytes.  It generated just a NAK check without setting the EEPROMs internal register address.  The succeeding ReSTART read succeeded at incorrect address.
* Changes to the HAL layer:
** added `i2cGetStatus()` which returns the i2c peripheral status word, used to detect bus_busy currently
** added `i2cDebug()` programmatic control of debug buffer output
** changed `i2cAddQueue()` to allow data_only queue element this will allow a i2c transaction to use multiple data pointers.
** removed direct access to DumpInts(), DumpI2c() from app, use i2cDebug() to set trigger points 
 
*

* Update esp32-hal-i2c.c

* Update Wire.cpp

* ReSTART, Sequencing

pr #1665 introduce a problem with ReSTART, when solving this problem I found an interaction between the TxFifo refill, RxFifo empty and CMD[] fill.  during certain sequences a dataqueue command would be skipped, this skipping resulted in a mismatch between the contents of the TxFifo and the i2c command sequence.  The problem manifested as an ACK error. 
In addition to this required bug fix I propose:
* `Wire.begin()` be changed from a `void` to a `bool` this will allow the reset functionality of `Wire.begin()` to be reported.  Currently `Wire.begin()` attempts to reset the i2c Peripheral, but cannot report success/failure.
* `Wire.busy()` be added. this `bool` function returns the hardware status of the bus. This status can be use in multi-master environments for application level interleaving of commands, also in single master environment, it can be used to detect a 'hung' bus.  With the functional change to `Wire.begin()` this allows app level recover of a hung bus.
* `Wire.lastError()` value updated for all errors, previously when interleaving `Wire.endTransmission(false)` and `Wire.readTransmission(false)`, the 128 byte `Wire.write()` buffer was exhausted without generating and error(very exotic). I discovered this error when I created a sequence of directed reads to a EEPROM. Each directed read used 2 bytes of the 128 byte `write()` buffer, so after 64 consecutive ReSTART writes with ReSTART reads, `Wire()`  had no room to record the directed address bytes.  It generated just a NAK check without setting the EEPROMs internal register address.  The succeeding ReSTART read succeeded at incorrect address.
* Changes to the HAL layer:
** added `i2cGetStatus()` which returns the i2c peripheral status word, used to detect bus_busy currently
** added `i2cDebug()` programmatic control of debug buffer output
** changed `i2cAddQueue()` to allow data_only queue element this will allow a i2c transaction to use multiple data pointers.
** removed direct access to DumpInts(), DumpI2c() from app, use i2cDebug() to set trigger points 
 
*

* Forgot DebugFlags Return

@andriyadi found this, total brain fade on my part.
2018-08-14 11:51:15 +02:00
me-no-dev
f9a382ab9f fix some compilation error and warnings in i2c 2018-07-24 22:06:50 +02:00
chuck todd
8d7fb58672 Fix for spurious interrupts during I2C communications (#1665)
This version no longer needs an interrupt for each byte transferred. It only needs interrupts for START, STOP, FIFO empty/Full or error conditions.  This dramatically reduces the interrupt overhead.  I think the prior version was causing an interrupt overload condition where the ISR was not able to process every interrupt as they happened.
2018-07-24 19:43:45 +02:00
chuck todd
28a410dd50 Spurious Interrupts Temporary fix 20180711 (#1625)
the 'eject' ERROR is and indication of an interrupt triggering without an source.  I am working to eliminate these serviceable interrupt.  This update increase stability on a HelTek Wifi Lora 32 board. with a SSD1306 OLED.  This update fixes a glaring error in the interrupt allocation code, the Interrupt mask was wrong.  I also dynamically adjust the FiFo thresholds based on Bus clockrate. The change to FiFo thresholds has reduced the number for 'eject' events.  I also change 'eject' from and ERROR to DEBUG.  An 'eject' event does not compromise i2c transmissions. It happens after a transaction has completed. 

Chuck.
2018-07-12 15:18:26 +02:00
Bert Melis
c77aed4ac4 Allow using argument with attachInterrupt (#1535)
* Allow using argument with attachInterrupt

* formatting

replace tabs with spaces

* fix bug more then 1 interrupt

* leftover

* add example

* make attachInterruptArg public

* update example

* leftover
2018-07-07 11:26:58 +02:00
me-no-dev
5e46c9bae6 Add Wrover Support and Option to enable SPIRAM 2018-07-03 23:03:50 +02:00
me-no-dev
4e5cbdaa7f Add declarations for all Serial, SPI and Wire buses 2018-07-03 20:41:03 +02:00
chemicstry
12ca9e8b52 Port UART reset fix from ESP-IDF (#1408) 2018-07-03 17:54:08 +02:00
chuck todd
6411ac4e3c Remove confusing Debug output. (#1574)
If Core Debug Level is at DEBUG, a confusing debug message will be emitted if the I2C transaction takes longer complete than the  calculated minimum time.  This original debug message was just to prove that this new i2c code could correctly handle SCL stretching or interrupt latency issues. This delay is not a problem, or an error.  Usually it is caused by a higher priory interrupt starving the i2c ISR.  Usually WiFi is the culprit.  As long of this delay is within the configured timeout (by default 50ms, or can be set with Wire.setTimeOut(milliseconds);) no problem will occur and the transaction will successfully complete.
Chuck.
2018-07-02 18:22:05 +02:00
Me No Dev
184bb069f2
Fix io16 io17 and PSRAM support (#1564)
* Add PSRAM init and malloc funtions

* Rebuild IDF libs
2018-06-30 23:06:50 +02:00
Me No Dev
a59eafbc9d
Update IDF to aaf1239 (#1539)
* fix sdmmc config

* Fix warnings in EEPROM

from @Curclamas

* remove leftover TAG in EEPROM

* Initial add of @stickbreaker i2c

* Add log_n

* fix warnings when log is off

* i2c code clean up and reorganization

* add flags to interrupt allocator

* fix sdmmc config

* Fix warnings in EEPROM

from @Curclamas

* remove leftover TAG in EEPROM

* fix errors with latest IDF

* fix debug optimization (#1365)

incorrect optimization for debugging tick markers.

* Fix some missing BT header

* Change BTSerial log calls

* Update BLE lib

* Arduino-ESP32 release management scripted (#1515)

* Calculate an absolute path for a custom partitions table (#1452)

* * Arduino-ESP32 release management scripted
(ready-to-merge)

* * secure env for espressif/arduino-esp32

* * build tests enabled
* gitter webhook enabled

* * gitter room link fixed
* better comment

* * filepaths fixed

* BT Serial adjustments

* * don't run sketch builds & tests for tagged builds

* Return false from WiFi.hostByName() if hostname is not resolved

* Free BT Memory when BT is not used

* WIFI_MODE_NULL is not supported anymore

* Select some key examples to build with PlatformIO to save some time

* Update BLE lib

* Fixed BLE lib

* Major WiFi overhaul

- auto reconnect on connection loss now works
- moved to event groups
- some code clean up and procedure optimizations
- new methods to get a more elaborate system ststus

* Add cmake tests to travis

* Add initial AsyncUDP

* Add NetBIOS lib and fix CMake includes

* Add Initial WebServer

* Fix WebServer and examples

* travis not quiting on build fail

* Try different travis build

* Update IDF to aaf1239

* Fix WPS Example

* fix script permission and add some fail tests to sketch builder

* Add missing space in WiFiClient::write(Stream &stream)
2018-06-27 09:01:06 +02:00
lbernstone
33392af315 Missing include gpio.h in esp32-hal-dac.h (#1512) 2018-06-19 11:33:17 +03:00
Ivan Grokhotkov
93c45af256 Use esp_timer_get_time as time source for micros and mills (#1424)
esp_timer_get_time returns monotonic time in microseconds, as a 64-bit
number. It can be called from tasks and interrupts, does not use any
critical sections/mutexes, and is thread safe.
2018-05-22 16:12:30 +02:00
mmone
dd639c4a02 Fix wrong range of duty cycle (#1353)
The esp-idf expects duty values for the the sigma delta modulator in the range of -128 to 127
The arduino framework is supposed to use the range 0-255 thus the offset caclulation was wrong.
2018-05-14 13:18:03 +02:00
Tim P
6bf7619ccc std::functioanl for WFIF event + Minor fix (#1366)
* add missing bits from esp8266 to help porting other libs

* Clean Up of Wifi event

* Exampl of Wifi Events
2018-05-14 13:05:49 +02:00
Craig Leres
c92b617397 Convert the few remaining cr/lf files to use lf for eol. (#1316)
If you develop on windows and need cr/lf files, see this:

    https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace

    Git can handle this by auto-converting CRLF line endings into LF
    when you add a file to the index, and vice versa when it checks out
    code onto your filesystem. You can turn on this functionality with
    the core.autocrlf setting. If you're on a Windows machine, set it
    to true - this converts LF endings into CRLF when you check out code:

    $ git config --global core.autocrlf true
2018-04-16 16:34:39 +02:00
chuck todd
1cf42702dd Add Hardware Reset when Initing I2C peripheral (#1201)
This change uses the `_RST` bit of the i2c peripheral to force the hardware into power on reset state.  The prior code assumed the peripheral was already in a reset, it just cleared the reset bit.  

Chuck.
2018-04-06 19:13:59 +03:00
mtabu
aa1288aa6e HardwareSerial - availableForWrite() support (#1226)
* HardwareSerial - availableForWrite() support

* fix indentation errors (tab vs space)
2018-04-06 19:07:46 +03:00
George Talusan
149190fe11 fix Arduino component build when CONFIG_ARDUHAL_ESP_LOG is turned off (#1228) 2018-04-06 19:06:53 +03:00
KEDARUMA FANTASTIC
c01e5563c8 serial global instance fix (#1243) 2018-04-06 19:02:59 +03:00
me-no-dev
835268c326 fix thread storage 2018-03-04 21:23:18 +01:00
chuck todd
7141e3e29d micros() returning inconsistend values when call from different tasks (#1165)
The cycle count that micros() is using to report timing is a PER Task value.  When micros() or delayMicroseconds() is called from different Tasks, the lastCycleCount value may have no relationship to the current Task specific cycleCount. If the current cycleCount is less than the saved lastCycleCount a rollover condition is assumed. This erroneous conditions results in incorrect delays and reported microseconds.  This fix creates thread local storage so that each Task will have accurate microsecond reporting and delays.  The reported microseconds are not real time, they are microseconds of the current Task execution.
2018-03-04 21:17:34 +01:00
Bernardo Ramos
0f9595e31e Fixes SPI mode setting (Issue #1094) (#1096)
Fixes #1094
2018-03-04 20:56:33 +01:00
Tom Ferrin
da46d0b264 FIX: getEfuseMac can return random data (#1059)
esp_efuse_mac_get_default() only stores into the bottom 6 bytes of it's 8-byte argument, so must initialize this arg to zero to avoid trash on the stack.
2018-03-04 20:35:14 +01:00
Kristian Sloth Lauszus
78acedd2cf Workaround strict-aliasing warnings and added missing pgm_read_ptr define (#996)
See: https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/328511332 and 8a02ea67f5 (diff-6e1ff9551639ac89d99617863bf84e10)
2018-01-18 01:02:20 +02:00
Me No Dev
600f4c4130
Update IDF to 1c3dd23
* Update mDNS and LEDC

* update toolchain

* Update IDF to 1c3dd23

* Advertise the board variant for Arduino OTA

* Add generic variant definition for mDNS
2018-01-18 00:56:58 +02:00
张雷
80a7d6084b fix enable ADC on pin37,38 (#822) 2017-11-10 13:27:00 +02:00
copercini
3dc30dce81 Add compatibility macros with esp8266 (#783) 2017-10-30 10:27:26 +01:00
Me No Dev
55289a45af Update IDF to 9274814 (#767)
* Update IDF to 9274814

* Fix error in i2c and Arduino
2017-10-24 00:21:00 +02:00
Jason K
11565343e6 Merge branch 'master' into master 2017-10-23 14:40:33 -04:00
chuck todd
a695187de8 Correct 10bit Device address handling.
The existing code did not follow protocol with 10bit addressed devices.  Per _Philps/NXP Semiconductors UM10204 I2C-bus specification and user manual Rev. 6 4April2014_ pg.15 3.1.11 10-bit addressing:
~The first seven bits of the first byte are the combination of 1111 0xx of which the last two bits (xx) are the two Most-Significant Bits (MSB) of the 10-bit address; the eighth bit of the first byte is the R/!W! bit the determines the direction of the message~
2017-10-21 13:14:14 -06:00
Jason K
1270f40066 Add initial handling for long I2C reads. 2017-10-21 08:26:46 -04:00
chuck todd
7eff707ba6 Fix Early return when Address NAK is received (#750)
The i2cWrite() function was returning to the app before the i2c transaction had completed.  This caused the next Wire() call to return a I2C_ERROR_BUSY.
2017-10-21 08:40:53 +02:00
me-no-dev
409c75da04 Implement ESP_LOGx override option
Usable for library developers who write code not dependent on Arduino.
Adding 3 lines to the includes will permit their debug messages to be
visible in Arduino IDE or when enabled under IDF
2017-10-14 00:06:55 +03:00
Ewald Wasscher
e6a5b68e40 Added argument to HardwareSerial.begin to specify whether the logic levels of the UART rx and tx lines should be inverted (#719) 2017-10-13 11:46:56 +03:00
me-no-dev
0fa25c09ef Fix possible leak in String
Fixes: https://github.com/espressif/arduino-esp32/issues/710
2017-10-12 06:52:35 +03:00
chuck todd
2f0cfa92cd Update pgmspace.h (#707)
Fix redefines of strXXX, original was using strnXXX with length set to 0x7fffffff.  This caused problems with strcpy and strcat. The destination buffer was NULL'd to 0x7fffffff which killed the app.
2017-10-09 06:38:42 +03:00
Testato
8dc0c86457 Chip revision fix (#704)
* Chip revision fix

https://www.esp32.com/viewtopic.php?f=2&t=1358&sid=f77cd62ec254317f3bbb30d8ab75ca2a&start=10

* using of esp_chip_info instead of register reading
2017-10-08 14:48:50 +03:00
copercini
171032b701 Print an error when serial number is invalid (#691)
* Print error when serial number is invalid

* Move to the first check, change end by return
2017-10-04 11:12:21 +08:00
Luc
d208a36836 Use correct sign of offset for TZ variable (#685)
Use UTC instead of CDT for consistency
2017-10-01 10:19:00 +08:00
me-no-dev
28be506ce3 uncomment I2C debug so it can be used 2017-09-29 21:24:06 +08:00
Jason K
0cd62852da I2c reset functionality (#678)
* Addition of a i2cReset method and timeout handling for the case where the i2c hardware FSM (state machine) gets stuck in a busy state.

* Use newly added i2cReset function within the wire library.
2017-09-29 21:17:13 +08:00
me-no-dev
af35773d65 OK Really change timer allocator 2017-09-28 18:38:07 +08:00
me-no-dev
17ece1bccd Revert Timer Interrupt setup 2017-09-28 18:22:35 +08:00
me-no-dev
6d98555658 Change timer interrupt allocator 2017-09-28 16:45:08 +08:00
me-no-dev
f9b2d42a61 Change Touch interrupt allocator 2017-09-28 16:44:47 +08:00
me-no-dev
7991161f06 Change Pin Interrupt Allocator 2017-09-28 12:27:10 +08:00
me-no-dev
db77195404 Fix Serial 2017-09-27 13:50:05 +08:00
me-no-dev
d27d297195 Update IDF to c4e65d6 2017-09-22 17:28:54 +08:00
me-no-dev
e2bd93c092 Fix UART0 not able to read/available 2017-09-22 14:17:25 +08:00
me-no-dev
c66a020e80 Add guards to not compile BT code if not enabled 2017-09-21 19:08:18 +08:00
Luc
4092fc409e Add baudRate function (#651)
usefull for ESP8266 compatibility
2017-09-21 17:00:12 +08:00
me-no-dev
db79c2ee95 Add api to get CPU temperature
Fixes: https://github.com/espressif/arduino-esp32/issues/563
Fixes: https://github.com/espressif/arduino-esp32/issues/625
Source:
https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchb
ook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino
2017-09-18 17:47:06 +08:00
me-no-dev
ab0ea2f6da Fix missing method from SPI HAL
Fixes: https://github.com/espressif/arduino-esp32/issues/640
2017-09-18 12:14:41 +08:00
me-no-dev
9fc3f1ebdd Fix wrong SPI peripheral enabled
Related: https://github.com/espressif/arduino-esp32/issues/634
2017-09-13 17:21:34 +03:00
me-no-dev
39fb8c3044 Fix header deprecation 2017-09-12 09:42:14 +03:00
me-no-dev
59a6800cdf Enable clocks for UART1 and 2
Recent change in IDF disables those clocks at boot. This change should
help with that.

Fixes: https://github.com/espressif/esp-idf/issues/975
2017-09-10 20:24:41 +03:00
Mark D
234c855c9b add configTzTime() to setup sntp using TZ environment variable (#608) 2017-09-05 11:15:55 +03:00
me-no-dev
6707d4d331 Optimize timer drift
Fixes: https://github.com/espressif/arduino-esp32/issues/227
2017-08-26 00:01:02 +03:00
me-no-dev
77b03472c6 Set uart queue to NULL after free
Fixes: https://github.com/espressif/arduino-esp32/issues/435
2017-08-17 19:04:20 +03:00
Pranav Cherukupalli
41e36a72f3 uartEnd: Unlock mutex before detaching rx and tx (#554)
* uartEnd: Unlock mutex before detaching rx and tx

This should solve the device freezing issue when Serial.end() is called

* Unlock UART MUTEX only for detaching Rx and Tx

* Thanks to @me-no-dev for pointing it out that
   uart->dev->conf0.val can be inside mutex lock
2017-08-04 12:00:51 +03:00
me-no-dev
a1bef8b5c3 improve Serial repeated begin/baud change 2017-08-02 00:32:42 +03:00
me-no-dev
4495659ac5 Increase the memory for loop task 2017-08-02 00:08:56 +03:00
Claude Heintz
23acb4d17b Two Stop Bit Workaround (#461)
* Update esp32-hal-uart.c

* Two Stop Bit Workaround

see https://github.com/espressif/esp-idf/blob/master/components/driver/uart.c  lines 118-127
2017-06-22 19:40:31 +02:00
me-no-dev
c2f83f48e0 Revert "Fix enable Update partition"
This reverts commit 63e1daa5ea67ce0f9b89b789e4bb26672f64d32e.
2017-06-03 20:11:41 +03:00
me-no-dev
2e5743eaa1 Fix enable Update partition 2017-06-03 20:11:41 +03:00
me-no-dev
7db8f70956 change return type of micros() and millis()
Fixes: https://github.com/espressif/arduino-esp32/issues/384
2017-05-22 15:47:12 +03:00
me-no-dev
d36e9bbfa9 Change deprecated esp_efuse_read_mac method 2017-05-15 21:35:25 +03:00
me-no-dev
4b47402afd Use static buffer for log_printf 2017-05-15 20:53:45 +03:00
me-no-dev
befebb7242 Change DPORT access macros 2017-05-15 20:53:09 +03:00
me-no-dev
450df7e3f8 fix libb64
Implements: https://github.com/esp8266/Arduino/pull/2883
Fixes: https://github.com/espressif/arduino-esp32/issues/313
Fixes: https://github.com/espressif/arduino-esp32/issues/344
2017-05-06 18:56:25 +03:00
me-no-dev
673f453da0 BT define the hal methods even if BT is disabled (but return false) 2017-05-06 18:50:20 +03:00
me-no-dev
768e57f285 Fix BT enabled check 2017-05-06 18:40:23 +03:00
me-no-dev
b879f80017 Allow Arduino to be run without BT support in IDF
Fixes: https://github.com/espressif/arduino-esp32/issues/343
2017-05-06 18:27:03 +03:00
WEMOS Electronics
a38ffe58fe Add ESP.getChipId() function to get ESP32's ChipID. (#322)
* Add ESP.getChipId() function to get ESP32's ChipID.

* change getChipId() to getEfuseMac()
2017-05-05 09:59:54 +03:00
Severin Smith
cc73f17add SPI_MODE2 and SPI_MODE3 configurations inverted (#345)
It appears that the configurations for `ck_out_edge` were inverted for `SPI_MODE2` and `SPI_MODE3`. You can check the technical reference manual on page 76, table 23 "Clock Polarity and Phase, and Corresponding SPI Register Values for SPI Master".

I've check with my oscilloscope that the current configuration is wrong and this fix corrects the issue.
2017-05-05 09:59:18 +03:00