316 Commits

Author SHA1 Message Date
Jonathan
94db708f49
Touch support for ESP32 (#1873)
* Added touch pad support

* touch: Introduced blocking mode

* touch: moved fns out of TouchPad to prepare async code

* touch: added async support and embassy example
2024-08-06 07:19:41 +00:00
Jesse Braham
3215d93f53
Use peripheral ref pattern for OneShotTimer and PeriodicTimer` (#1855)
* Use the peripheral ref pattern for `OneShotTimer` and `PeriodicTimer`

* Update tests and examples to reflect changes in timer API

* Update `CHANGELOG.md`
2024-07-25 12:52:34 +00:00
liebman
c7218fba2b
Implement DMA to/from psram on esp32s3 (#1827)
* initial non-working attemt for dma from psram on esp32s3

* flush cache - now works for extmem as source but not for extmem as destination

* use cache_invalidate_addr on destination address

* update changelog

* require dma transfers to/from psram to be aligned to dcache line size

* cache_writeback_addr() should suspend/resume dcache autoload

* no need for cfg(esp32s3) in esp32s3 specific module

* dma: document alignment requirements for DMA to/from PSRAM

* fix doc typos
2024-07-25 12:51:02 +00:00
Björn Quentin
38f1d28585
Fix async PARL_IO RX (#1851)
* Fix async PARL_IO RX

* CHANGELOG.md
2024-07-24 13:19:19 +00:00
Juraj Sadel
3299348ebc
esp_hal: Warnings in examples cleanup (#1852) 2024-07-24 13:18:50 +00:00
BMCG0011
5d6354ccbd
Expose InputPin.is_interrupt_set in implementation of esp-hal::gpio::… (#1839)
* Expose InputPin.is_interrupt_set in implementation of esp-hal::gpio::Input

* Move entry in changelog from changed to added
2024-07-23 19:47:59 +00:00
Björn Quentin
8be7f81e34
usb-serial-jtag example: Hint for Windows users (#1845) 2024-07-23 19:23:35 +00:00
Björn Quentin
1424f2a43d
Implement InterruptConfigurable (#1819)
* Implement `InterruptConfigurable`

* Fix doc-tests

* Clippy

* Fix lp_core_uart example

* CHANGELOG.md

* Have DEFAULT_INTERRUPT_HANDLER

* Fix docs

* Clippy

* Add `set_interrupt_handler` for WDT
2024-07-18 13:37:46 +00:00
Jesse Braham
776f34cff1
Re-export the esp_hal_procmacros::main macro from esp-hal-embassy instead of esp-hal (#1828)
* Re-export the `main` procmacro from `esp-hal-embassy` rather than `esp-hal`

* Fix documentation warnings

* Flatten the `time_driver` module

* clippy

* Update `CHANGELOG.md`
2024-07-18 09:31:03 +00:00
Juraj Sadel
884db5aa32
esp-hal: Add (where missing) used GPIOs to example descriptions (#1810)
* esp-hal: Add (where missing) used GPIOs to example descriptions

* review comments
2024-07-17 08:34:13 +00:00
Jesse Braham
77b6cb8615
New package releases (#1800)
* Use published versions of all dependencies, update dependencies as needed

* Fix `embassy_usb_serial` example build errors after updating `embassy-usb`

* New package releases
2024-07-15 20:23:13 +00:00
Sergio Gasquez Arcos
7ea471c1ac
Remove unnecessary delay (#1794)
* fix: Remove unnecesary delay

* docs: Update changelog

* fix: Remove unused variable

* fix: Remove clippy warning from examples
2024-07-15 13:09:47 +00:00
liebman
1631f22083
support dma chunk sizes other than 4092 (#1758)
* support dma chunk sizes other than 4092

* fmt

* update CHANGELOG

* fix 0 size static assert

* review changes:
- `.div_ceil()`
- return errors for bad chunk size and buffer sizes in Mem2Mem constructors
- correct 0 chunk size check in descripter macros

* dma: clear the mem2mem bit when channel is configured instead of in Drop
2024-07-15 12:00:33 +00:00
Juraj Sadel
45c8107ecd
esp-hal: remove warnings in PCNT example and HIL test (#1793) 2024-07-15 10:49:39 +00:00
Dominic Fischer
0cae79b4cc
Improve PCNT API (with HIL tests) (#1765)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-07-15 09:31:35 +00:00
Jesse Braham
dcc6c896de
Housekeeping: fix warnings, rename some examples, etc. (#1786)
* Build HIL tests for ESP32 in CI, fix resulting build errors

* Fix some warnings in the `hil-test` package

* Fix warnings in examples

* Remove "esp_" prefix from Wi-Fi example file names

* Resolve the last of the known warnings
2024-07-12 09:35:55 +00:00
W Etheredge
a2883ac318
Take 2 on #[ram] soundness (#1677)
* Improve `#[ram]` soundness

* Allow `Atomic*` in `#[ram(persistent)]`

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2024-07-10 13:30:48 +00:00
Björn Quentin
a5be31fadc
Improve and use timer abstractions (#1753)
* Make esp-wifi timer agnostic

* Use timer-abstractions in embassy time driver

* Refactor

* Fix

* Fix

* Docs

* Adapt examples

* Adapt tests

* Refactoring

* Changelogs

* Fix example

* Adapt xtask

* Make CI pass

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2024-07-09 15:59:38 +00:00
Juraj Sadel
d5b6c850f9
esp-hal: ESP32 typo in cfg-gate in embassy_i2s_read example (#1775) 2024-07-09 13:48:08 +00:00
Grant Moyer
dfe628c53d
Fix UsbDm and UsbDp for Gpio19 and Gpio20 (#1764)
GPIO pins 19 and 20 had USB D- and D+ swapped. This change fixes which pin is which USB data line according to the pin descriptions in the ESP32-S2 and ESP32-S3 data sheets (sections 2.2 and 2.3.2 respectively). Since these GpioPins are only used by Usb for lifetime tracking, and UsbDp and UsbDm are always used as a pair, this change is only semantic and doesn't affect functionality.
2024-07-08 13:37:57 +00:00
Sergio Gasquez Arcos
ea34196d8d
Properly update the Uart config in examples (#1759)
* fix: Properly update the config

* feat: Make rx_timeout optional

* docs: Update changelog
2024-07-08 09:30:45 +00:00
liebman
cc7077624c
dma: add Mem2Mem to support memory to memory transfer (#1738)
* dma: add Mem2Mem to support memory to memory transfer

* fmt

* update CHANGELOG

* removed some debugging

* use "gdma" as the selector for support

* fix empty else

* clippy

* Mem2Mem::new now accepts the peripheral to use

* mark Mem2Mem::new() unsafe

* fmt :-/

* add Mem2MemN values for gdma on non-esp32s3
tested on esp32c3,esp32c6 (will have an esp32h2 in a few days)

* support the esp32c2 (esp8684)

* DmaEligible trait providing dma peripheral value & safe constructor for Mem2Mem dma.

* added hil-test for Mem2Mem

* fmt dma_mem2mem test

* remove `debug!()`

* reset the mem2mem bit (mem_trans_en) in in_conf0 on drop
2024-07-03 17:56:37 +00:00
Dominic Fischer
fc826caf18
Expose optional HSYNC input in LCD_CAM (#1707)
* Expose optional HSYNC input in LCD_CAM

* Fix DMA wait check in LCD_CAM

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-07-02 16:56:53 +00:00
Dominic Fischer
7753551671
[2/3] DMA Move API: Move DMA descriptors to peripheral drivers (#1719)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-06-26 14:31:41 +00:00
Dominic Fischer
9d5fb31c4b
TIMG: Fix interrupt handler setup (#1715)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-06-25 13:01:40 +00:00
Dominic Fischer
eee20de116
Patch up LCD_CAM example (#1701)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-06-20 13:27:50 +00:00
Björn Quentin
65b956d6a8
Fix mk_static macro (#1674) 2024-06-12 15:09:43 +00:00
Andres O. Vela
05076697ec
Rename PSRAM examples for better discoverability (#1675) 2024-06-12 14:23:55 +00:00
Sergio Gasquez Arcos
d2a93894f5
feat: Avoid using a macro for default pins (#1671) 2024-06-11 15:49:44 +00:00
Sergio Gasquez Arcos
a33159a021
Rework Uart constructors, add UartTx and UartRx constuctors. (#1592)
* feat: Add with_pins methods for UART

* feat: Remove configure_pin methods

* docs: Update changelog

* fix: Update tests and examples

* style: Fix format

* Add UartTx/Rx constructors

* feat: Add new_with_default_pins methods

* docs: Update changelog

* feat: Remove optional cts/rts arguments

* feat: Add UartTx/Rx::new_async methods

* fix: Attach interrupt handler to new_ascyn UartRx/Tx

* style: Avoid long module paths

* feat: Make flush_tx public

* test: Use Uart async instead of UartTx/Rx async

* test: Add tests for UartTx/UartRx

* feat: Add configuration method to constuctors

* feat: Move set_rx_fifo_full_threshold and set_rx_timeout to UartRx

* docs: Fix changelog

* test: Fix executor

* feat: Configure UartRx threshold and timeout

* docs: Update changelog

* test: Update uart instance

* feat: Add default_uart0_pins macro to simplify examples

* feat: Address feedback pt1

* feat: Address feedback pt2 - Make constructors fallible

* fix: Doctest
2024-06-11 13:07:17 +00:00
Juraj Sadel
4c5e493b1b
esp-hal: Add runnable doctests to peripheral drivers (#1663)
* Check docs examples II

* rebase and update

* fix root crate macro expansion in doctest snippets

* clean up and fmt

* add xtask run-doc-test subcommand and check in CI

* address review comments

* remove commented printlns

* fix the host target check

* rebase and update

* hide docs for before_snippet macro and remove commented block code in twai
2024-06-11 10:18:09 +00:00
Jesse Braham
dc8e0a6496
Refactor Dac1/Dac2 drivers into a single Dac driver (#1661)
* Refactor `Dac1`/`Dac2` drivers into a single `Dac` driver

* Fix unrelated build errors resulting from updated PACs

* Add new `Instance` trait to `prelude` module, update `dac` example

* Update `CHANGELOG.md`

* Fix example in module documentation

* Turns out these are 0-indexed after all
2024-06-10 13:52:00 +00:00
Jesse Braham
48e3e912f3
Extract embassy support into esp-hal-embassy package (#1595)
* Extract embassy support into `esp-hal-embassy` package

* Update relevant packages/examples/tests to get CI green again

* Add back `defmt` support

* Re-export `Executor` and `InterruptExecutor` rather than making `executor` module public

* Document the `esp-hal-embassy` package

* Update `CHANGELOG.md`

* Hack together a "fix" for the `SYSTIMER` time driver

* Make `clippy` shut up
2024-06-03 11:27:20 +00:00
Jesse Braham
40c327eeae
Housekeeping (#1647)
* Remove version from path dependencies in `examples` and `hil-test` packages

* Remove unused constant from `esp-println`

* Consistent badges across `README.md` files
2024-05-31 13:58:54 +00:00
Björn Quentin
83dfb5b803
Add IEEE802.15.4 Wireshark Extcap (#1636) 2024-05-29 14:04:44 +00:00
Scott Mabin
db39d0197a
Examples and test cleanup (#1590)
* initial cull of examples

* Remove direct vector example, replace with interrupt latency test

* Remove clock monitor in favour of just a test
2024-05-28 18:58:48 +00:00
Jesse Braham
8aee84f842
[3/3] Timer abstraction: cleanup, simplification, and documentation (#1630)
* Add a new `timg_timer1` symbol to `esp-metadata` definitions

* Make `Timer::load_value` fallible (when the value is too large)

* Clean up, simplify, and document the `timer` module and its submodules

* Fix various issues

* Update the timeout value verification for `SYSTIMER`

* Clippy

* Introduce new `PERIOD_MASK` constant for validating timeout values
2024-05-28 14:12:06 +00:00
Björn Quentin
60e4b882ef
Add esp-storage to esp-hal repo (#1627)
* Add esp-storage to esp-hal repo

* Include needed feature to lint esp-storage

* Don't lint esp-wifi for now

* Remove redundant copies of license texts

* Try `git-fetch-with-cli`

* Fix esp-pacs URL

* git-fetch-with-cli, again

* desperately trying
2024-05-27 15:28:05 +00:00
Björn Quentin
06315b8c8c
Add esp wifi to monorepo with history (#1582)
* Move the existing `esp-wifi` package into a directory

* Update READMEs

* Don't prefix the ROM functions linker script with the chip name

* Address a couple comments from review

* Move the `esp-wifi` README back to the root of the repository

* Add esp-now support

* Don't use underscores in feature names

* Smoltcp 0.9 upgrade (#124)

* switch to heapless for SimpleQueue

* Merge Network into WifiStack

- Merge the Network and Wifi structs into WifiStack
- Get it building & running with just TCP socket for now

* get dhcp example building with changes and no warnings

* fixup error checking

* Fix other examples

* fmt

* Remove redundant comment

* fix unused results

* bump BT_INTERNAL_QUEUE to 10

* add back static ip configuration in work()

* Async WiFi (#125)

* Async WiFi with embassy

- Add embassy_net::Driver impl for WifiDevice
- Add embassy_dhcp example
- Update README with embassy_dhcp running instruction

Notes:

TCP connection may fail a few times until the esp gets an IP address, it
seems there is no way to await dhcp completion in embassy_net yet.

* Put embassy-net behind feature

- Whilst other embassy crates can be used behind the async feature,
  embassy-net should be put behind its own feature

* wait for dhcp to complete in example

* fmt

* Simplify embedded-io import

* Update README, use new bleps

* Ensure internal wifi buffers are freed (#128)

Regardless of whether we can do anything with the incoming packets, we
*must* ensure the drivers packet memory is free.

* Async WiFi: connect/disconnect/scan/wait_for_event (#129)

* Add async scan_n()

* WifiFuture and async connect

- Don't compile the blocking `WifiStack` when using the embassy-net
  feature
- Improve WifiEventFuture to have a waker for each WifiEvent
- Stub out async versions of embedded-svc trait

* Add async start/stop/connect

- All works first time
  - Fails on reconnect, but this is a bug in the svc implementation
- Implements `IntoFuture` for `WifiEvent`
  - Is it possible to await the event in two seperate futures? or will
    one overwrite the other?

* Async connect/disconnect

- Now working in fully async fashion
- Improved embedded-svc `Wifi` trait impl
  - is_started etc still needs work
- spotted memory leak when not transmitting anything

* Fix async start

Can now succesfully reconnect to a network

* Fix `is_started`

Closes https://github.com/esp-rs/esp-wifi/issues/126

* link state waker

* Only wake the transmit waker if we have something to send

* Correct WifiEventFuture

Instead of relying on the current state, it now tracks events and clears
the event before trying to listen.

* wifi: split into device and controller

- Split the wifi into two parts, the device part which is used within the
network stack and the controller, which handles the wifi connection
parts

- Remove the uneeded `Wifi` impl now that the two parts are separate

* undo cfg of blocking stack

* small fixups

* controller: add `wait_for_event`

- This solves the waker overwrite issue, as the function takes `&mut
  self`, meaning its only possible to await for the same event once.
- Sadly this means we have to remove the really clean `into_future` impl
  :(, but atleast we don't have to bump MSRV.

* Fix examples

* fmt

* make globals pub(crate)

* make all events awaitable

- Add wakers for all events
- Add some docs
- Make WifiEventFuture pub(crate)

* fix esp-now

* Add basic AP support (#134)

* Add basic AP support

* Remove IS_AP global static

* Remove uneeded features from examples and esp-wifi (#135)

* Adjust for latest HAL (#139)

* Adjust for latest HAL

* ESP32-S3 adjustments needed after update

* Use ESP32-C2 HAL 0.5.1

* ESP32-C6 WiFi support (#142)

* ESP32-C6 WiFi support

* Explain the `run_after_initialze_hack` function

* ESP32-C6 cleanup (#148)

* Use ESP_HAL to read mac address (#149)

* Refactor examples (#146)

* Move some boilerplate code into own examples-util crate

* Have an `examples-esp32XXX` folder for each target

* Cleanup dependencies

* Use workspace dependencies

* Adjust CI workflow

* `cd` into the right directories

* Don't pass chip selection features for examples

* Fix ESP32-C6 CI

* Refactor Socket::write to prevent infinite loop on long writes (#151)

* Use HAL's radio clock control (#153)

* Feature/radio singletons (#141)

* Use RADIO singletons

- Uses the RADIO singletons when creating wifi/ble/esp_now
- Updates all examples to use the singletons
- Simplfy esp_now::ReceiveFuture

* Fixup examples

* fmt

* fix examples

* Feature "big-heap", fix `calloc` (#155)

* Use types from `core::ffi::` (#159)

* Add wifi_set_mode for Wifi Protocol Support (#156)

* Add set_mode

* Revert unnecessary changes

* Review changes

* Removed unecessary change

* Review changes, merge conflict fix

* Add missing ROM functions for ESP32-S3/ESP32-S2 (#160)

* Add missing ROM functions for ESP32-S3/ESP32-S2

* Cut down nocoex + big-heap heap-size

* Async ble (#161)

* Async BLE HCI

* Add async-ble example

* Use nightly-2023-03-09 for CI (for now)

* Use a more sane default MTU, have features to change MTU (#164)

* Improve packet dumps (#165)

* packet-dump dumps the raw packets

* Update README, serialport config in wifishark

* Update embassy (#166)

* chore: update embassy's executor rev sync to 0.2

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* fix: examples - enable features for different example architectures

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* fix: examples riscv executor feature name

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* chore: update embassy-net & net-driver

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* fix - Cargo - on wifi, enable the embedded-svc feature

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* fix - config.toml - enable target atomic operations

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* fix: rustflags for atomic operations

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* fix: esp32s2 example - fix target cfg

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* chore: update crates & revisions

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* feat: patch to latest revision of esp hal crates

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>

* Adapt to esp-hal changes

* Use published esp-hal, published embassy-executor

---------

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>
Co-authored-by: Lachezar Lechev <elpiel93@gmail.com>

* Fix DHCP handling (#173)

* Don't use DHCP when using fixed IP

* Make it possible to connect to another AP

* A way to update iface-config (#177)

* fix(esp-wifi): Update is_started() implementation (#180)

The old implementation of is_started() returns `Ok(true)` is the sta or ap is enabled, which is true before wifi_start() has been called. This results in the function returning true, before `start()` has been called.

* Basic IPv6 Support

* Don't panic on full BLE receive queue

* Activate embedded-svc with wifi feature

* A way to dequeue a complete HCI packet

* Make ESP32 BLE work again

* preempt improvements (#185)

* [Xtensa] ensure CPU interrupts are re-enabled

Once the scheduler is enabled.

* [Xtensa] preempt: reduce from 2000hz -> 1000hz

This brings the task switching hz inline with the values for the RISCV
chips

* reduce preempt hz to 100 (freertos default)

* remove WIFI_BB interrupt from esp32_timer

* fix typo in timer_esp32s3

* peer_exists now returns bool

* De-duplicate init code

* What to initialize is now a runtime decision

* COEX is now an explicit feature

* Panic when trying to use BLE and WIFI w/o coex

* Improve feature gating of COEX check

* Make it possible to use ESP-NOW with (STA) WiFi

* Simplify async feature, update all examples

* Make timer type alias public

* Less verbose cfgs

* use linkage = 'weak' for missing intrinsic stub (#191)

* Workaround to make ESP32-C2 BLE work again

* Fix ESP32-C2 BLE

* Don't require timg0 as timebase

* ESP32 and ESP32-C2 working

* BLE works on C3 / S3

* Fix COEX for C3 and S3

* Make COEX for ESP32 compile again

* Remove embassy-net dependency

* Update smoltcp, embassy-net, embassy-net-driver

* Return all pending wifi events

* Clear the correct events, clear after polling, simplify scan_n

* Provide specialized futures

* Remove event in future when polling

* Avoid clearing interesting events

* Add DNS query interface to WifiStack (#213)

* feat(dns_query): add dns_query on WifiStack

* ref(dns_query): separate dns socket creation and dns query

* fix(dns_query): missing self parameter in is_dns_configured

* ref(dns_query): configure_dns now replaces and drops the old socket

* feat(dns_query): add proper dns_query error kinds

* feat(dns_query): dns_query now checks if name is already an ip

* feat(dns_query): dns server is set with dhcp configured event

* ref(dns_query): move dns update to configured case

* Update dependencies (#198)

* Clear state on stop (#217)

* fix log_timestamp value (#218)

The divider should be applied only on the TICKS_PER_SECOND, rather than on the whole systimer count, to get the proper value in millis

* Scan related refactorings (#221)

* Clean up scan result processing

* Remove redundant ap count reading

* Fix scan result API returning clipped AP count

* Inline closure

* Don't copy ssid

* Properly set initial config (#223)

* Properly set initial config

* Make new_with_config fallible

* Make EspWifiInitialization non-exhaustive

* Replace panic with error

* Enable wifi/bt power domain (#220)

* Refactor TCP socket read impl to handle correctly EOF and no data (#216)

* ref(tcp_read): tcp read now checks for eof and no data

* ref(tcp_read): SocketClosed is returned instead of Ok(0)

* Configurable tuning parameters (#233)

* Make certain settings configurable

* Add MD documentation

* Update HALs, uncomment commented code in S2 power domain enable (#235)

* Update esp dependencies

* S2: Properly reset radio power domain on enable

* Wait for esp now send callback to be called after sending (#232)

* Make check_error result propagatable with ?

* Wait for esp_now_send callback after sending #229

* Updated examples

* Add more configuration options (#234)

* Add more configuration options

* Remove obsolete mtu feature

* Simplify DEFAULT_HEAP_SIZE

* Make EspNow methods take immutable borrowed self (#237)

* Reduce stack-allocations (#243)

* Reduce stack-allocations

* Avoid explicit panic on exhausted backing memory

* Remove unnecessary `transmute`

* Add defmt::Format to some types (#251)

* use intset intclear now they are recognized by llvm (#248)

* use intset intclear now they are recognized by llvm

* Bump readme MSRV

* Remove comment

* Clean up btdm initialization (#254)

* Make log optional, add feature and macros to route to defmt (#252)

* Debug-print pointers

* Make log dependency optional

* Add Format to Config

* Add defmt log option

* Add panic macro

* Add unwrap macro

* A few DataFrame-related fixes (#257)

* Clean up DataFrame::from_bytes

* Fix potential typo

* Fix potential memory leak

* Clean up

* Only allocate data frame if queue is not full

* Free DataFrame on drop

* Fix warning

* Remove embedded-hal dependency (#258)

* Don't depend on PACs directly (#260)

* Remove DataFrame, Leverage the internal WiFi heap (#259)

* use heap allocated buffers for RX instead of memcpy to Rust

* remove tx queuing, leverage wifi heap again

* Allow sending up to TX_QUEUE size packets, instead of one at a time

* share tx & rx consume impls. move inflight check into function

* defmt related improvements (#255)

* Replace custom macros with fmt.rs

* Fix missing Format errors

* Update Cargo.tomls

* CI: deduplicate, assert that defmt feature compiles

* Update dependencies

* Fix examples

* Implemented duplex ESP-NOW correctly (#240)

* HAL cleanups & remove example macros (#261)

* use Systimer from hal where possible

* Remove RTC and clocks macros in favour of hal primitives

* Remove system! macro

* Remove the timer macro

* remove the radio macros

* Make utils a single file module for remaining util items

* Fix rebase issues

* Remove redundant example, update esp-now examples

* ESP32-C6 BLE Support (#262)

* ESP32-C6 BLE Support

* Reformat

* Docs & README changes for release (#263)

* Make internal functions/structs private where possible

* Top level docs

* Rework README, move examples into own file
* Include README as top level docs in esp-wifi

* Document public items

* Implement floor() using libm (#272)

* Support ps-max-modem (#273)

* Task/semaphore tweaking (#276)

* Query current systick once

* Use pattern matching to clean up task

* Work with references of timer slots

* Unwrap WORKER_HIGH

* Avoid unwrap by using exact length buffer, simplify types

* Log if work is lost

* Move memory fence to the end of the critical section

* Remove redundant cast

* Only reset timer fields once

* Import some types

* Replace manual borrow_mut

* Remove extra loop

* Deduplicate semaphore index calculation

* Use pattern matching instead of unwrap

* Use option instead of separate flag

* Unwrap REAL_WIFI_QUEUE

* Simplify lock_mutex

* Process message outside of critical section

* Remove unnecessary return statement

Co-authored-by: Scott Mabin <scott@mabez.dev>

* Remove unused import

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>

* Avoid AtomicU64 if possible, fix race condition (#278)

* Xtensa: avoid AtomicU64 in get_systimer_count

* Fix get_systimer_count racy behaviour

* Improve code consistency

* Xtensa: Copy TrapFrame in one statement (#279)

* Remove StrBuf (#280)

* Allow using AP when `ps-max-modem` is enabled (#283)

* Set inactive time only for ps-max-modem

* Set inactive time regardless of modem sleep mode

---------

Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>

* Config for failure_retry_cnt and scan_method (#282)

* Deduplicate SoC/arch-specific task switching related code (#284)

* Clean up imports, refer to crate-relative hal

* Move timer* files to submodule, split out common code

* Deduplicate time-based task switching

* Extract common setup fn

* Fix overflow in timestamp calculation (#287)

* Fix log strings (#292)

* Fix typo in ble feature name (#297)

The `initialize` function checks if wifi and ble are enable simultaneously without coex, but it was mistakenly using `feature = bluetooth` instead of `feature = ble`. This meant the check was actually never compiled in.

* Enable `vsnprintf` on compilers newer than `1.73.0.1` (#293)

* Add compiler version check for VaListImpl support

* Raise log level of puts

* Split wifi state for AP and STA (#288)

* Split wifi state for AP and STA

* Use atomic enum to store state

* Clean up unnecessary unsafe blocks

* Misc. simplifications (#298)

* Hide os_adapter

* Remove global is_connected fn

* Extract state management

* Set mode when creating the controller, extract some fns

* Encapsulate WifiMode a bit better

* Simplify setting addresses to static data

* Only set verbose logging once

* Clean up imports

* Deduplicate wifi auth method conversion

* Clean up powersave mode setup

* Remove unnecessary condition

* Explain transmute

* Misc small readability improvements

* Remove unnecessary conversion

* Prepare waiting for multiple interfaces to start and stop

* Pull up wifi interface to caller

* Remove unnecessary binding

* Don't log warnings twice

* Simplify dump_packet

* Explain default config in constructor

* Remove always-panicking new

* Elide lifetime

* Fix sometimes-unused import

* Implement gettimeofday and __assert_func (#304)

* Implement gettimeofday

* Implement __assert_func

* Reimplement log_timestamp

* Configure burst size on async Device, allow 0 as no maximum (#308)

* Set burst size for async Driver

* Use 0 to indicate no max burst size

* Remove unused import (#310)

* Prevent some leaks & a bit of cleanup (#306)

* Decrease inflight counter if internal tx fails

* Clean up recv_cb

* Avoid leaking AP list when scan is cancelled

* Also register transmit waker when calling receive

* Shorten unsafe block

* Explain and reuse FreeApListOnDrop, split up unsafe block

* Block until mutex can be locked (#318)

* Block until mutex is locked

* Don't drop EspWifiPacketBuffer in a critical section

* Misc small changes (#312)

* Set levels to trace, unify some stuff, implement int disable

* Remove unnecessary paths

* Only check once if random is set, copy impl from esp-hal

* Avoid matching on constant

* Print current time in same line as other arming params

* Simplify tick <-> time conversions

* Work around espflash resolving timer addresses

* Raise compat_timer_setfn level to debug

* Resolve warnings

* Fix malloc pointer mutability

* Simplify import

* Resolve commented question

* Clean up a bunch of timer code, use `heapless::Vec` instead of array of options (#313)

* Fix early timeout when counter overflows

* Store the correct fn pointer type

* Remove wrapper around ets timer functions

* Sort out timer: ets_timer, other pointer types

* Use heapless::Vec to store timers

* Fix and clean up npl

* Fix hal_uart_init_cbs signature

* Queue fixes and cleanups, work queue `->` task spawn (#316)

* Clean up imports

* Clean up queue operations

* Clean up task spawning and running

* Move syslog out of common, implement `%ll{u,d}` (#317)

* Move syslog out of common

* Handle escaped percent sign (%%)

* Handle long longs

* Make sure the scheduling won't start before everything is setup (#324)

* Add some config validations from esp-idf (#325)

* Added support for Wifi scan options (#302)

* I added support for wifi options

* Implement a lot of suggestions

* Update esp-wifi/src/wifi/mod.rs

Co-authored-by: Dániel Buga <bugadani@gmail.com>

* Refactor

* Make it a little more prettier

* Add more documentation

* Update esp-wifi/src/wifi/mod.rs

Co-authored-by: Dániel Buga <bugadani@gmail.com>

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>

* Replace a panic with a compile error (#321)

* Fix fn pointer signatures

* Clean up scoping a bit

* Simplify clock validation

* Make WifiBle option only available when coex is enabled

* Check for wifi and ble if coex is enabled

* Simplify BTDM osi funcs setup

* Xtensa: Set up time slice before switching task, tweak tick rate (#323)

* Set up time slice before switching task

* Make timer code a bit more obvious

* Divide clock cycles by a multiple of 8

* Unify examples (#296)

This PR merges the chip specific examples into one folder, inside the
esp-wifi project.

To simplify building, alias' have been added to
`esp-wifi/.cargo/config.toml` per chip to automatically select the right
target and enable the chip feature.

Add build script detection for invalid features

Fix CI, use build instead of check to detect linker errors

enable async feature of hal, this breaks because of interrupt definition for systimer

upgrade hal rev

upgrade hal rev c6

undo binding modifications

fix esp now

fix esp coex

use released hals, update async examples

sync example names

sync example names

Update examples.md

Document alias

update build alias

* Add a benchmarking example for blocking and async (#328)

* Unify examples

This PR merges the chip specific examples into one folder, inside the
esp-wifi project.

To simplify building, alias' have been added to
`esp-wifi/.cargo/config.toml` per chip to automatically select the right
target and enable the chip feature.

Add build script detection for invalid features

Fix CI, use build instead of check to detect linker errors

enable async feature of hal, this breaks because of interrupt definition for systimer

upgrade hal rev

upgrade hal rev c6

undo binding modifications

fix esp now

fix esp coex

use released hals, update async examples

sync example names

sync example names

Update examples.md

Document alias

update build alias

* Add bench server

* Add bench example

* Add async bench example

* Add bench example to ci

* fmt

* fix CI

* Document bench example

* Use embassy-net 0.2 (#289)

Co-authored-by: Hailey Somerville <hailey@hailey.lol>

* Clean up examples a bit (#332)

* Revise API docs (#330)

* Revise API docs

* Rephrase description of `WifiStack`

* Formatting

* Simplify multitasking (#334)

* AP-STA mode (#299)

* Configure AP-STA mode

* Split up link state waking into two branches

* Add WifiMode::ApSta

* Simplify mode setup

* Deduce wifi mode from config if available

* Rework internals to support AP-STA mode

* Add `new_ap_sta` constructor

* Demote Rx token warning

* Allow using is_sta_enabled and is_ap_enabled

* Disallow certain config changes

* Update readme

* Return capability based on configuration

* Add a default-config constructor for AP-STA

* Shorten unsafe block

* Typestate devices

* Add examples

* Use CCMP instead of TKIP (#338)

* Add basic automated tests (#339)

* Don't enable default features for esp*-hal (#303)

* Add support coex for ESP32C6 (#327)

* Rebase main branch and support coex for esp32c6

* Revert default value of tx_queue_size and add coex feature for esp32c6

* Fixed the formatting issue

* Add features to disable various network protocols (#340)

* Add features for various network protocols

Disable smoltcp if none of them is enabled, as well.  Restructure the
cargo features to make this possible: utils isn't needed unless one of
the protocols is on, but embedded-svc is needed even for sending and
receiving raw frames.

In order to do the latter, we also need a receive and transmit method on
the WifiDevice, rather than using the methods on the smoltcp Device impl
-- and we don't need to give them an Instant.  Copy the implementation.

* Add all combinations of network features to CI

* Document new features

Also fix up a couple references in old ones.

* Tolerate leading v in version string (#348)

* Tolerate leading v in version string

* Pin executor

* Esp32c2 coex (#347)

* Support COEX on ESP32-C2

* Fix script

* Remove WiFi scan from COEX example

* Don't crash on unexpected version string format (#358)

* Prepare release (#343)

* Prepare first release

* Always enable `async` for `bleps`

* Remove obsolete patch

* Fix README.md include (#359)

* Fix README.md include

* Fix links

* add "scan_with_config" method to sync WifiController, like for async (#350)

* add "scan_with_config" method to sync WifiController, like for async

* rename to "scan_with_config_sync", unsure why "scan_n" is fine lol

* Reliably avoid `r_ble_hci_ram_hs_cmd_tx` assert (#362)

* Remove recommendation against LTO (#363)

* Fix broken links (#364)

* Remove embedded-svc feature (#366)

* Make COEX work on ESP-32 (#349)

* Remove big-heap (#367)

* Remove big-heap feature

* Implement get_free_heap_size

* Don't require smoltcp as a dev dependency (#365)

* Don't require smoltcp as a dev dependency

* Document the smoltcp feature

* Some feature/README-related cleanup (#368)

* Clean up embedded-svc feature remnants

* Improve serial jtag section

* Improve feature descriptions

* Label ESP32 COEX as supported (#369)

* Exclude 1.74.0.0 from xtensa vaarg supported compilers (#372)

* Update dependencies, port to portable-atomic (#342)

* Update dependencies, port to portable-atomic

* Drop futures-*

* Add patches

* Make portable-atomic optional

* Don't depend on smoltcp and embedded-svc releases

* Update esp-hal to disallow duplicate versions

* Backtrack on the S2 changes

* Remove features from cargo run aliasses

* Update esp-hal, always use portable-atomic

* H2: Add BLE support (#352)

* H2: Add BLE support

* fix ci

* fix ci 2

* Add H2 into test scripts

* update to latest changes

* revert smoltcp change

* Update smoketest.bat

Co-authored-by: Scott Mabin <scott@mabez.dev>

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>

* Update current support (#381)

* docs: Update current support

* docs: Fix format and typos

* docs: Fix typo (#382)

* Bump esp-hal versions, patch embassy-net (#386)

* Bump esp-hal versions, patch embassy-net

* Make bench.rs example compile again

* Patch all the embassy-* dependencies

* Avoid overwriting HCI buffer until sent (#398)

* Avoid overwriting HCI buffer until sent

* Fix formatting

* move set_isr to chip_specific (#390)

* Reset DHCP socket when the link up is detected (#401)

* Use embassy-net-driver only is esp-wifi, make enet a dev dep (#402)

Also bump enet to 0.3

* Prepare release 0.2.0 (#403)

* Bump version to 0.2.0

* Fix warnings

* Small correction to coex warning message (#404)

* Include coex in list of enabled features for docs.rs (#405)

* Update driver blobs (#410)

* Update driver blobs

* Update README.md

* Don't build embassy-bench for S2 in CI

* Don't build embassy-bench for S2 in CI

* fix(#383): Use a random local port when initializing the wifi stack. (#414)

* Add minimal amount of default features, and instead enable the previously default features only for examples (#420)

* Update everything to use latest `esp-hal` and `embedded-hal-async 1.0.0`, smoltcp to `0.11.0` (#417)

* Update everything to use latest esp-hal

* Change to upstream as PR is merged

* Remove hard dep on backtrace

* Add required feature for heapless

* Update examples

* Update

* update rev

* Remove patches to crates as they are released

* Remove last patch as  is released

* Update changelog

* Prepare release 0.3.0 (#424)

* Bump esp-wifi-sys

* Fix code warning

* Fix test script

* Bump esp-wifi

* Prepare CHANGELOG.md for next release cycle

* Remove "no token" warnings. (#428)

They happen often in normal use, such as downloading/uploading a big file
as fast as possible, and they tank performance if logging is enabled.

* Make embedded svc really optional (#429)

* Make embedded-svc really optional

* Update README.md

* CHANGELOG.md entry

* Performance improvement (#430)

* Improve response times

* Revert "Improve response times"

This reverts commit 77c437a252c8accd4e52b228752c03019b50b60b.

* Fix embassy_bench

* Yield from tx_token/rx_token if no progress can be made otherwise

* CHANGELOG.md entry

---------

Co-authored-by: Karl Rikte <karl.rikte@gmail.com>

* Instead of duplicating the config, we now use const eval to validate the config (#432)

* Update esp-hal etc. (#434)

* Update esp-hal etc.

* Adapt build-aliases

* Fix workflow

* Use published HAL

* Use esp-hal `0.16.1`

* CHANGELOG.md entry

* Prepare release 0.4.0 (#439)

* Fix a compile error when smoltcp can return more than 1 DNS result (#442)

Update the WifiStack::dns_query() return type to match the type returned
by smoltcp, rather than assuming the result size is always 1.

* update for changes in latest esp-hal git (#449)

* Use esp-hal 0.17.0 (#456)

* Bump version, CHANGELOG.md (#458)

* Prepare CHANGELOG.md for next release cycle (#459)

* Prepare CHANGELOG.md for next release cycle

* Fix docs-rs build

* Bump to 0.5.1, make sure docs will build (#462)

* Remove direct embedded-hal v0.2 dependency (#466)

* Remove direct embedded-hal v0.2 dependency

* Add changelog entry.

* Adapt esp-wifi for current HAL

* Move examples to example folder

* Remove dev-dependencies from esp-wifi

* Add bench-server etc.

* Update links in README.md

* Remove useless patch

* Compilable on stable

* Set env-vars used in esp-wifi examples

* Set env-vars used in esp-wifi examples

* Use `esp-build`

* Don't use esp_build::warning

* Fixes after re-checking examples

* Fix workflow file

* Fixes

* Make examples build on stable

* Exclude some examples from H2/S2

* Address review comments

---------

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>
Co-authored-by: Jesse Braham <jesse@beta7.io>
Co-authored-by: Scott Mabin <scott@mabez.dev>
Co-authored-by: Sebastian Lauwers <sebastian.lauwers@gmail.com>
Co-authored-by: Nereuxofficial <37740907+Nereuxofficial@users.noreply.github.com>
Co-authored-by: Lachezar Lechev <elpiel93@gmail.com>
Co-authored-by: Anthony Grondin <104731965+AnthonyGrondin@users.noreply.github.com>
Co-authored-by: Nereuxofficial <nereux@tuta.io>
Co-authored-by: Dániel Buga <bugadani@gmail.com>
Co-authored-by: Sofiane <sofiane.meftah@outlook.fr>
Co-authored-by: Kayo Phoenix <kayo@illumium.org>
Co-authored-by: M4tsuri <me@m4tsuri.com>
Co-authored-by: Ellis Hoag <ellis.sparky.hoag@gmail.com>
Co-authored-by: Paul Liétar <lietarp@gmail.com>
Co-authored-by: Hannes <55623006+umgefahren@users.noreply.github.com>
Co-authored-by: Hailey Somerville <hailey@hailey.lol>
Co-authored-by: Tu Nguyen <126753419+TuEmb@users.noreply.github.com>
Co-authored-by: Bryan Kadzban <github@kadzban.net>
Co-authored-by: Matt H <mhammerly@users.noreply.github.com>
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>
Co-authored-by: Jan Niehusmann <jan@gondor.com>
Co-authored-by: Fan Jiang <ProfFan@users.noreply.github.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
Co-authored-by: Karl Rikte <karl.rikte@gmail.com>
Co-authored-by: Adam Simpkins <adam@adamsimpkins.net>
Co-authored-by: liebman <liebman@zod.com>
Co-authored-by: Onestacked <chrisi.schrefl@gmail.com>
2024-05-24 17:41:59 +00:00
Jesse Braham
49ebc23a6d
Add the esp-backtrace package to the repository (#1583) 2024-05-23 13:52:52 +00:00
Jesse Braham
cc28c3eb09
Add the esp-println package to the repository (#1575)
* Add the `esp-println` package to the repository

* Update esp-println version in README.md

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>
2024-05-23 10:20:41 +01:00
Jesse Braham
5facb759ae
[2/3] Timer abstraction: add OneShotTimer/PeriodicTimer drivers, Timer trait (#1570)
* Add the `Timer` trait, `OneShotTimer` and `PeriodicTimer` types

* `PeriodicTimer` now working for `TIMG`

* `OneShotTimer` now working for `TIMG`

* `OneShotTimer` now working for `SYSTIMER` (plus, some cleanup)

* SYSTIMER now mostly working for ESP32-S2 as well

* Update `timer_interrupt` example and fix clippy lint to make CI happy again

* Update `CHANGELOG.md`

* Make `SYSTIMER` work correctly with `PeriodicTimer`, address some review comments

* Make `Timer::now()` return a `fugit::Instant`
2024-05-23 06:21:12 +00:00
Scott Mabin
ec8308058b
Riscv stable CI (#1491)
* Remove interrupt and thread executor embassy features

* Reserve sw interrupt 3 (4) instead of 0 for multicore systems with the embassy feature enabled

* Add thread mode context id and fix up examples

* Use stable rust for riscv CI

* Add binary-logs feature to 8021504 driver

* Add binary-logs feature to 8021504 driver
2024-05-22 16:36:39 +00:00
Juraj Sadel
76ed67ad35
ESP32-S2: Add SPI Slave support (#1562)
* SPI Slave for ESP32 / ESP32-S2

* CHANGELOG.md

* Clippy...

* Revert ESP32 changes and keep ESP32-S2 only

* changelog

* review comments

---------

Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
2024-05-22 13:21:22 +00:00
Juraj Sadel
60d39e9f33
GPIO: Use Level enum instead of plain bool in constructors (#1574)
* GPIO: Use Level enum instead of plain bool in constructors

* changelog
2024-05-22 12:37:03 +00:00
Björn Quentin
ef290a9a78
Remove pin generics from PARL_IO (#1545)
* Remove pin generics from PARL_IO

* CHANGELOG.md

* Fixes after rebase
2024-05-17 14:54:48 +00:00
Björn Quentin
9edd098da5
De-duplicate DMA transfer implementations (#1550)
* De-duplicate DMA transfer implementations

* CHANGELOG.md

* Renaming

* Fix

* Get rid of the lambda

* Clippy
2024-05-15 16:42:35 +00:00
Jesse Braham
8a1df42309
Add the esp-ieee802154 package to the repository (#1554)
* Add the `esp-ieee802154` package to the repo

* Add examples for `esp-ieee802154` package
2024-05-15 15:22:27 +00:00
Björn Quentin
2faa2654cb
GPIO Refactoring (#1542)
* GPIO Refactoring

* CHANGELOG.md

* Addressed review comments

* Use `Level` instead of plain bool in public API

* Let drivers enable analog functions
2024-05-15 08:49:33 +00:00
Scott Mabin
f32565b4af
Embassy enable thread and interrupt by default, enable embassy when building docs (#1485)
* Remove interrupt and thread executor embassy features

* Reserve sw interrupt 3 (4) instead of 0 for multicore systems with the embassy feature enabled

* Remove uneeded #[feature()] from examples

* Fix HIL tests

* Add thread mode context id and fix up examples

* improve embassy module docs

* changelog

* fixup hil tests

* Fixup usb examples
2024-05-02 15:58:04 +00:00