summaryrefslogtreecommitdiff
path: root/docs/library
AgeCommit message (Collapse)Author
2023-05-19esp32/esp32_ulp: Enable FSM ULP for S2 and S3 chips.patrick
This commit enables the ULP for the S2 and S3 chips. Note this is the FSM (Finite State Machine) ULP. Signed-off-by: Patrick Joy <patrick@joytech.com.au>
2023-05-19docs/library/espnow: Update espnow docs for WLAN.config(pm=x) options.glenn20
Update docs/library/espnow.rst to add: - guidance on using WLAN.config(pm=WLAN.PM_NONE) for reliable espnow performance while also connected to a wifi access point; - guidance on receiving encrypted messages; - correction for default value of "encrypt" parameter (add_peer()); - guidance on use of ESPNow.irq(): recommand users readout all messages in the buffer each time the callback is called. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2023-05-18rp2: Make rp2_state_machine_exec accept integers.Adam Green
Currently rp2.StateMachine.exec(instr_in) requires that the instr_in parameter be a string representing the PIO assembly language instruction to be encoded by rp2.asm_pio_encode(). This commit allows the parameter to also be of integral type. This is useful if the exec() method is being called often where the use of pre-encoded machine code is desireable. This commit still supports calls like: sm.exec("set(0, 1)") It also now supports calls like: # Performed once earlier, maybe in __init__() assembled_instr = rp2.asm_pio_encode("out(y, 8)", 0) # Performed multiple times later as the PIO state machine is # configured for its next run. sm.exec(assembled_instr) The existing examples/rp2/pio_exec.py and examples/rp2/pio_pwm.py that exercise the rp2.StateMachine.exec() method still work with this change. Signed-off-by: Adam Green <adamgrym@yahoo.com>
2023-05-06esp32,esp8266: Add support to set/get power saving mode of WLAN.glenn20
For esp32 and esp8266 this commit adds: - a 'pm' option to WLAN.config() to set/get the wifi power saving mode; and - PM_NONE, PM_PERFORMANCE and PM_POWERSAVE constants to the WLAN class. This API should be general enough to use with all WLAN drivers. Documentation is also added.
2023-05-04rp2/machine_pwm: Add support for inverting a PWM channel output.robert-hh
Using the invert=True|False keyword option with the constructor or init().
2023-05-04docs: Update the PWM examples based on recent API improvements.robert-hh
This adds the freq and duty_u16 keyword settings to the constructor, and sometimes other details in the PWM section. For mimxrt a clarification regarding the PWM invert argument was added, and for rp2 a few words were spent on PWM output pairs of a channel/slice.
2023-05-01esp32,esp8266: Add support for the Espressif ESP-NOW protocol.Glenn Moloney
ESP-NOW is a proprietary wireless communication protocol which supports connectionless communication between ESP32 and ESP8266 devices, using vendor specific WiFi frames. This commit adds support for this protocol through a new `espnow` module. This commit builds on original work done by @nickzoic, @shawwwn and with contributions from @zoland. Features include: - Use of (extended) ring buffers in py/ringbuf.[ch] for robust IO. - Signal strength (RSSI) monitoring. - Core support in `_espnow` C module, extended by `espnow.py` module. - Asyncio support via `aioespnow.py` module (separate to this commit). - Docs provided at `docs/library/espnow.rst`. Methods available in espnow.ESPNow class are: - active(True/False) - config(): set rx buffer size, read timeout and tx rate - recv()/irecv()/recvinto() to read incoming messages from peers - send() to send messages to peer devices - any() to test if a message is ready to read - irq() to set callback for received messages - stats() returns transfer stats: (tx_pkts, tx_pkt_responses, tx_failures, rx_pkts, lost_rx_pkts) - add_peer(mac, ...) registers a peer before sending messages - get_peer(mac) returns peer info: (mac, lmk, channel, ifidx, encrypt) - mod_peer(mac, ...) changes peer info parameters - get_peers() returns all peer info tuples - peers_table supports RSSI signal monitoring for received messages: {peer1: [rssi, time_ms], peer2: [rssi, time_ms], ...} ESP8266 is a pared down version of the ESP32 ESPNow support due to code size restrictions and differences in the low-level API. See docs for details. Also included is a test suite in tests/multi_espnow. This tests basic espnow data transfer, multiple transfers, various message sizes, encrypted messages (pmk and lmk), and asyncio support. Initial work is from https://github.com/micropython/micropython/pull/4115. Initial import of code is from: https://github.com/nickzoic/micropython/tree/espnow-4115.
2023-04-27all: Fix spelling mistakes based on codespell check.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-04-26extmod/btstack: Include value handle in client read/write events.Jim Mussared
This replaces the previous pending operation queue (that used to also be shared with pending server notify/indicate ops) with a single pending operation per connection. This allows the value handle to be correctly passed to the Python-level events. Also re-structure GATT client event handling to simplify the packet handler functions. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26extmod/modbluetooth: Merge gatts_notify/indicate implementation.Jim Mussared
Makes gatts_notify and gatts_indicate work in the same way: by default they send the DB value, but you can manually override the payload. In other words, makes gatts_indicate work the same as gatts_notify. Note: This removes support for queuing notifications and indications on btstack when the ACL buffer is full. This functionality will be reimplemented in a future commit. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-21rp2/machine_i2c: Add timeout parameter for machine.I2C().David (Pololu)
This commit adds support for the `timeout` keyword argument to machine.I2C on the rp2 port, following how it's done on other ports. The main motivation here is avoid the interpreter crashing due to infinite loops when SDA is stuck low, which is quite common if the board gets reset while reading from an I2C device. A default timeout of 50ms is chosen because it's consistent with: - Commit a707fe50b085ec83722106609f6fd219faf9f030 which used a timeout of 50,000us for zero-length writes on the rp2 port. - The machine.SoftI2C class which uses 50,000us as the default timeout. - The stm32 port's hardware I2C, which uses 50,000us for I2C_POLL_DEFAULT_TIMEOUT_US. This commit also fixes the default timeout on the esp32 port to be consistent with the above, and updates the documentation for machine.I2C to document this keyword argument.
2023-03-09rp2/modrp2: Disable other core, shorten delay to 8us in bootsel_button.David Grayson
This function seems to work fine in multi-core applications now. The delay is now in units of microseconds instead of depending on the clock speed, and is adjustable by board configuration headers. Also added documentation.
2023-03-01docs/library/network: Update docs for network.country, network.hostname.Jim Mussared
Also marks wlan.config(hostname) as deprecated. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-01-19docs/library/machine.Timer: Add freq argument to machine.Timer.LiaoJingyi_winY7kp
Based on and tested on the rp2 port. Signed-off-by: Liao Jingyi <liaojingyi2@gmail> Signed-off-by: Damien George <damien@micropython.org>
2023-01-13docs/library/socket: Use correct sockaddr variable name.Dorukyum
Signed-off-by: Dorukyum <doruk.ak@hotmail.com>
2023-01-12docs/library/rp2.StateMachine: Expand put() documentation.Paul Warren
Document that put() can also accept arrays/bytearrays as values. Fixes issue #10465. Signed-off-by: Paul Warren <pdw@ex-parrot.com>
2022-12-15renesas-ra: Add the UART methods uart.txdone() and uart.flush().robert-hh
This required to add two functions down the stack to uart.c and ra.sci.c. - One for telling, whther the transmission is busy. - One for reporting the size of the TX buffer. Tested with a EK-RA6M2 board.
2022-12-07docs/library/neopixel: Update GitHub URL for neopixel.py link.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-12-06docs/library/struct: Embed format tables.Laurens Valk
Also add note about long support. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-12-06docs/library/struct: Fix buffer argument description.Laurens Valk
The buffer is the data in this case. There is no buffer argument. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-11-18stm32/i2c: Fix I2C frequency calc so it doesn't exceed requested rate.yn386
Prior to this commit, the actual I2C frequency can be faster than specified one and it may exceed the I2C's specification for Fast Mode. The frequency of SCL should be less than or equal to 400KHz in Fast Mode. This commit fixes this issue for F4 MCUs by rounding up the division in the frequency calculation.
2022-11-17docs/library/framebuf: Clarify docs for blit regarding palette.TPReal
Clarified the behaviour when both key and palette are specified.
2022-11-17mimxrt/network: Rename the argument clock_mode to ref_clk_mode.robert-hh
The definitions for LAN.IN and LAN.OUT are kept, but in the code Pin.IN and Pin.OUT can be used as well as values for the ref_clk_mode argument.
2022-11-16docs/library/uasyncio: Describe restriction on ThreadSafeFlag.Peter Hinch
As per Issue #7965, this class does not work on the Unix build.
2022-11-15docs/library/pyb.CAN: Update the recv example to take a 5-tuple.Sky
A supplement to commit 5cdf9645711cc12b45e602ef5795c33895116fc4
2022-11-15docs/library/array: Add docs for dunder methods.Howard Lovatt
Signed-off-by: Damien George <damien@micropython.org>
2022-11-08docs/library/machine: Add machine.memX to docs with brief example.Matt Trentini
2022-09-09extmod/modbluetooth: Replace def_handle with end_handle in char IRQ.Jim Mussared
This is technically a breaking change, but: a) We need the end handle to do descriptor discovery properly. b) We have no possible use for the existing definition handle in the characteristic result IRQ. None of the methods can use it, and therefore no existing code should be using it in a way that changing it to a different integer value should break. Unfortunately NimBLE doesn't make it easy to get the end handle, so also implement a mechanism to use the following characteristic to calculate the previous characteristic's end handle. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-31docs/library/machine.UART: Add docs for uart.flush() and uart.txdone().robert-hh
2022-08-31docs/library/machine.I2C: Add a note about I2C pull-up resistors.robert-hh
Quite regularly users complain about unexpected behavior of I2C, calling it a bug, when in fact the trouble is caused by missing pull-up resistors. So this commit adds a note to the documentation, in the slim hope that people will find and read it.
2022-08-26docs/library/micropython: Fix spelling of compiler.Laurens Valk
Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-08-26docs/library: Fix nested rst styles not rendering.Laurens Valk
These can't be nested, so apply styling separately. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-08-26docs/library/machine.UART: Add notes about UART init and deinit.Tomasz 'CeDeROM' CEDRO
* `init()` can be called multiple times to reconfigure UART. * After `deinit()` it is impossible to call `init()` again. Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2022-08-26drivers/cc3000: Remove CC3000 WiFi driver files.Damien George
It's no longer used by any port. Signed-off-by: Damien George <damien@micropython.org>
2022-08-23rp2/machine_wdt: Check for the maximum timeout value of watchdog.robert-hh
The value will be checked for timeout <= 8388. Notes were added to the documentation.
2022-08-19extmod/modframebuf: Add polygon drawing methods.Mat Booth
Add method for drawing polygons. For non-filled polygons, uses the existing line-drawing code to render arbitrary polygons using the given coords list, at the given x,y position, in the given colour. For filled polygons, arbitrary closed polygons are rendered using a fast point-in-polygon algorithm to determine where the edges of the polygon lie on each pixel row. Tests and documentation updates are also included. Signed-off-by: Mat Booth <mat.booth@gmail.com>
2022-08-19extmod/modframebuf: Add ellipse drawing method.Peter Hinch
2022-08-19extmod/modframebuf: Add fill argument to rect().Jim Mussared
We plan to add `ellipse` and `poly` methods, but rather than having to implement a `fill_xyz` version of each, we can make them take an optional fill argument. This commit add this to `rect` as a starting point. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-12extmod/uasyncio: Add clear method to ThreadSafeFlag.Ned Konz
This is useful in situations where the ThreadSafeFlag is reused and needs to be cleared of any previous, unwanted event. For example, clear the flag at the start of an operation, trigger the operation (eg an I2C write), then (a)wait for an external event to set the flag (eg a pin IRQ). Further events may trigger the flag again but these are unwanted and should be cleared before the next cycle starts.
2022-08-11docs/library/rp2: Fix pull_thresh docs to use pull instead of push.Nathan Hendler
2022-07-29docs/library/pyb.Timer: Document how to use BKIN pin with example.chrismas9
Document how to connect the Timer block BRK_IN to a physical Pin alternate function. Add an example of PWM Motor drive using complementary outputs with dead time and break input to kill the PWM and generate a callback. Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-07-29docs/library/pyb.Pin: Add Pin.ALT constant.chrismas9
Some Pin alternate functions are inputs, for example, timer capture and break inputs. In Pyb.Pin the only way to set alt mode is with Pin.AF_PP or Pin.AF_OD. It is not intuitive to use an output mode to configure an input. Pin.ALT is used in the machine.Pin class and works in pyb.Pin. The examples are changed to use Pin.ALT because TIM2_CH3 can be a capture input or pulse output. Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-07-29docs/library/pyb.Pin: Fix out-of-context paragraphs, and AF_PP typo.chrismas9
Remove out of context callback paragraph, it was part of the wipy docs. And move the paragraph about PULL_UP/PULL_DOWN resistor values to within the init() method docs. Also fix pull-pull -> push-pull. Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-07-29docs/library/time: Provide more info about which epoch is used.Peter Hinch
Some embedded targets use 1970 epoch.
2022-07-23docs/library/neopixel: Add note that neopixel is included in rp2 builds.Andrew Scheller
2022-07-20extmod/modussl_mbedtls: Implement cert_reqs and cadata arguments.Carlosgg
Add cert_reqs and cadata keyword-args to ssl.wrap_socket() and ssl.CERT_NONE, ssl.CERT_OPTIONAL, ssl.CERT_REQUIRED constants to allow certificate validation. CPython doesn't accept cadata in ssl.wrap_socket(), but it does in SSLContext.load_verify_locations(), so we use this name to at least match the same name in load_verify_locations(). Add docs for these new arguments, as well as docs for the existing server_hostname argument which is important for certificate validation. Tests are added as well. Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2022-07-05esp32,esp8266: Rename WLAN dhcp_hostname config to hostname.IhorNehrutsa
But retain old name for backwards compatibility.
2022-06-24docs/library/bluetooth: Add link to aioble.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-24extmod/uasyncio: Implement stream read(-1) to read all data up to EOF.Damien George
Fixes issue #6355. Signed-off-by: Damien George <damien@micropython.org>
2022-06-23esp32/modesp32: Add wake_on_ulp() so ULP can wake CPU from deepsleep.Christian Walther
Add esp32.wake_on_ulp() to give access to esp_sleep_enable_ulp_wakeup(), which is needed to allow the ULP co-processor to wake the main CPU from deep sleep.