Commit Graph

150 Commits

Author SHA1 Message Date
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
iabdalkader
981664fd07 drivers/ninaw10: Add function to check socket state/data availability. 2022-01-21 13:30:13 +11:00
iabdalkader
12f9f93b39 drivers/ninaw10/nina_wifi_drv: Fix DNS resolution.
- The wrong ACK is returned and checked.
- Send secondary DNS to google.
2022-01-06 14:37:34 +11:00
iabdalkader
908e4cf5c3 rp2: Add support for DHT11 and DHT22 sensors. 2022-01-06 14:00:03 +11:00
iabdalkader
b65d17fced drivers/ninaw10: Fix BSSID byte order, and add null byte to ESSID.
- Fix the BSSID byte order from scan and netinfo.
- Make sure ESSID from netinfo is null terminated.
2021-11-19 15:41:26 +11:00
Jim Mussared
841eeb158e drivers/neopixel: Avoid heap alloc in fill().
Previously the use of `range(start,stop,step)` caused an allocation.
Replace with while loop.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-19 15:37:06 +11:00
iabdalkader
f082793ac4 drivers/lsm6dsox: Add LSM6DSOX driver and examples. 2021-11-16 15:05:00 +11:00
iabdalkader
43079aaf86 drivers/ninaw10: Add ublox Nina-W10 WiFi/BT module driver.
- Add WiFi/BT drivers for ublox Nina-W10 (esp32 based) module.
- Add ublox Nina-W10 Python module in extmod.
2021-11-13 23:01:03 +11:00
robert-hh
e7572776c3 mimxrt: Add dht_readinto() to the mimxrt module, and freeze dht.py.
The change affects dht.py from the drivers directory as well to include the
logic for the mimxrt port.
2021-10-25 23:49:28 +11:00
Damien George
30691ed2a1 drivers/cyw43: Make wifi join fail if interface is not active.
Otherwise the Python network object continues to report that it is
attempting to connect.

Also make the return error code consistent with wifi scan.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 13:00:11 +10:00
Damien George
52a78e6965 drivers/cyw43: Fix cyw43_deinit so it can be called many times in a row.
This makes sure deinit() can be called on the interface many times without
error, and that the state of the driver is fully reset.

Fixes issue #7493.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 13:00:11 +10:00
Jim Mussared
e9a26791e5 drivers/neopixel: Reduce code size of driver.
Saves 71 bytes of bytecode.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-30 23:26:45 +10:00
Jim Mussared
d63b287c85 drivers/neopixel: Optimize fill() for speed.
This makes fill() about 7x faster (PYBV11 and PYBD_SF6) for the cost of +40
bytes of bytecode (or 120 bytes text).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-30 23:26:29 +10:00
Jim Mussared
62fd450e62 drivers/neopixel: Add common machine.bitstream-based neopixel module.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Damien George
136369d72f all: Update to point to files in new shared/ directory.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-12 17:08:10 +10:00
Mike Causer
bc7822d8e9 drivers/display/ssd1306.py: Add support for 72x40 displays.
The 72x40 OLED requires selecting the internal IREF, as opposed to the
default external IREF.  This is an undocumented feature in the SSD1306
datasheet, but is present in the SSD1315 datasheet.  It's possible the
72x40 OLED is actually using the newer SSD1315 controller.  Sending the
IREF select command to SSD1306 displays has no effect on them, so it's
added to the init_display() instead of wrapping in an "if width = 72".

Also tested on a 128x64 OLED using the SSD1315 controller (smaller ribbon
cable) and the proposed change has no effect on the display, as the module
comes with the correct current limiting resistor.  Internal and external
IREF work the same.

Fixes issue #7281.
2021-06-17 18:54:32 +10:00
Mike Causer
9eea51b730 drivers/display/ssd1306.py: Add rotate method.
And clean up (make more efficient) display set-up commands.
2021-05-06 15:57:19 +10:00
iabdalkader
0d4eb15392 drivers/cyw43/cywbt: Remove hard-coded UART6 alternate function setting. 2021-04-30 10:16:27 +10:00
iabdalkader
d74e2aca3e drivers/cyw43/cywbt: Add compile option for RF switch. 2021-04-30 10:15:59 +10:00
iabdalkader
d3eb6d68a3 drivers/cyw43/cyw43_ctrl: Use new sdio enable API functions.
This removes any references to a specific SDMMC instance, making the driver
more generic/portable.
2021-04-30 01:12:18 +10:00
Damien George
a1bc32d8a8 drivers/sdcard: Add sleep_ms(1) delay in SDCard.readinto sync loop.
So this driver works on faster MCUs (that run this loop fast) with older,
slower SD cards.

Fixes issue #7129.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-23 23:44:37 +10:00
Damien George
e43a74a4db drivers/memory/spiflash: Add MICROPY_HW_SPIFLASH_ENABLE_CACHE option.
This only needs to be enabled if a board uses FAT FS on external SPI flash.
When disabled (and using external SPI flash) 4k of RAM can be saved.

Signed-off-by: Damien George <damien@micropython.org>
2020-12-18 13:39:32 +11:00
Jim Mussared
ed14435a8e extmod/modbluetooth: Refactor stack/hci/driver/port bindings.
Previously the interaction between the different layers of the Bluetooth
stack was different on each port and each stack.  This commit defines
common interfaces between them and implements them for cyw43, btstack,
nimble, stm32, unix.
2020-09-08 11:41:31 +10:00
stijn
40ad8f1666 all: Rename "sys" module to "usys".
This is consistent with the other 'micro' modules and allows implementing
additional features in Python via e.g. micropython-lib's sys.

