Commit Graph

193 Commits

Author SHA1 Message Date
iabdalkader 279e2561f2 drivers/esp_hosted_hal: Add support for WiFI LED activity indicator.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-10-02 14:47:31 +02:00
iabdalkader a43e13c67b drivers/esp-hosted: Fix MTU size.
The maximum SPI frame payload is 1600 - header_size.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-10-02 14:47:31 +02:00
iabdalkader 379b583b2f drivers/esp_hosted: Fix pin IRQ.
This patch reinstalls the pin IRQ handler on WiFi init, as some
ports disable/remove pin IRQs on soft-reboot, or deinit the pins.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-10-02 14:47:31 +02:00
iabdalkader d30f61ba0d drivers/ninaw10/nina_bt_hci: Make some minor fixes to HCI driver.
Fixes are:
- Reset the module first before changing GPIO1 direction.
- Skip spurious bytes received after reset.
- Use HCI UART ID and baudrate when reinitializing UART.
- Disable all printf output which causes unit-tests to fail.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-15 16:47:19 +10:00
iabdalkader ecedd78302 drivers/esp-hosted: Add host driver for ESP-Hosted firmware.
This is a host driver for ESP32 chips running the esp-hosted firmware,
which turns ESP32s into a WLAN/BT co-processor.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14 23:51:30 +10:00
iabdalkader a453b4f31d drivers/cyw43: Make the CYW43 Bluetooth HCI driver more portable.
This commit allows other ports to reuse the CYW43 HCI driver, by replacing
all Bluetooth UART and control named pins with defines in config files and
using `mpbthci` abstract functions (i.e. `mp_bluetooth_hci_*`) instead of
the STM32 specific UART functions.

Note: the function `cywbt_wait_cts_low` does not need to switch the CTS
pin from alternate function to GPIO to read it.  At least on stm32, mimxrt
it's possible to just read the pin input.  For example, see the STM32F7
RM0410 section 6.3.11, and the `SION` for IMXRT.  So this function can
also be available for other ports if the pin mode switching is removed.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-01 00:02:00 +10:00
robert-hh 2b5a5a0f35 samd/samd_qspiflash: Add QSPI flash driver and configure it accordingly.
The QSPI driver provides the interface for using an on-board QSPI flash for
the filesystem.  It provides the same methods as the driver for the
internal flash and uses the same name.  Therefore, only one of the drivers
for internal flash, SPI flash and QSPI flash must be enabled at a time.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-06-06 00:49:36 +10:00
Damien George b1229efbd1 all: Fix spelling mistakes based on codespell check.
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 18:03:06 +10:00
iabdalkader 9025671e72 drivers/ninaw10: Fix ESP32 input-only pins.
ESP32 pins 34, 35, 36 and 39 are input only, and should not be configured
as output.
2023-04-04 15:16:44 +10:00
iabdalkader 46c432eaa6 drivers/ninaw10: Add missing external pins 34 and 39.
There are 2 more external pins controlled by the Nina module.
2023-03-08 00:59:36 +11:00
iabdalkader 64556ca049 drivers/cyw43: Include CYW43 config file.
To get definition of CYW43_RESOURCE_ATTRIBUTE.
2023-03-08 00:59:27 +11:00
iabdalkader 7a817a3481 drivers/ninaw10: Fix machine_pin GPIO read. 2023-03-06 12:46:49 +01:00
iabdalkader fb65ef48b4 drivers/cyw43: Use a different baudrate for BT firmware download.
Allow boards to define a specific firmware for Bluetooth firmware download,
or none at all.
2023-03-02 22:30:04 +11:00
Jim Mussared bad0098a49 stm32: Update to use the open-source lib version of cyw43-driver.
This removes the previous WiFi driver from drivers/cyw43 (but leaves behind
the BT driver), and makes the stm32 port (i.e. PYBD and Portenta) use the
new "lib/cyw43-driver" open-source driver already in use by the rp2 port.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-03-01 01:27:12 +11:00
iabdalkader e9335e4dea drivers/cyw43: Use board-defined BLE UART secondary baudrate.
The secondary baudrate was defined by boards but never used in this driver.
2023-02-24 12:40:58 +11:00
iabdalkader 7d01f38170 drivers/ninaw10: Implement machine.Pin external pin controls. 2023-01-16 11:44:28 +11:00
Damien George b042fd5120 drivers/bus: Change QSPI read_cmd signature to return an error code.
Signed-off-by: Damien George <damien@micropython.org>
2022-12-09 13:25:18 +11:00
Andrew Leech 7ee5afe8d1 drivers/bus: Detect QSPI transfer errors and pass up to spiflash driver.
This changes the signatures of QSPI write_cmd_data, write_cmd_addr_data and
read_cmd_qaddr_qdata so they return an error code.  The softqspi and stm32
hardware qspi driver are updated to follow this new signature.  Also the
spiflash driver is updated to use these new return values.

