OpenVoiceOS/buildroot-external/package/python-smbus2/python-smbus2.mk

15 lines
534 B
Makefile
Raw Normal View History

2021-05-05 11:09:27 +02:00
################################################################################
#
# python-smbus2
#
################################################################################
[RPI] Refactor SPI and GPIO handling for XVF3510 initialization This commit significantly overhauls the script for setting the XVF3510 board to boot from SPI slave mode and for loading a binary file. The refactor not only aims at improving code readability, maintainability, and robustness but also addresses compatibility issues with the latest Raspberry Pi models, specifically the Raspberry Pi 5, which does not support the RPi.GPIO library. Changes made: - Switched from `smbus` to `smbus2` for I2C communication, offering a more modern and robust interface. - Replaced `RPi.GPIO` and `spidev` with `digitalio` and `busio` from the `adafruit_blinka` library, enhancing cross-platform compatibility and providing a more Pythonic API for GPIO and SPI operations. - Introduced type annotations for function signatures, improving code readability and type safety. - Added exception handling around I2C operations and file reading, increasing the script's robustness by gracefully handling potential errors. - Defined global variables for GPIO pin configurations, making the code cleaner and easier to modify for different setups. - Encapsulated GPIO setup and reset logic into dedicated functions (`setup_direct_gpio`), streamlining the main logic flow and separating concerns. - Modularized SPI setup (`setup_spi`) and data transmission logic (`send_data_over_spi` and `handle_block_transfer`), enhancing code organization and maintainability. Benefits: - The use of `smbus2` and `adafruit_blinka` libraries modernizes the script and may improve compatibility with a wider range of devices and future Python versions. - Type annotations and structured exception handling make the script more understandable and safer to execute, reducing the risk of runtime errors. - The refactoring into more granular functions and the introduction of global variables for configuration parameters make the script easier to read, modify, and extend. - Improved error handling ensures that the script fails gracefully, providing clear error messages and avoiding potential resource leaks.
2024-02-04 00:24:43 +01:00
PYTHON_SMBUS2_VERSION = 0.4.3
2021-05-05 11:09:27 +02:00
PYTHON_SMBUS2_SOURCE = smbus2-$(PYTHON_SMBUS2_VERSION).tar.gz
[RPI] Refactor SPI and GPIO handling for XVF3510 initialization This commit significantly overhauls the script for setting the XVF3510 board to boot from SPI slave mode and for loading a binary file. The refactor not only aims at improving code readability, maintainability, and robustness but also addresses compatibility issues with the latest Raspberry Pi models, specifically the Raspberry Pi 5, which does not support the RPi.GPIO library. Changes made: - Switched from `smbus` to `smbus2` for I2C communication, offering a more modern and robust interface. - Replaced `RPi.GPIO` and `spidev` with `digitalio` and `busio` from the `adafruit_blinka` library, enhancing cross-platform compatibility and providing a more Pythonic API for GPIO and SPI operations. - Introduced type annotations for function signatures, improving code readability and type safety. - Added exception handling around I2C operations and file reading, increasing the script's robustness by gracefully handling potential errors. - Defined global variables for GPIO pin configurations, making the code cleaner and easier to modify for different setups. - Encapsulated GPIO setup and reset logic into dedicated functions (`setup_direct_gpio`), streamlining the main logic flow and separating concerns. - Modularized SPI setup (`setup_spi`) and data transmission logic (`send_data_over_spi` and `handle_block_transfer`), enhancing code organization and maintainability. Benefits: - The use of `smbus2` and `adafruit_blinka` libraries modernizes the script and may improve compatibility with a wider range of devices and future Python versions. - Type annotations and structured exception handling make the script more understandable and safer to execute, reducing the risk of runtime errors. - The refactoring into more granular functions and the introduction of global variables for configuration parameters make the script easier to read, modify, and extend. - Improved error handling ensures that the script fails gracefully, providing clear error messages and avoiding potential resource leaks.
2024-02-04 00:24:43 +01:00
PYTHON_SMBUS2_SITE = https://files.pythonhosted.org/packages/98/17/9663936e52a348b3ad1c85e6ca6071d2abf00a5f64f2df50bec8dcca6e16
2021-05-05 11:09:27 +02:00
PYTHON_SMBUS2_SETUP_TYPE = setuptools
PYTHON_SMBUS2_LICENSE = MIT
PYTHON_SMBUS2_LICENSE_FILES = LICENSE
$(eval $(python-package))