Note this is a breaking change (not backwards compatible) for ports which
do not enable weak links, as "import sys" must now be replaced with
"import usys".
2020-09-04 00:10:24 +10:00
robert-hh
8680a74595 drivers/display/ssd1306.py: Change the SET_COM_PIN_CFG setting.
Making it more specific to use 0x02 for display with an aspect ratio > 2
(resolutions 96x16 and 128x32) and 0x12 for all other sizes as recommended
by @mcauser.  Tested with a 64x32 display which did not work before.
2020-04-07 13:42:37 +10:00
Jim Mussared
def76fe4d9 all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
Andreas Motl
fbfea3b440 drivers/onewire: Fix undefined variable errors.
On CPython, and with pylint, the variables MATCH_ROM and SEARCH_ROM are
undefined.  This code works in MicroPython because these variables are
constants and the MicroPython parser/compiler optimises them out.  But it
is not valid Python because they are technically undefined within the scope
they are used.

This commit makes the code valid Python code.  The const part is removed
completely because these constants are part of the public API and so cannot
be moved to the global scope (where they could still use the MicroPython
const optimisation).
2020-03-25 01:09:14 +11:00
Damien George
894c550c86 stm32: Refactor bluetooth stack/hci/driver bindings.
This makes a cleaner separation between the: driver, HCI UART and BT stack.
Also updated the naming to be more consistent (mp_bluetooth_hci_*).

Work done in collaboration with Jim Mussared aka @jimmo.
2020-03-10 01:53:42 +11:00
Damien George
69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Peter Hinch
d2f22ea953 drivers/nrf24l01: Change pipe addrs in test to match Arduino addrs.
These addresses were initially chosen to match the nRF24 Arduino library
examples but they are byte-reversed.  So change them to be on-air
compatible with the Arduino library.

Also, the data sheet for the nRF24 says that RX data pipes 1-5 must share
the same top 32-bits, and must differ only in the LSbyte.  The addresses
used here (while correct because they are on TX pipe and RX pipe 0) are
misleading in this sense, because it looks like they were chosen to share
the top 32-bits per the datasheet.
2020-02-16 23:26:34 +11:00
Damien George
d494e47855 drivers/cyw43: Return early from cyw43_wifi_set_up if wifi_on fails. 2020-01-31 20:46:35 +11:00
Damien George
5de55e8fb4 drivers/cyw43: Include stdio.h in files that use printf. 2020-01-31 20:46:10 +11:00
Andrew Leech
30501d3f54 drivers, stm32: Support SPI/QSPI flash chips over 16MB.
With a SPI flash that has more than 16MB, 32-bit addressing is required
rather than the standard 24-bit.  This commit adds support for 32-bit
addressing so that the SPI flash commands (read/write/erase) are selected
automatically depending on the size of the address being used at each
operation.
2020-01-30 13:18:38 +11:00
Damien George
e83fc3260e drivers/cyw43: Fix to build in nanbox mode. 2019-12-27 22:54:53 +11:00
Damien George
cd9de63c0e drivers/wiznet5k: Allow selecting maximum fixed buffer size for MACRAW.
Enabling WIZCHIP_USE_MAX_BUFFER will make the TX/RX buffers the maximum
available size, for use with MACRAW mode.
2019-12-13 12:34:42 +11:00
Jeremy Herbert
4f0f3dfb41 drivers/sdcard: Raise exception on timeout of readinto.
Otherwise the code can get stuck in an infinite loop if the SD card fails
to respond to a read.
2019-11-06 11:34:02 +11:00
Damien George
5954387858 drivers/onewire/ds18x20.py: Add support for DS1822 sensor.
DS1822P sensors behave just like the DS18B20 except for the following:
- it has a different family code: 0x22
- it has only the GND and DQ pins connected, it uses parasitic power from
  the data line

Contributed by @nebelgrau77.
2019-10-16 14:28:13 +11:00
Damien George
7418dbf12d drivers/cyw43: Add low-level CYW43xx Bluetooth HCI UART driver. 2019-10-01 09:50:48 +10:00
Damien George
8cde5faedd drivers/memory/spiflash: Add support to put SPI flash in sleep mode. 2019-07-03 01:27:33 +10:00
Damien George
7b70ab7258 drivers: Add driver for CYW43xx WiFi SoCs. 2019-06-03 16:47:35 +10:00
Damien George
02afc0d241 drivers/display/ssd1306.py: Change to use new i2c.writevto() method.
Fixes issue #3482.
2019-05-20 15:06:39 +10:00
Andrew Leech
2ed2ec1711 drivers/memory/spiflash: Rework wait_sr to fix uninit'd variable 'sr'. 2019-03-08 23:11:13 +11:00
Damien George
f102ac54e9 drivers/dht: Allow open-drain-high call to be DHT specific if needed.
Some ports (eg esp8266) need to have specific behaviour for driving a DHT
reliably.
2019-01-22 00:23:05 +11:00
Peter Hinch
40a7e8c472 drivers/sdcard: Remove debugging print statement in ioctl method. 2018-09-20 16:54:58 +10:00