Signed-off-by: Damien George <damien@micropython.org>
2022-12-09 13:25:18 +11:00
iabdalkader b9c1e4c205 drivers/ninaw10: Connect to WiFi asynchronously.
Before this patch, WiFi connection was blocking, and could raise exceptions
if the connection failed for any reason (including timeouts).  This doesn't
match the behavior of other WiFi modules, which connect asynchronously, and
requires handling of exceptions on connect.  This change makes `connect()`
work asynchronously by scheduling code to poll connection status, and
handle reconnects (if needed), and return immediately without blocking.
2022-11-16 09:46:43 +11:00
Jim Mussared 94beeabd2e py/obj: Convert make_new into a mp_obj_type_t slot.
Instead of being an explicit field, it's now a slot like all the other
methods.

This is a marginal code size improvement because most types have a make_new
(100/138 on PYBV11), however it improves consistency in how types are
declared, removing the special case for make_new.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19 19:06:15 +10:00
Jim Mussared a52cd5b07d py/obj: Add accessors for type slots and use everywhere.
This is a no-op, but sets the stage for changing the mp_obj_type_t
representation.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19 19:06:07 +10:00
Jim Mussared 24678fe452 drivers: Remove drivers that are now in micropython-lib.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-08 11:27:05 +10:00
Damien George 655c29351a drivers/display: Don't include tests by default.
The tests can be copied to the board if needed.

Also update the docs to reflect this change.

Signed-off-by: Damien George <damien@micropython.org>
2022-09-06 12:09:20 +10:00
Jim Mussared 203dae41fb all: Update all manifest.py files to use new features.
Changes in this commit:
- Manifest include's now use the directory path where possible (no longer
  necessary to include the manifest.py file explicitly).
- Add manifest.py for all drivers and components that are referenced by
  port/board manifests.
- Replace all uses of freeze() with package()/module(), except for port and
  board modules.
- Use opt=3 everywhere, for consistency and to reduce code size.
- Use require() instead of include() for all micropython-lib references.
- Remove support for optional board-level manifest.py in mimxrt port, to
  make it behave the same as other ports (the board must set
  FROZEN_MANIFEST to a custom manifest.py, which can optionally include the
  default, port-level manifest).
- Also reinstates modules that were accidentally removed from the esp8266
  512k build in fbe9417b90.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
2022-09-05 18:43:18 +10:00
Damien George 7d3f4b23dc drivers/cc3000: Remove CC3000 WiFi driver files.
It's no longer used by any port.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-26 12:51:37 +10:00
robert-hh 71dcb21e24 drivers/wiznet5k: Remove old Wiznet driver.
It has been replaced by the submodule lib/wiznet5k.
2022-08-23 15:00:00 +10:00
Kyuchumimo bfc63a5c84 drivers/sdcard: Add delay in init_card_v1 to make timeout work.
This now follows how init_card_v2 works.
2022-08-11 14:32:22 +10:00
iabdalkader b6c2196fbd drivers/cyw43: Allow configuring the netif/mDNS hostname.
Allow boards to configure/override the default hostname used for netif and
mDNS.
2022-08-06 00:30:45 +10:00
Tim Gates f736afb577 drivers,ports: Fix a few typos in comments.
Fixes:
- Should read `definitions` rather than `defintions`.
- Should read `resolution` rather than `resoultion`.
- Should read `inefficient` rather than `inefficent`.
- Should read `closed` rather than `closded`.

Signed-off-by: Tim Gates <tim.gates@iress.com>
2022-07-23 23:24:24 +10:00
Jim Mussared 4cf9928902 cc3200: Fix various array-based compiler warnings.
1. Add -Wno-array-bounds to avoid false positive on gcc 12.1; see related
   issue #8685.
2. Remove always-true not-NULL-check (Msg.Rsp.Args.Common.Bssid is an array
   not a pointer).
