Wykres commitów

23 Commity (master)

Autor SHA1 Wiadomość Data
Angus Gratton decf8e6a8b all: Remove the "STATIC" macro and just use "static" instead.
The STATIC macro was introduced a very long time ago in commit
d5df6cd44a.  The original reason for this was
to have the option to define it to nothing so that all static functions
become global functions and therefore visible to certain debug tools, so
one could do function size comparison and other things.

This STATIC feature is rarely (if ever) used.  And with the use of LTO and
heavy inline optimisation, analysing the size of individual functions when
they are not static is not a good representation of the size of code when
fully optimised.

So the macro does not have much use and it's simpler to just remove it.
Then you know exactly what it's doing.  For example, newcomers don't have
to learn what the STATIC macro is and why it exists.  Reading the code is
also less "loud" with a lowercase static.

One other minor point in favour of removing it, is that it stops bugs with
`STATIC inline`, which should always be `static inline`.

Methodology for this commit was:

1) git ls-files | egrep '\.[ch]$' | \
   xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/"

2) Do some manual cleanup in the diff by searching for the word STATIC in
   comments and changing those back.

3) "git-grep STATIC docs/", manually fixed those cases.

4) "rg -t python STATIC", manually fixed codegen lines that used STATIC.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-07 14:20:42 +11:00
Angus Gratton 28529351ae rp2: Switch rp2 and drivers to use new event functions.
This commit changes all uses in the rp2 port, and drivers that are
optionally supported by that port.

The old MICROPY_EVENT_POLL_HOOK and MICROPY_EVENT_POLL_HOOK_FAST macros are
no longer used for rp2 builds and are removed (C user code will need to be
changed to suit).

Also take the opportunity to change some timeouts that used 64-bit
arithmetic to 32-bit, to hopefully claw back a little code size.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-12-08 12:49:43 +11:00
Damien George 5b4a2baff6 extmod/machine_uart: Factor ports' UART Python bindings to common code.
This is a code factoring to have the Python bindings in one location, and
all the ports use those same bindings.  For all ports except the two listed
below there is no functional change.

The nrf port has UART.sendbreak() removed, but this method previously did
nothing.

The zephyr port has the following methods added:
- UART.init(): supports setting timeout and timeout_char.
- UART.deinit(): does nothing, just returns None.
- UART.flush(): raises OSError(EINVAL) because it's not implemented.
- UART.any() and UART.txdone(): raise NotImplementedError.

Signed-off-by: Damien George <damien@micropython.org>
2023-10-26 10:46:42 +11: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
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 64556ca049 drivers/cyw43: Include CYW43 config file.
To get definition of CYW43_RESOURCE_ATTRIBUTE.
2023-03-08 00:59:27 +11: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 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
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
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
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
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
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 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
Damien George e83fc3260e drivers/cyw43: Fix to build in nanbox mode. 2019-12-27 22:54:53 +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 7b70ab7258 drivers: Add driver for CYW43xx WiFi SoCs. 2019-06-03 16:47:35 +10:00