Commit Graph

243 Commits

Author SHA1 Message Date
Javier Peletier ca92cfd362 fix number2integer conversion for floating-point builds (#2605) 2019-01-15 17:06:11 +01:00
devsaurus f338d31f05 remove unused variable 2018-12-02 21:13:04 +01:00
Arnim Läuger ab32ad2a67
Port i2s, spi_master, and ledc to helper functions for option tables (#2577)
* opt_checkint_range: extend range check to default value

* opt_checklstring added

* i2s: rework luaM_ and option table handling

* spi_master: rework option tables handling

* ledc: rework option tables handling
2018-12-02 16:20:45 +01:00
Skirmantas Lauzikas 3257e557d4 ESP32: add support for RS485 (#2559)
* ESP32: add support for RS485

This commit adds support for switching UART mode to RS485/IRDA.
Also included are patches for memory leaks then handling UART events other than data.

* ESP32: Documentation for uart.setmode()
2018-11-30 12:07:05 +01:00
Skirmantas Lauzikas 794a07bb51 ESP32: Add time module (#2561)
* ESP32: Add time modules

New time module for manipulating system time/ calendar and controlling SNTP server

* ESP32: Time module documentation & style fixes
* added documentation for time modules
* style fixes as pointed out by @devsaurus

* ESP32: Time module small fixes
* Couple small fixes
2018-11-26 21:03:23 +01:00
Arnim Läuger 9bd8df4693 Use custom parition table with 1.5MB for firmware (#2567) 2018-11-23 20:16:36 +01:00
Skirmantas Lauzikas 423c733db8 ESP32: Add SJSON module (#2562)
* Esp32: Add SJSON module

This adds SJSON module taken directly from master

* ESP32: Fixes for sjson lib
Fixed compilation not including config header, thus braking some of libs functionality

* ESP32: Upgraded SJSON to master
2018-11-22 20:58:27 +01:00
tomsci 72d28fa86e Adding qrcodegen module for generating QR Codes (#2543)
* Adding qrcodegen module for generating QR Codes

* Added LUA_MODULE_QRCODEGEN KConfig

* Changed qrcodegen.encodeText() to use an options table

Created common.h with new option table helper fns.

* Reworked http.c to use new common.h options table APIs
2018-11-15 22:17:43 +01:00
tomsci 1cb1aff4cd ESP32: Add Sodium module (#2550)
* Add Sodium module

* Split sodium API into subtables; updated docs

* Fixed refactored names of crypto_box fns
2018-11-15 18:04:00 +01:00
tomsci d2345f2beb esp32: Add node.uptime() function using esp_timer_get_time() (#2533)
* esp32: Reinstate tmr.now() function using esp_timer_get_time()

Also added larger limit before wrapping if Lua's number type supports
it.

* Renamed tmr.now() to node.uptime()

Added second return value to indicate timer wrap
2018-11-10 14:53:10 +01:00
tomsci 5db5d8edeb Changed ESP32 http user agent to "NodeMCU (ESP32)" (#2551) 2018-11-08 21:14:15 +01:00
tomsci 73b13e4197 Add ESP32 http module (#2540)
* ESP32: Added http module

* add asynchronous flavor for context:request()

(cherry picked from commit e65b90cc8fc5296f7fe6cae1978835e06a9f44bb)

* http: More asynchronous support, more options

* Fix docs typo

* Code review comments from @devsaurus

Fixes some cleanup issues with asynchronous mode

* Added http.md to mkdocs.yml

* Align connection:close() to template
2018-11-08 20:24:18 +01:00
devsaurus 955a63881f i2s: fix memory leak for pending tx data when node_i2s_stop() deletes the tx task 2018-11-04 23:28:21 +01:00
devsaurus bf549a2440 make ldblib.c compilable with extended debug support 2018-11-04 23:26:09 +01:00
devsaurus dc0c6ff65d pack-port bits and pieces in spiffs.c:
- implement file.size for spiffs (#1516)
- fix vfs_lseek() result checking in enduser_setup and clarify SPIFFS_lseek() return value (#1570)
- Handle error condition in file.read() (#1599)
2018-11-04 08:49:17 +01:00
devsaurus fdb96f51be update file and vfs to master 2018-11-04 00:42:08 +01:00
devsaurus 30ada6f084 add i2s.mute() 2018-11-02 22:31:49 +01:00
tomsci 48b9518d76 Add object-based file API to dev-esp32 branch (#2524)
* #2521: Add object-based file API to dev-esp32 branch

Merged in from master@c708828bbe853764b9de58fb8113a70f5a24002d minus
some VFS changes and similar.

* Updated file docs from master

Omitting:
* file.mount()
* reference to rtctime.epoch2cal()
* file.stat()

As these are not available in dev-esp32 branch

Unsure about whether "directories are not supported" is still true
2018-10-29 07:09:41 +01:00
devsaurus 7ded3960eb fix net hold/unhold 2018-10-20 22:58:57 +02:00
devsaurus 3fb2c7d402 fix intr_alloc setting
re-enable i2s.read()
2018-10-18 22:47:39 +02:00
devsaurus daa5848431 rework parts of I2S 2018-10-14 18:05:48 +02:00
devsaurus 5e64def682 add dac module 2018-10-14 12:29:30 +02:00
zelll d094944b9b fixed a leak 2018-10-13 14:12:11 +02:00
zelll a4c0d7180e fix spaces 2018-10-13 14:10:34 +02:00
zelll 34e486fb7f i2s extension 2018-10-13 14:10:03 +02:00
Ryan Hartlage d6c593b722 Use esp-mqtt from esp-idf (#2509)
* Use esp-mqtt from esp-idf

* Fix formatting

* Revert changes to u8g2 submodule
2018-10-08 20:58:28 +02:00
tomsci 35c0f15805 Set stdout to unbuffered (#2508)
* Set stdout to unbuffered

This fixes issue #2507 esp32 serial console doesn't show output until
enter pressed.

* Moved setvbuf call to app_main immediately after console_init
2018-10-07 21:40:49 +02:00
devsaurus 45c63a8236 Add ucg module. 2018-10-07 16:31:28 +02:00
devsaurus 4b1551af49 update u8g2 to v2.23.18 2018-10-07 15:04:03 +02:00
devsaurus 358379fd90 Updated ESP-IDF to latest. 2018-10-07 12:33:40 +02:00
Arnim Läuger bf5808495c
Merge pull request #2501 from ryanplusplus/mqtt-rometatable
Mqtt rometatable
2018-10-02 19:00:04 +02:00
Ryan Hartlage c8e3a11a00 Use alphabetical order for lua modules in kconfig 2018-07-14 15:07:39 -04:00
Ryan Hartlage 74fd5184dd Use RO metatable for MQTT module; add link to docs in mkdocs.yml 2018-07-14 13:40:21 -04:00
devsaurus 45be28cf60 fix and document template partition table 2018-04-15 22:55:28 +02:00
devsaurus 8d0a8a5763 refactor task wdt handling to platform layer 2018-04-04 09:25:47 +02:00
devsaurus a63da92e82 set auto_connect before station configuration
idf 3.1 connects automatically upon esp_wifi_sta_config()
2018-04-04 09:09:41 +02:00
devsaurus 8d843e5beb fix task wdt to handle PANIC situations and spiffs formatting 2018-04-02 21:17:18 +02:00
Andrew Gough 33232b501d Upgrade to espmqttc head 2018-03-19 19:31:38 +11:00
Andrew Gough 4207d6c8ad Add espmqtt library + bindings 2018-02-01 21:03:10 +11:00
devsaurus 4702c1f181 align source from esp8266 port 2017-12-18 22:06:47 +01:00
devsaurus 23e9fcccfa update to u8g2 2.19.8 2017-11-18 17:38:21 +01:00
devsaurus 0b998e5612 tolerate multiple netconn callbacks for a single send job 2017-11-12 17:41:29 +01:00
devsaurus 7448d21afa Updated ESP-IDF to latest. 2017-09-12 22:22:20 +02:00
devsaurus b2f09da2e2 ignore return code from netconn_delete, fix #2096 2017-09-12 22:22:00 +02:00
devsaurus 9f8664b8e6 Updated ESP-IDF to latest and adapt spi master. 2017-09-02 11:38:19 +02:00
Johny Mattsson d5d8990bf2 Merge pull request #2021 from larsstenberg/dev-esp32-getmac
ESP32: added functions wifi.sta.getmac() and wifi.ap.getmac()
2017-08-17 12:36:42 +10:00
devsaurus 4b5e124244 update to u8g2 2.16.9 2017-08-16 10:56:25 +02:00
devsaurus 412db2e339 propagate error code for close 2017-08-14 14:29:42 +02:00
larsstenberg 40e0be29ee ESP32: Ledc driver module (#2027)
* Inital commit for supporting ledc driver

* Added documentation. More fade functions and better naming of constants

* Better field checking during setup. Updated documentation

* Reworked LEDC module to be used with an object model to decrease repetition of parameters
2017-08-11 19:11:12 +02:00
devsaurus 4375e09c0b ignored unused functions if u8g2 module is skipped anyhow 2017-08-02 22:35:55 +02:00
devsaurus 64f8ac2876 u8g2: add rfb support 2017-07-27 23:29:37 +02:00
devsaurus f501b84090 signal an error in case TCP send data was only written partly 2017-07-21 22:50:36 +02:00
devsaurus d26c8ea290 promote closing flag to serve all socket types
and set it consistently also for intended netconn close to prevent any cb activity
2017-07-20 21:23:38 +02:00
devsaurus abbd384da3 first batch of review feedback 2017-07-20 21:04:21 +02:00
devsaurus 070973e68c Port net module to netconn API. 2017-07-18 20:45:20 +02:00
devsaurus 5ee043cfb9 fix pin handling for rmt channels now that GPIO output matrix is cleared with
17747b3358
2017-07-13 23:00:24 +02:00
Lars Stenberg e6eb743b88 Added functions wifi.sta.getmac() and wifi.ap.getmac() 2017-06-30 23:55:43 +02:00
devsaurus a56a7b2775 init ws2812_chains during platform_init 2017-06-20 23:09:14 +02:00
devsaurus 10e96a3b51 fix travis build 2017-06-13 19:03:25 +02:00
devsaurus a8ff8f059d Add u8g2 module. 2017-06-13 18:38:09 +02:00
zelll 329bd73b63 ESP32: uart 1/2 supports (#1982)
* uart 1/2

* call -> pcall in uart_on_* functions

* fix docs

* fixed console driver when using custom console uart

* fixed line_inverse and error callback

* fixed a crash when uart.start() called more than one time
2017-06-13 18:33:32 +02:00
devsaurus 819284530e Add spi master. 2017-05-14 18:00:40 +02:00
devsaurus 9e7eb48fef Updated ESP-IDF to latest.
can: Use DPORT_(SET|clear)_PERI_REG_MASK for DPORT regs.
2017-05-13 22:30:13 +02:00
Arnim Läuger 209bde603d Fix gpio pin mask generation and clarify available gpios. (#1965) 2017-05-12 11:10:44 +10:00
zelll ff30f479e1 ESP32: CAN module (#1958)
* can extension

* can extension: bit timing and filter

* can -> CAN

* post CAN data callback

* CAN docs

* CAN: fixed receive, filter, extended frame

* reorder fn in can.md, remove driver_can/Kconfig

* fixed a leak when can.stop()
2017-05-07 09:35:17 +02:00
devsaurus 1117137363 fix compile warnings 2017-05-05 22:51:21 +02:00
devsaurus fb62011ddf Add sdmmc module and enable fatfs. 2017-04-30 22:49:54 +02:00
devsaurus 31cb312c72 fix insertion of rmt end marker 2017-04-27 23:13:24 +02:00
devsaurus 1ab8f526b0 fix ws2812 doc 2017-04-27 22:42:10 +02:00
zelll b7fa8c592f ADC extension for ESP32 (#1927)
* added adc extension

* add adc_number, for adc2
2017-04-24 21:36:01 +02:00
Johny Mattsson 9faa63f116 bthci: fixed initialisation (#1928) 2017-04-24 15:46:05 +10:00
devsaurus 9cca38767f check for outdated version of make 2017-04-23 17:36:21 +02:00
devsaurus 587bfd4084 fix unitialized value error in release build 2017-04-21 14:53:54 +02:00
Arnim Läuger 7386f342b5 ESP32: Use fwrite() instead of printf() for printing strings from Lua. (#1919)
* use fwrite() instead of printf() for printing strings from Lua

Fixes #1914.
2017-04-20 09:40:53 +10:00
devsaurus 018a67a710 establish flushing of uart to leverage buffering putchar() 2017-04-18 22:43:03 +02:00
devsaurus 066e8d60fa install rmt isr as shared for dht and onewire 2017-04-14 19:56:36 +02:00
devsaurus 1866e6f457 Add ws2812 module. 2017-04-14 19:56:27 +02:00
devsaurus 927ee7fc5f Add dht module. 2017-04-14 19:18:38 +02:00
devsaurus c8e99d50a5 Updated to latest IDF. 2017-04-14 00:22:33 +02:00
devsaurus 90f5b7696b handle undefined CONFIG_CONSOLE_BIT_RATE_AUTO 2017-04-06 21:09:22 +02:00
devsaurus 3694ffa957 ow: update rmt handover when switching pins 2017-04-01 14:12:58 +02:00
devsaurus e2fdd4adbe Manage RMT channel resources with alloc()/release(). 2017-04-01 10:09:10 +02:00
Johny Mattsson e33fb81b77 Decouple LUAL_BUFFERSIZE from BUFSIZ, revert to 1024.
The IDF has dropped BUFSIZ to 128, which is not a good thing for our Lua.
2017-03-29 11:56:17 +11:00
devsaurus 1116bb2c71 ow: handle misconfigured bus gracefully with timeout 2017-03-20 22:20:45 +01:00
Arnim Läuger 21e1cadf05 ESP32: Fix event id for post_net_accept() (#1869)
* ESP32: Fix event id for post_net_accept()
2017-03-20 00:51:51 +11:00
devsaurus 4b647d007f Remove IRAM requirement from gpio/single_pin_isr 2017-03-17 17:38:17 +01:00
devsaurus 961c1c72b2 Add ow module. 2017-03-17 07:50:31 +01:00
devsaurus a3dc13e3fb fix tmr.interval() 2017-03-09 23:31:02 +01:00
devsaurus 2b98037fa9 refine ack handling for i2c hw master 2017-03-08 16:38:43 +01:00
devsaurus d4b6180cd2 fix sigma_delta component naming 2017-03-07 23:05:09 +01:00
devsaurus e203a5829c add tmr module 2017-03-07 20:54:48 +01:00
devsaurus 0b1e58d6dd correct portYIELD 2017-03-02 21:37:32 +01:00
devsaurus 859e1a3004 first draft implementation of i2c slave 2017-03-02 21:37:13 +01:00
Johny Mattsson dbc8d791c6 Added node.chipid() based on esptool's formula. 2017-03-02 22:29:40 +11:00
devsaurus f5632f41f9 extend i2c master with hardware interfaces for synchronous and asynchronous operation 2017-02-04 20:14:13 +01:00
devsaurus 381726f103 add i2c module 2017-02-02 21:40:36 +01:00
devsaurus 4fcb1404b6 add simga_delta module 2017-01-13 22:34:24 +01:00
Johny Mattsson 9f8dc0271b Updated to latest IDF. 2017-01-10 11:37:49 +11:00
Johny Mattsson ea59007bc3 WiFi module documentation and updates.
Addresses one point of #1615.
2017-01-03 12:57:45 +11:00
Johny Mattsson 7abda5c9e0 Updated to latest IDF.
- Switched hardcoded interrupts to new IDF interrupt allocation
framework.

- gpio module switched to the IDF's per-pin interrupt callback service.

- Improved NodeMCU linker script since it broke with the IDF upgrade.

- Various compatibility updates.
2016-12-30 19:25:48 +11:00
Johny Mattsson 4ece8de4d9 net module: hold/unhold support.
As per @djphoenix's work on the ESP8266 side.
2016-12-30 15:55:14 +11:00
Johny Mattsson 6bce18f9ac net module: Server timeout support
As per @djphoenix's version on the ESP8266 side.
2016-12-30 15:39:07 +11:00
Johny Mattsson 334ba08131 Split wifi.on() into wifi.sta.on()/wifi.ap.on()
As discussed in #1615.
2016-12-10 15:25:57 +11:00
Johny Mattsson d48265348a Fixed various warnings. 2016-11-27 13:28:48 +11:00
Johny Mattsson c505cc0270 Preliminary gpio module.
The gpio ISR needs to go into the platform layer most likely, but that's
for later.
2016-11-26 21:54:05 +11:00
Johny Mattsson c4911ca391 Updated to latest IDF.
This fixes the panic-on-restart issue and the crash-on-uart-input-before-flash-mapped issue.

Node module updated to reflect new function names for sleep/restart.
2016-11-25 10:51:49 +11:00
Johny Mattsson 888ce8b5f3 Unbreak integer build. 2016-11-17 21:59:56 +11:00
Johny Mattsson 3fe7f77512 Imported 'bit' module from dev branch. 2016-11-17 21:56:51 +11:00
Johny Mattsson 6ce3e7a551 Imported 'struct' module from dev branch. 2016-11-17 21:48:31 +11:00
Johny Mattsson 0f0cc93f7b Fix module inclusion (got broken by IDF build changes). 2016-11-17 16:52:01 +11:00
Johny Mattsson 2b454abfdf Improved flash size detection.
With the recent flash layout changes, it became very possible to misdetect the
flash size. We're now using the partition table as the guard marker, since
that really shouldn't be all 0xff. Also, we now don't clobber the flash
device id (and keep block/sector/page/mask values).
2016-11-17 11:56:39 +11:00
Johny Mattsson 2266670b46 Updated to latest IDF. 2016-11-16 17:59:06 +11:00
Johny Mattsson 389980fc0c Removed call to deprecated system_init(). 2016-11-12 13:23:09 +11:00
Johny Mattsson 5c1bb4c6d6 Updated to latest IDF.
WiFi STA module updated to reflect IDF name changes.

Platform flash and partition api updated to reflect IDF name changes.
Eventually these (and the SPIFFS module) will likely need to be updated
to exclusively work with the esp_partition_xxx() functions in order to
support working with encrypted flash.
2016-11-12 13:17:17 +11:00
Johny Mattsson be5dafb264 Imported @djphoenix's new native LWIP net module.
Based on his revision 2d290a24a0914be88e5ca4ac7b1018392fe75fe2
(https://github.com/djphoenix/nodemcu-firmware).

All LWIP callback handling changed to use the NodeMCU task interface
to make it usable on RTOS.

IPv4 assumptions have been removed, and this net module /should/ now
be IPv6 ready, but aside from compilation no testing has been done
in this area.

SSL integration points not touched - some work needed there once we
have an mbedTLS module.
2016-10-06 17:24:08 +11:00
Johny Mattsson e67c6f0917 Split out IP formatting helpers. 2016-10-06 17:23:48 +11:00
Johny Mattsson d83437d1ba Removed left-over UART debug echo. 2016-10-05 14:36:24 +11:00
Johny Mattsson 4fead4a4be More WiFi module work.
Station connect/disconnect/scan, plus event handling via wifi.on().
2016-10-04 17:40:06 +11:00
Johny Mattsson 233bdc63aa Fixed Kconfig macro use for Lua debug module (oops). 2016-10-04 15:33:40 +11:00
Johny Mattsson 991965e242 Actually include standard Lua modules. 2016-10-04 14:47:41 +11:00
Johny Mattsson 3503a1ec95 Basic wifi config functions.
Note need to use explicit wifi.start() at this point.
2016-10-03 17:42:28 +11:00
Johny Mattsson 5df981010a Prevent UART/startup race ala 1517.
We're already in the right context, there is no point posting back the
Lua start, we can do it right then and there instead.
2016-10-03 13:05:17 +11:00
Johny Mattsson e355057de6 Fix our esp_event_send() implementation. 2016-09-29 18:21:18 +10:00
Johny Mattsson f9bf50cf03 Simple BlueTooth module for BT LE advertisements. 2016-09-29 17:02:40 +10:00
Johny Mattsson 8e441b59c1 Grabbed the encoder module from dev.
Only minor changes to make it IDF friendly.
2016-09-28 17:58:44 +10:00
Johny Mattsson 16e19442c1 Added node.osprint().
Implemented in terms of esp_log_level_set() at this point.
2016-09-28 17:57:29 +10:00
Johny Mattsson febc8f7f36 Updated to latest IDF. 2016-09-28 17:57:00 +10:00
Johny Mattsson 33eb1bc790 Updated to new startup & esp event handling.
Modules can now subscribe to ESP system events via the new
NODEMCU_ESP_EVENT() macro. See nodemcu_esp_event.h for details.
2016-09-27 18:42:08 +10:00
Johny Mattsson 6349fc8622 Most of the node module from dev.
node.dsleep() no longer takes options.
node.output() not yet supported (needs syscall registration/chaining support)

Dynamic CPU frequency changing not currently supported in the IDF.
Various chip IDs not currently available/obtainable.
Boot reason completely revamped in ESP32, will need new code.
2016-09-26 18:04:24 +10:00
Johny Mattsson 48bbe74cbf Updated to latest IDF.
Lost some helpful macros when they changed the uart register header it seems.
2016-09-26 13:36:53 +10:00
Johny Mattsson baf8249a79 Improved flash-size auto-detection.
No longer limited to the default 2MB.
2016-09-23 17:39:06 +10:00
Johny Mattsson 3b65262922 Less memory leaks if not coding in a rush... 2016-09-22 19:50:46 +10:00
Johny Mattsson d369953328 Auto-create SPIFFS partition if not found.
The heuristics could probably be improved a lot, but this is better than
nothing at least.
2016-09-22 18:19:39 +10:00
Johny Mattsson 60339b812b SPIFFS partition support, file module from dev.
Now uses the designated partition (type 0xC2, 0x00) unconditionally.
2016-09-22 17:18:22 +10:00
Johny Mattsson 0fe0096c04 Platform flash layer updated for ESP32.
It would appear my ESP3212 only has a 2MB flash chip despite the
bootloader saying 4MB.
2016-09-22 14:56:40 +10:00
Johny Mattsson 6cd3111d79 Platform interface to flash partition info. 2016-09-22 13:09:56 +10:00
Johny Mattsson 8e23335c0f Removed more unused legacy code. 2016-09-22 11:42:25 +10:00
Johny Mattsson 6f54c38e53 Grabbed fatfs from dev branch, and IDF-ified it. 2016-09-21 18:21:44 +10:00
Johny Mattsson 4f1b33d522 Grabbed latest spiffs + vfs layer from dev branch.
Also included the recent LVM fix.

Platform flash layer not yet functional.
2016-09-21 18:14:15 +10:00
Johny Mattsson fe602d2d7e Removed all currently-unused code & docs.
Heading towards having only ESP32-aware/capable code in this branch.
2016-09-21 13:47:44 +10:00
Johny Mattsson 51fabc7439 Fixed NodeMCU boot banner.
Build for ESP32 on Travis.
2016-09-20 14:19:50 +10:00
Johny Mattsson 9bbf8f43fb Successfully boot barebones NodeMCU on ESP32 (only).
RTOS driver evicted as it did not play nice with stdio etc.

Implemented a minimal driver to fully support Lua console on UART0. Output
on UART0 done via stdout (provided by the IDF). Input and setup handled
via driver_console/console.c. In addition to the direct input function
console_getc(), the driver also registers in the syscall tables to enable
regular stdio input functions to work (yay!). The Lua VM is still using the
direct interface since it's less overhead, but does also work when going
through stdin/fd 0.

Auto-bauding on the console is not yet functional; revisit when the UART docs
are available.

Module registration/linking/enabling moved over to be Kconfig based. See
updates to base_nodemcu/include/module.h and base_nodemcu/Kconfig for
details.

The sdk-overrides directory/approach is no longer used. The IDF is simply
too different to the old RTOS SDK - we need to adapt our code directly instead.

Everything in app/ is now unused, and will need to be gradually migrated
into components/ though it is probably better to migrate straight from the
latest dev branch.
2016-09-20 13:35:56 +10:00
Johny Mattsson a463d764eb WIP ESP32 IDF port.
Currently the UART driver break boot (or at least output).
2016-09-16 18:11:42 +10:00