3. Fix pointer-to-freed-stack in wlan_set_security.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-21 16:26:04 +10:00
Jim Mussared a053827084 extmod/network_ninaw10: Move ninaw10 root pointer registrations here.
Originally in drivers/ninaw10/nina_wifi_bsp.c but that isn't a QSTR source.

Also remove outdated commment about root pointers in mpconfigport.h.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-21 16:21:50 +10:00
David Lechner ac86e8449a drivers/ninaw10/nina_wifi_bsp: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register mp_wifi_spi, mp_wifi_timer
and mp_wifi_sockpoll_list and removes the same from all mpconfigport.h.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:49:28 +10:00
iabdalkader 474c47d595 drivers/lps22h: Use machine.idle for power saving.
All machine modules should have an idle function.
2022-07-08 12:38:38 +10:00
iabdalkader 7d32b770f2 drivers/lps22h: Add LPS22HB/HH pressure sensor driver. 2022-07-07 23:54:00 +10:00
iabdalkader 6c07e9eb27 drivers/lsm9ds1: Add LSM9DS1 IMU driver. 2022-07-07 23:53:31 +10:00
iabdalkader fc6d989f8c drivers/hts221: Add HTS221 humidity sensor driver. 2022-07-07 23:53:11 +10:00
Damien George ee9feacc00 drivers/sdcard: Fix address calculation on v2 SDSC cards.
For v2 cards that are standard capacity the read/write/erase commands take
byte address values.  Use the result of CMD58 to distinguish SDSC from
SDHC/SDXC.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-10 12:56:31 +10:00
Damien George 203b98c42b drivers/sdcard: Make ioctl(4), ioctl(5) return num blocks, block size.
For CSD v1.0 the computed size is in bytes, so convert it to number of
512-byte blocks, and then ioctl(4) will return the correct value.

Also implement ioctl(5) to return the block size, which is always 512.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-10 12:56:30 +10:00
Yukai Li ab6ad86793 drivers/sdcard: Fix CSD version 1.0 device size calculation.
Signed-off-by: Yukai Li <yukaili.geek@gmail.com>
2022-06-10 12:56:15 +10:00
iabdalkader 364569d25f drivers/lsm6dsox: Add support for SPI mode. 2022-06-03 01:24:51 +10:00
Damien George 54f1694ab6 drivers/bus: Rename MP_SPI_ADDR_IS_32B to MICROPY_HW_SPI_ADDR_IS_32BIT.
And allow it to be configured externally, if needed.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
iabdalkader 0bdfceacbe extmod/network_ninaw10: Add support for socket events callback. 2022-05-26 11:15:07 +10:00
iabdalkader be83bdf9ec drivers/ninaw10: Update driver to support firmware 1.5.0.
* Firmware 1.5.0 introduces a new BSD-like sockets ABI,
which improves the integration with MicroPython.
2022-05-25 16:05:50 +02:00
Takeo Takahashi 86e35178e6 drivers/dht/dht.py: Change default import module as machine.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29 12:29:07 +09:00
iabdalkader 52c2580a40 drivers/ninaw10: Fix isconnected to return False when inactive.
If isconnected is called before active, it returns -1, which causes
mp_obj_new_bool return True, indicating the module is connected.
2022-04-20 15:40:52 +10:00
robert-hh 56b331ace6 drivers/codec: Add driver for the WM8960 codec.
This codec is assembled for the MIMXRT1xxx_DEV boards and available for
WM8960 breakout boards as well.

The driver itself has been tested as working with the MIMXRT boards and a
Sparkfun WM6890 breakout board.  It implements the initialization, basic
methods and some enhanced methods like 3D, ALC, soft-mute and deemphasis.
2022-04-04 16:31:17 +10:00
robert-hh 9c05f3aa1d drivers/sdcard: Allow setting the final SPI baudrate.
This baudrate is supplied in the constructor. The default is 1320000 as
before.

Example:

    sd = sdcard.SDCard(spi, cs, baudrate=20_000_000)
2022-02-18 14:37:44 +11:00
iabdalkader 465b74e78d drivers/ninaw10: Add NIC-level ioctl function.
This commit adds support in the driver for irregular commands.  It
currently supports setting GPIO pin mode, and GPIO pin read/write value.
2022-02-18 14:35:26 +11:00
iabdalkader 1aac151d68 drivers/ninaw10: Return standard error numbers. 2022-01-21 13:35:05 +11:00
iabdalkader e401ff8935 drivers/ninaw10: Fix timeout handling to match modusocket. 2022-01-21 13:31:41 +11:00