Commit Graph

354 Commits

Author SHA1 Message Date
martirius
b8dab5ed1a
Added possibility to use ESP32-IDF log insted of redefined one (#4845)
With this PR user can select to use the original ESP-IDF log instead of the redefined one.

User can also redefine the log function as per [Logging Library](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/log.html#_CPPv419esp_log_set_vprintf14vprintf_like_t) so he can for example redirect logs to a file.

To enable this change just add -DUSE_ESP32_LOG to build flags.
User can also change the default TAG (that now is ES32) to whatever it wants adding '-DTAG="tag_value"' to build flags
2021-02-23 00:18:15 +02:00
me-no-dev
4b3f5c8ed4 Update licenses 2021-02-18 12:14:35 +02:00
estshorter
55442a05a4
Remove an unused variable 'channel' (#4725) 2021-01-21 14:31:25 +02:00
drmpf
15db297130
availableForWrite (#4664)
added availableForWrite to Print.h to make compatible with Arduino Print.h
2021-01-11 11:43:10 +02:00
kabir-plod
a0ef17a9dd
Use non-deprecated DPORT values in SPI HAL (#4682) 2021-01-11 11:40:18 +02:00
Nikhil Choudhary
be77bd4e27
Resolve crash with timer interrupt functions called from ISR (#4684) 2021-01-11 11:39:39 +02:00
coylen
7d5bf9e385
[1.0.5] Make looptask stack size configurable (#4564)
Added guarded define to set the stacksize on the main looptask.
Advantage of this is that build_flags can be used to provide a different value for the stack size should it be neccessary
default behaviour is unaffected
2020-12-02 11:52:04 +02:00
Pavel Melnikov
534f0810a6
fix bitWrite macro (#4507)
Fixes https://github.com/espressif/arduino-esp32/issues/4466
2020-11-09 17:08:13 +02:00
M Hotchin
28a8073069
Fix issue 4095 (#4503)
pgmspace.h missing 'pgm_get_far_address'
2020-11-08 04:55:59 +02:00
Mark D
56a7ae8712
Trailing spaces (#3738)
* fix typo in WiFiMulti

* clean up trailing spaces

* clean up script file used in cleaning

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-11-02 22:11:26 +02:00
sasaki takeru
3491ca7845
Add virtual beginMulticast(...) stub to UDP class (#4061)
https://github.com/arduino/ArduinoCore-sam/pull/6/files

It is used here:
https://github.com/arduino-libraries/ArduinoMDNS/blob/master/MDNS.cpp#L150
2020-11-02 20:26:50 +02:00
Alexandre Trevizoli
25bd585c25
Corrections of Stream.Find, FindUntil and added FindMulti - like AVR-Core Libraries (#3442)
* Corrections of Find, FindUntil and FindMulti

Find has some bug that is not working with Ethernet.find() so, I copied code from Stream.h and Stream.cpp in AVR-CORE library and now it's working perfectly.
I don't know where was the error, but an Ethernet.find compiled to MEGA2560 was working but not working when compiled to esp32, after corrections of code (copy of AVR-Core libraries) it's working perfect.
So probably has some error on original ESP32-Core library.

Below is part of code that was working with MEGA2560 and not with ESP32 libraries.
client.find never return TRUE with ESP32 original library and with AVR it's works.

boolean esp32_fw_update(EthernetClient &client, DecodedHeader &header, const String &field_filename, const String &field_crc) {

  char bound[header.boundary.length()+3];
  char term[]="\r\n";
  
  strcpy(bound,header.boundary.c_str());
  strcat(bound,term);
  while (client.find(bound)) { 
    String line=client.readStringUntil('\r');

* Update Stream.h

* Update Stream.cpp

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-10-14 15:20:40 +03:00
Dirk-Willem van Gulik
d79a1f3d10
Add an aditional (void *) arg to the RMT callback (much like Ticker() et.al.). (#3345)
* Add an aditional (void *) arg to the RMT callback - to allow more flexible handling of the callback (e.g. by passing a private struct or a class pointer). Same pattern as used by the Ticker() and many others. Example updated & new example with a trapoline added.

* Fix example for new API

* Fix lint warnings

* Add a second missed example.

* Correct timeout & improve socket error handling.
2020-10-14 14:41:50 +03:00
lienbacher
2243081f85
add I2C_RX_FIFO_OVF_INT_ST handling to i2c_isr_handler_default (#4342)
Fixes crash on ESP32 when I2C FiFo overflows and interrupt function is unable to handle crash and throws this error:
[E][esp32-hal-i2c.c:1013] i2c_isr_handler_default(): unknown int=4

Co-authored-by: 0xDEADBEEF <0xde4dbeef@gmail.com>
2020-10-01 15:40:42 +03:00
lbernstone
a9cb7c6d6f
mismatched parameter names. Fixes #4310 (#4313) 2020-10-01 15:35:40 +03:00
Bert Melis
f98fc7ee9f
fix hwSerial tx only flush (#4263) 2020-10-01 15:30:45 +03:00
brian-r-calder
8fcc914853
Added facility to invert the polarity of input UART bits. (#4200) 2020-10-01 13:58:48 +03:00
TANAKA Masayuki
a55265f74b
Fix clockCyclesPerMicrosecond Change from fixed value to current value (#3993) 2020-09-30 15:16:20 +03:00
robertpoll
c18d50cb91
Use esp_partition_* functions in Updater.cpp (#3898)
Background

The current implementation of Update() uses the spi_flash_* api to write and read from flash. These functions ignore the partition->encrypted flag and always write raw data to flash even if the partition is marked as encrypted.

Changes in this PR

Update() now uses the esp_partition_* api.
Wrapper functions for esp_partition_* added to ESP.cpp. This was done to maintain a consistent approach to the way the spi_flash_* functions were used. I note though that not all of the esp-idf functions are used are wrapped, for example esp_ota_get_next_update_partition() so it may be that these should not be added?
The current implementation of Update() changes the first (magic) byte of firmware to 0xFF on write, and then when the firmware is completely written changes it back to ESP_IMAGE_HEADER_MAGIC. This works without erasing the sector because flash bits can be changed from 1->0 (but not 0->1). If the flash is encrypted then the actual data written to flash will not be all ones, so this approach will not work. In addition, encrypted flash must be written in 16 byte blocks. So, instead of changing the first byte the changed code stashes the first 16 bytes, and starts writing at the 17th byte, leaving the first 16 bytes as 0xFF. Then, in _enablePartition() the stashed bytes can be successfully written.
Benefits

Whilst it's not possible to use encrypted flash directly from either the Arduino IDE or PIO it's reasonably straightforward to compile and flash a bootloader with the necessary support from a simple esp-idf project and then use ArduinoOTA for subsequent updates. This PR enables the use of this workflow until such time as encrypted flash is supported, and is a first (small) step toward adding support.
Regardless of the above, the esp_partition_* api is recommended over the api_flash_* api.
Application code should mostly use these esp_partition_* API functions instead of lower level spi_flash_* API functions. Partition table API functions do bounds checking and calculate correct offsets in flash, based on data stored in a partition table.
2020-09-30 15:06:19 +03:00
lbernstone
80418fadcf
Fixes UART detach. Fixes #3878 (#3894)
* Fixes UART detach.  Fixes #3878

* 0 is not a good holder value for pins!

* 0 is not a good holder value for pins!
2020-09-30 15:04:18 +03:00
Martijn Scheepers
7e9d42da68
ESP.getChipModel() and ESP.getChipCores() (#3847)
* ESP.getChipModel() returns model of the chip

* ESP.getChipCores() returns the core count.

* Example gives chip model, revision and core count.

* Read efuse for chipmodel

Co-authored-by: Martijn Scheepers <ms@SDNengineering.nl>
2020-09-30 14:57:36 +03:00
Admar Schoonen
e34e0b45de
Fixed bug where mutex would not be unlocked (#3837)
Fixed bug where uartResizeRxBuffer() did not unlock mutex if creation of queue failed.
2020-09-30 14:56:41 +03:00
Dirk O. Kaar
4204869ec9
Extend Print class for 64bit integers. (#3688)
* Extend Print class for 64bit integers.

modulo 32bit and 64bit tuned for code size.

* Fix 32bit long used in long long printNumber.
2020-09-30 14:31:36 +03:00
Dirk O. Kaar
ab23e8a656
Greatly reduces error rate (half, or 0 zero errors, depends on in/out ranges) for round-trip mapping at the same performance. (#3655)
(Based on "improved_map" from ESP8266's Servo.cpp)
2020-09-30 14:28:51 +03:00
hreintke
49b76649f1
HardwareSerial bugfix & improvement (#3713)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-05-05 17:55:58 +03:00
hreintke
ed220bd042 Minimize HardwareSerial Receive and Transmit delays (#3664)
* Minimize HardwareSerial Receive and Transmit delays

* Remove uartRxFifoToQueue from esp-hal-uart.h

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
2020-01-27 00:38:06 +02:00
chuck todd
80f9f9aeec fix removeApbChangeCallback() error in spiStopBus() (#3675)
* fix removeApbChangeCallback() error in spiStopBus()

spiStartBus() was using spiStopBus() to init the hardware, one of spiStopBus() functions is to unregister the runtime CPU clock speed change callback. But, spiStartBus() only wanted to init the hardware.  This patch separates the hardware init into a standalone function spiInitBus() that both spiStartBus() and spiStopBus() call.

* Update esp32-hal-spi.c

capitalization problem
2020-01-27 00:20:19 +02:00
Me No Dev
32d5654aa6
Implement rmtLoop to be able to continuously send pulses (#3650)
Number of pulses is limited to the reserved RMT memory for the channel. Very useful for PWM, Servo and other repeatable signals.
2020-01-20 19:43:13 +02:00
Dirk O. Kaar
0607d36734 HardwareSerial::write(const char*, ...) API compatibility to AVR, ESP8266, et al (#3585)
* API compatibility to AVR, ESP8266, et al

* Add non-blocking HardwareSerial::read(buffer, size) extension (ESP8266 portability)

* Refactor for fewer indirect calls.
2020-01-20 15:54:50 +02:00
Collin Kidder
7b3c1dfd50 Fix inability to use all buffers in RMT (#3512)
With the >= used let's say you have four RMT inputs, each using 2 channels wide for their receive buffer. This is 4*2 = 8 buffers which is the number of hardware buffers (MAX_CHANNELS). But, for the fourth input the starting buffer will be 6 (this is correct, the buffers used for each input are 0-1, 2-3, 4-5, 6-7). But, 6+2 = 8 which  is MAX_CHANNELS. This is valid but the >= would match against it and abort. It is correct to only abort if the value i+j is only greater than MAX_CHANNELS. Thus, a simple one character fix. Delete the equals sign.
2020-01-20 15:31:44 +02:00
Clemens Kirchgatterer
36075257c2 WString explicit converters to reduce Flash size (#3497)
* WString explicit converters to reduce Flash size

This is a port from the same patch for ESP8266: https://github.com/esp8266/Arduino/pull/6759/files
2020-01-20 15:29:16 +02:00
Me No Dev
d8b2098461
Use IDF's ADC Driver and Add analogReadMilliVolts (#3377) 2020-01-20 15:18:56 +02:00
TreeNewbeer
3fc974f3aa bugfix(touchpad):swap touch8 and touch9 #3584 (#3620) 2020-01-09 08:11:40 +02:00
chuck todd
9ad860758c Fix Memory leak in addApbChangeCallback() (#3560)
* `ledcWriteTone()` added a `apbcallback()` evertime the tone value was non zero.  
* `addApbChangeCallback()` did not detect duplicate callbacks.
* changed the apbcallback list to a double link to support roll forward, roll back execution.  This made the sequences of clock change callback start with the newest registered -> to oldest on the `before` then oldest -> newest after the clock change.  This made the UART debug log output have minimal gibberish during the clock change.
* change how the UART callback handled the MUTEX because if any `apbchangeCallback()` executed a `log_x()` a deadlock would occur.

This fixes #3555
2019-12-30 21:35:29 +02:00
rgot-org
cec3fca4ad Fix BluetoothSerial crash when restart (#3471)
* Update esp32-hal-bt.c

BluetoothSerial crash when restart:  this is because the BT controller remains in state  ESP_BT_CONTROLLER_STATUS_INITED instead of state  ESP_BT_CONTROLLER_STATUS_IDLE after the end() method.
in file esp_bt.h it is specified

> @brief Enable BT controller.
>                Due to a known issue, you cannot call esp_bt_controller_enable() a second time
>                 to change the controller mode dynamically. To change controller mode, call
>                esp_bt_controller_disable() and then call esp_bt_controller_enable() with the new mode.

after **esp_bt_controller_disable()** the controller remains in state INITED so we do call the **esp_bt_controller_deinit()** function to put the controller into state IDLE.

i have modified the **esp32-hal-bt.c** file
line 57 and next
(i have insert the esp_bt_controller_deinit() function so the controller go into Idle state)
```c++
bool btStop(){
    if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE){
		log_i("bt stopped");
        return true;
    }
    if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED){
		log_i("bt enabled");
        if (esp_bt_controller_disable()) {
            log_e("BT Disable failed");
            return false;
        }
        while(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED);
    }
    if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_INITED){
		log_i("inited");
		if (esp_bt_controller_deinit()) {
			log_e("BT deint failed");
			return false;
		}
		while (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_INITED);
        return true;
    }
    log_e("BT Stop failed");
    return false;
}
```

* Update esp32-hal-bt.c

remove while to avoid infinite loop
2019-11-11 18:31:09 +01:00
David J. Fiddes
dac493fb92 SPI: Fix discarded-qalifiers warning when compiling with all warnings (#3458)
* SPI: Fix discarded-qalifiers warning when compiling with all warnings

This fixes an error introduced with changeset b847f41 which
tightened the use of const for read-only data. The helper
funtion __transferBytes also requires the const qualifier on
outgoing data. Without this change a warning is displayed
when compiling with the Arduino IDE set to display "All"
compiler warnings.

Tests:
 - Build an ESP32 SPI sketch that uses static const data to send
   to an SPI device using the SPI.transferBytes() API

* SPI:Ensure all local functions are marked static

This audits all functions in the esp32-hal-xpi.c module and
ensures that any functions entirely local to the module are
marked as static.

Tests:
 - Build with Arduino set to show all warnings and ensure none
   are displayed

* SPI: Remove unused local __spiTranslate24 function

This removes the __spiTranslate24() function which is unused.
2019-11-11 17:44:49 +01:00
lbernstone
f41beb92bf Fixed so configTime will not crash if tcpip is not initialized (#3470) 2019-11-11 15:50:56 +01:00
chuck todd
7d2632c024 Implement Tx only Flush (#3433)
* add option to Flush() to only clear txQueue

Add the option to cause Flush() to just wait for tx data to clear the tx fifo and uart, leave the rx queue and rx fifo as is.

* support tx only flush()

* support tx only Flush()

* support txOnly for Flush()

* compatibility to Stream()

* compatibility for Stream()

* default value error

* default value error

* Update esp32-hal-uart.h

* Update esp32-hal-uart.c

* Update HardwareSerial.cpp

* sp

* correctly implement flushTxOnly()
2019-11-11 15:37:35 +01:00
David J. Fiddes
b847f41e24 SPI: Ensure all read-only data pointers are marked as const (#3356)
This changes all SPI functions that take data pointers which are
not modified so that the declaration is const. This allows them
to be used with const data (i.e. held in flash). No functional
changes are required.

The defnitions of spiWrite() and spiTransferBytes()  in
esp-hal-spi.h/c have been updated to be consistent.

Tests:
 - Build a simple sketch using SPI.writePattern() and
   SPI.transferBytes()  which uses const data and verify that the
   attached device functions as expected.
2019-10-14 20:39:27 +03:00
Dirk O. Kaar
c2b3f2d6af Make yield() overridable (#2991) 2019-10-04 12:49:39 +03:00
Dirk Mueller
6f70e27011 Base64::encode : const correctness / String by reference passing (#3314)
Avoid passing String by-value, which is slightly less efficient
as it involves a full copy-constructor/tempstring creation.
2019-10-02 14:29:24 +03:00
me-no-dev
f32083a6d0 Fix timerRestart
Closes: https://github.com/espressif/arduino-esp32/issues/2944

Thanks @atanisoft
2019-09-24 19:25:27 +03:00
Dirk O. Kaar
7fe2812f7f Inline ESP::getCycleCount() to make it safe to call from ISRs (#3165)
* Inline ESP::getCycleCount() to make it safe to call from ISRs

* Attribute IRAM_ATTR ISR-safe function in addition to inlining.
2019-09-11 14:29:53 +03:00
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