├── .github └── FUNDING.yml ├── ATC ├── NimaLTD.I-CUBE-ATC.4.1.2.pack ├── NimaLTD.I-CUBE-ATC.4.2.0.pack ├── NimaLTD.I-CUBE-ATC.4.2.1.pack ├── NimaLTD.I-CUBE-ATC.4.2.2.pack └── NimaLTD.I-CUBE-ATC.pdsc ├── EE ├── NimaLTD.I-CUBE-EE.3.1.2.pack ├── NimaLTD.I-CUBE-EE.3.1.3.pack ├── NimaLTD.I-CUBE-EE.3.2.0.pack ├── NimaLTD.I-CUBE-EE.3.2.1.pack ├── NimaLTD.I-CUBE-EE.3.2.2.pack └── NimaLTD.I-CUBE-EE.pdsc ├── EE24 ├── NimaLTD.I-CUBE-EE24.3.0.0.pack ├── NimaLTD.I-CUBE-EE24.3.0.1.pack ├── NimaLTD.I-CUBE-EE24.3.1.0.pack ├── NimaLTD.I-CUBE-EE24.3.2.0.pack └── NimaLTD.I-CUBE-EE24.pdsc ├── LICENSE.TXT ├── NimaLTD.pidx ├── RBUF ├── NimaLTD.I-CUBE-RBUF.1.0.0.pack ├── NimaLTD.I-CUBE-RBUF.2.0.0.pack ├── NimaLTD.I-CUBE-RBUF.2.1.0.pack ├── NimaLTD.I-CUBE-RBUF.2.2.0.pack └── NimaLTD.I-CUBE-RBUF.pdsc ├── README.md ├── SPIF ├── NimaLTD.I-CUBE-SPIF.2.0.0.pack ├── NimaLTD.I-CUBE-SPIF.2.0.1.pack ├── NimaLTD.I-CUBE-SPIF.2.1.0.pack ├── NimaLTD.I-CUBE-SPIF.2.2.0.pack ├── NimaLTD.I-CUBE-SPIF.2.2.1.pack ├── NimaLTD.I-CUBE-SPIF.2.2.2.pack ├── NimaLTD.I-CUBE-SPIF.2.3.0.pack ├── NimaLTD.I-CUBE-SPIF.2.3.1.pack ├── NimaLTD.I-CUBE-SPIF.2.3.2.pack └── NimaLTD.I-CUBE-SPIF.pdsc ├── TM1637 ├── NimaLTD.NimaLTD-TM1637.2.0.0.pack └── NimaLTD.NimaLTD-TM1637.pdsc ├── WS28XX ├── NimaLTD.I-CUBE-WS28XX.3.0.0.pack ├── NimaLTD.I-CUBE-WS28XX.3.0.1.pack └── NimaLTD.I-CUBE-WS28XX.pdsc ├── pidx.bat └── pidx.py /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [nimaltd] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: nimaltd # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 15 | -------------------------------------------------------------------------------- /ATC/NimaLTD.I-CUBE-ATC.4.1.2.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/ATC/NimaLTD.I-CUBE-ATC.4.1.2.pack -------------------------------------------------------------------------------- /ATC/NimaLTD.I-CUBE-ATC.4.2.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/ATC/NimaLTD.I-CUBE-ATC.4.2.0.pack -------------------------------------------------------------------------------- /ATC/NimaLTD.I-CUBE-ATC.4.2.1.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/ATC/NimaLTD.I-CUBE-ATC.4.2.1.pack -------------------------------------------------------------------------------- /ATC/NimaLTD.I-CUBE-ATC.4.2.2.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/ATC/NimaLTD.I-CUBE-ATC.4.2.2.pack -------------------------------------------------------------------------------- /ATC/NimaLTD.I-CUBE-ATC.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | NimaLTD 4 | I-CUBE-ATC 5 | AT Command Driver for STM32 6 | https://github.com/nimaltd/STM32-PACK/raw/main/ATC/ 7 | LICENSE.txt 8 | 9 | - Fixed set event 10 | - Fixed Debug 11 | - Removed Temp Callback :) 12 | - Fixed Returned response 13 | - Added Temp Callback 14 | - Fixed Definitions 15 | 16 | 17 | CUBE_RULES_COMPLIANT 18 | IMPLEMENTED_WITH_STM32CUBEMX 19 | 20 | 21 | Driver 22 | 23 | 24 | 25 | AT Command Driver 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /EE/NimaLTD.I-CUBE-EE.3.1.2.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE/NimaLTD.I-CUBE-EE.3.1.2.pack -------------------------------------------------------------------------------- /EE/NimaLTD.I-CUBE-EE.3.1.3.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE/NimaLTD.I-CUBE-EE.3.1.3.pack -------------------------------------------------------------------------------- /EE/NimaLTD.I-CUBE-EE.3.2.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE/NimaLTD.I-CUBE-EE.3.2.0.pack -------------------------------------------------------------------------------- /EE/NimaLTD.I-CUBE-EE.3.2.1.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE/NimaLTD.I-CUBE-EE.3.2.1.pack -------------------------------------------------------------------------------- /EE/NimaLTD.I-CUBE-EE.3.2.2.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE/NimaLTD.I-CUBE-EE.3.2.2.pack -------------------------------------------------------------------------------- /EE/NimaLTD.I-CUBE-EE.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | NimaLTD 4 | I-CUBE-EE 5 | EEPROM Emulation Driver for STM32 6 | https://github.com/nimaltd/STM32-PACK/raw/main/EE/ 7 | LICENSE.txt 8 | 9 | Fixed Erasing L0,L1 Series 10 | - Fixed Selecting BANK for STM32W Series 11 | - Added Manual Configuration 12 | 13 | 14 | CUBE_RULES_COMPLIANT 15 | IMPLEMENTED_WITH_STM32CUBEMX 16 | 17 | 18 | Driver 19 | 20 | 21 | 22 | EEPROM Emulation Driver 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /EE24/NimaLTD.I-CUBE-EE24.3.0.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE24/NimaLTD.I-CUBE-EE24.3.0.0.pack -------------------------------------------------------------------------------- /EE24/NimaLTD.I-CUBE-EE24.3.0.1.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE24/NimaLTD.I-CUBE-EE24.3.0.1.pack -------------------------------------------------------------------------------- /EE24/NimaLTD.I-CUBE-EE24.3.1.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE24/NimaLTD.I-CUBE-EE24.3.1.0.pack -------------------------------------------------------------------------------- /EE24/NimaLTD.I-CUBE-EE24.3.2.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/EE24/NimaLTD.I-CUBE-EE24.3.2.0.pack -------------------------------------------------------------------------------- /EE24/NimaLTD.I-CUBE-EE24.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | NimaLTD 4 | I-CUBE-EE24 5 | I2C EEPROM Driver for STM32 6 | https://github.com/nimaltd/STM32-PACK/raw/main/EE24/ 7 | LICENSE.txt 8 | 9 | - Added ThreadX Configuration 10 | - Add WP pin control 11 | - Fix 1Kb and 2Kb memory writing 12 | Fix Address 13 | Rewrite Again 14 | 15 | 16 | IMPLEMENTED_WITH_STM32CUBEMX 17 | CUBE_RULES_COMPLIANT 18 | 19 | 20 | Driver 21 | 22 | 23 | 24 | I2C EEPROM Driver 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /LICENSE.TXT: -------------------------------------------------------------------------------- 1 | Software License Terms 2 | 3 | This software is dual-licensed: 4 | 5 | 1. GNU General Public License v2 (GPLv2): 6 | - You may redistribute and/or modify this software under the terms of GPLv2 as published by the Free Software Foundation. 7 | - This license does not provide any warranty of any kind, including but not limited to MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8 | - See for details. 9 | 10 | 2. Commercial License: 11 | - The commercial license removes all GPLv2 restrictions and allows you to redistribute your closed-source products with the Library embedded. 12 | - This license includes access to software maintenance, such as updates and upgrades. Customers who purchase this license are eligible to receive updates whenever 13 | they are released. However, the software provider is not obligated to release updates on a specific schedule. 14 | - The commercial license is available in two models: 15 | - Single-Product License: Allows usage in one specific product. 16 | - Company-Wide License: Allows usage across all products of the company. 17 | - No Warranty: The software is provided "AS IS" without any warranties, express or implied, including but not limited to the implied warranties of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, or NON-INFRINGEMENT. 18 | - Liability Disclaimer: In no event shall the copyright holder or contributors be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 19 | 20 | By using this software under the commercial license, you agree to these terms and acknowledge that no additional guarantees or obligations are provided beyond what is explicitly stated in this document. 21 | 22 | --- 23 | 24 | Copyright © Nima Askari, 2025. All rights reserved. 25 | For inquiries, contact: nima.askari@gmail.com All rights reserved 26 | -------------------------------------------------------------------------------- /NimaLTD.pidx: -------------------------------------------------------------------------------- 1 | 2 | 3 | NimaLTD 4 | https://github.com/nimaltd/STM32-PACK/raw/main/NimaLTD.pidx 5 | 2025-03-09T15:12:16.806087 6 | 7 | 8 | AT Command Driver for STM32 9 | LICENSE.txt 10 | 11 | CUBE_RULES_COMPLIANT 12 | IMPLEMENTED_WITH_STM32CUBEMX 13 | 14 | 15 | 16 | EEPROM Emulation Driver for STM32 17 | LICENSE.txt 18 | 19 | CUBE_RULES_COMPLIANT 20 | IMPLEMENTED_WITH_STM32CUBEMX 21 | 22 | 23 | 24 | I2C EEPROM Driver for STM32 25 | LICENSE.txt 26 | 27 | IMPLEMENTED_WITH_STM32CUBEMX 28 | CUBE_RULES_COMPLIANT 29 | 30 | 31 | 32 | Ring Buffer Library for STM32 33 | LICENSE.txt 34 | 35 | CUBE_RULES_COMPLIANT 36 | 37 | 38 | 39 | SPI Flash Driver for STM32 40 | LICENSE.txt 41 | 42 | IMPLEMENTED_WITH_STM32CUBEMX 43 | CUBE_RULES_COMPLIANT 44 | 45 | 46 | 47 | TM1637 Library (7-SEG) 48 | LICENSE.TXT 49 | 50 | CUBE_RULES_COMPLIANT 51 | IMPLEMENTED_WITH_STM32CUBEMX 52 | 53 | 54 | 55 | WS28XX LEDs Driver for STM32 56 | LICENSE.txt 57 | 58 | IMPLEMENTED_WITH_STM32CUBEMX 59 | CUBE_RULES_COMPLIANT 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /RBUF/NimaLTD.I-CUBE-RBUF.1.0.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/RBUF/NimaLTD.I-CUBE-RBUF.1.0.0.pack -------------------------------------------------------------------------------- /RBUF/NimaLTD.I-CUBE-RBUF.2.0.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/RBUF/NimaLTD.I-CUBE-RBUF.2.0.0.pack -------------------------------------------------------------------------------- /RBUF/NimaLTD.I-CUBE-RBUF.2.1.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/RBUF/NimaLTD.I-CUBE-RBUF.2.1.0.pack -------------------------------------------------------------------------------- /RBUF/NimaLTD.I-CUBE-RBUF.2.2.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/RBUF/NimaLTD.I-CUBE-RBUF.2.2.0.pack -------------------------------------------------------------------------------- /RBUF/NimaLTD.I-CUBE-RBUF.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | NimaLTD 4 | I-CUBE-RBUF 5 | Ring Buffer Library for STM32 6 | https://github.com/nimaltd/STM32-PACK/raw/main/RBUF/ 7 | LICENSE.txt 8 | 9 | - Added RBUF_PushN(),RBUF_PopN() functions 10 | - Added RBUF_Used(),RBUF_Format() functions 11 | - First Release 12 | - STM32 Pack Installition support 13 | 14 | 15 | CUBE_RULES_COMPLIANT 16 | 17 | 18 | Driver 19 | 20 | 21 | 22 | Ring Buffer Library 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # STM32-PACK 2 | --- 3 | ## Please Do not Forget STAR, DONATE and support me on social networks. Thank you. :sparkling_heart: 4 | --- 5 | - Author: Nima Askari 6 | - Github: https://www.github.com/NimaLTD 7 | - Youtube: https://www.youtube.com/@nimaltd 8 | - LinkedIn: https://www.linkedin.com/in/nimaltd 9 | - Instagram: https://instagram.com/github.NimaLTD 10 | --- 11 | ## Add the link to CubeMX and install the libraries 12 | ## https://github.com/nimaltd/STM32-PACK/raw/main/NimaLTD.pidx 13 | -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.0.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.0.0.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.0.1.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.0.1.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.1.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.1.0.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.2.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.2.0.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.2.1.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.2.1.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.2.2.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.2.2.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.3.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.3.0.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.3.1.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.3.1.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.2.3.2.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/SPIF/NimaLTD.I-CUBE-SPIF.2.3.2.pack -------------------------------------------------------------------------------- /SPIF/NimaLTD.I-CUBE-SPIF.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | NimaLTD 4 | I-CUBE-SPIF 5 | SPI Flash Driver for STM32 6 | https://github.com/nimaltd/STM32-PACK/raw/main/SPIF/ 7 | LICENSE.txt 8 | 9 | - Fixed SPIF_Read() offset. Fixed ISSI ID 10 | - Added ThreadX Configuration 11 | Fix compile error 12 | update SPIF_WriteAddress() 13 | Add SPIF_Transmit and SPIF_Receive 14 | Support HAL_DMA 15 | Remove SPIF_Transmit 16 | Remove SPIF_Receive 17 | Add check Page/Sector/Block index 18 | - Rewrite Again 19 | - STM32CubeMx Pack 20 | none 21 | none 22 | none 23 | none 24 | none 25 | none 26 | none 27 | none 28 | none 29 | First Release 30 | 31 | 32 | IMPLEMENTED_WITH_STM32CUBEMX 33 | CUBE_RULES_COMPLIANT 34 | 35 | 36 | Driver 37 | 38 | 39 | 40 | SPI Flash Driver 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /TM1637/NimaLTD.NimaLTD-TM1637.2.0.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/TM1637/NimaLTD.NimaLTD-TM1637.2.0.0.pack -------------------------------------------------------------------------------- /TM1637/NimaLTD.NimaLTD-TM1637.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | NimaLTD 4 | NimaLTD-TM1637 5 | TM1637 Library (7-SEG) 6 | https://github.com/nimaltd/STM32-PACK/raw/main/TM1637/ 7 | LICENSE.TXT 8 | nima.askari@gmail.com 9 | 10 | - Rewrite 11 | - Support printf 12 | - Update License 13 | 14 | 15 | CUBE_RULES_COMPLIANT 16 | IMPLEMENTED_WITH_STM32CUBEMX 17 | 18 | 19 | Library 20 | 21 | 22 | 23 | TM1637 Driver 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /WS28XX/NimaLTD.I-CUBE-WS28XX.3.0.0.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/WS28XX/NimaLTD.I-CUBE-WS28XX.3.0.0.pack -------------------------------------------------------------------------------- /WS28XX/NimaLTD.I-CUBE-WS28XX.3.0.1.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimaltd/STM32-PACK/7eba1907c94949e2aac0ba28f134e259ed718961/WS28XX/NimaLTD.I-CUBE-WS28XX.3.0.1.pack -------------------------------------------------------------------------------- /WS28XX/NimaLTD.I-CUBE-WS28XX.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | NimaLTD 4 | I-CUBE-WS28XX 5 | WS28XX LEDs Driver for STM32 6 | https://github.com/nimaltd/STM32-PACK/raw/main/WS28XX/ 7 | LICENSE.txt 8 | 9 | - Fixed blinger at first pixel 10 | - Rewritten 11 | - Supported CubeMx Packet installation 12 | 13 | 14 | IMPLEMENTED_WITH_STM32CUBEMX 15 | CUBE_RULES_COMPLIANT 16 | 17 | 18 | Driver 19 | 20 | 21 | 22 | WS28XX LEDs Driver 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /pidx.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | python .\pidx.py 3 | -------------------------------------------------------------------------------- /pidx.py: -------------------------------------------------------------------------------- 1 | import os 2 | import xml.etree.ElementTree as ET 3 | from datetime import datetime 4 | from xml.dom import minidom # Import minidom for pretty printing 5 | 6 | def generate_pidx_xml(root_dir): 7 | index_root = ET.Element('index') 8 | index_root.set('schemaVersion', '1.0.0') 9 | index_root.set('xs:noNamespaceSchemaLocation', 'PackIndex.xsd') 10 | index_root.set('xmlns:xs', 'http://www.w3.org/2001/XMLSchema-instance') 11 | 12 | vendor_element = ET.SubElement(index_root, 'vendor') 13 | vendor_element.text = 'NimaLTD' # Replace with actual vendor 14 | 15 | url_element = ET.SubElement(index_root, 'url') 16 | url_element.text = 'https://github.com/nimaltd/STM32-PACK/raw/main/NimaLTD.pidx' # Replace with actual URL 17 | 18 | timestamp_element = ET.SubElement(index_root, 'timestamp') 19 | timestamp_element.text = datetime.now().isoformat() 20 | 21 | pindex_element = ET.SubElement(index_root, 'pindex') 22 | 23 | # Walk through all directories and subdirectories 24 | for dirpath, _, filenames in os.walk(root_dir): 25 | for filename in filenames: 26 | # Check for .pdsc files 27 | if filename.endswith('.pdsc'): 28 | pdsc_path = os.path.join(dirpath, filename) 29 | print(f"Processing {pdsc_path}") # Debug print 30 | 31 | # Extract metadata from the .pdsc file 32 | try: 33 | pdsc_metadata = extract_pdsc_metadata(pdsc_path) 34 | except Exception as e: 35 | print(f"Error processing {pdsc_path}: {e}") 36 | continue 37 | 38 | if pdsc_metadata: 39 | # Create element 40 | pdsc_element = ET.SubElement(pindex_element, 'pdsc') 41 | pdsc_element.set('url', pdsc_metadata['url']) 42 | pdsc_element.set('vendor', pdsc_metadata['vendor']) 43 | pdsc_element.set('name', pdsc_metadata['name']) 44 | pdsc_element.set('version', pdsc_metadata['version']) 45 | 46 | # Optional metadata 47 | if 'description' in pdsc_metadata: 48 | description_element = ET.SubElement(pdsc_element, 'description') 49 | description_element.text = pdsc_metadata['description'] 50 | 51 | if 'license' in pdsc_metadata: 52 | license_element = ET.SubElement(pdsc_element, 'license') 53 | license_element.text = pdsc_metadata['license'] 54 | 55 | if 'keywords' in pdsc_metadata: 56 | keywords_element = ET.SubElement(pdsc_element, 'keywords') 57 | for keyword in pdsc_metadata['keywords']: 58 | keyword_element = ET.SubElement(keywords_element, 'keyword') 59 | keyword_element.text = keyword 60 | 61 | # Convert ElementTree to string and pretty print using minidom 62 | xml_str = ET.tostring(index_root, encoding='UTF-8') 63 | xml_str = minidom.parseString(xml_str).toprettyxml(indent=" ") 64 | 65 | # Write the XML to file in the current directory 66 | pidx_file = os.path.join(root_dir, 'NimaLTD.pidx') 67 | with open(pidx_file, 'w', encoding='UTF-8') as f: 68 | f.write(xml_str) 69 | 70 | print(f'.pidx file generated: {pidx_file}') 71 | 72 | def extract_pdsc_metadata(pdsc_path): 73 | # Parse .pdsc file and extract metadata 74 | pdsc_metadata = {} 75 | 76 | try: 77 | tree = ET.parse(pdsc_path) 78 | root = tree.getroot() 79 | 80 | pdsc_metadata['vendor'] = root.find('vendor').text.strip() 81 | pdsc_metadata['name'] = root.find('name').text.strip() 82 | pdsc_metadata['url'] = root.find('url').text.strip() # Assuming url is a direct child element 83 | pdsc_metadata['version'] = root.find('releases/release').get('version').strip() # Assuming version is from the first release 84 | 85 | # Additional metadata 86 | description_element = root.find('description') 87 | if description_element is not None: 88 | pdsc_metadata['description'] = description_element.text.strip() 89 | 90 | license_element = root.find('license') 91 | if license_element is not None: 92 | pdsc_metadata['license'] = license_element.text.strip() 93 | 94 | keywords_element = root.find('keywords') 95 | if keywords_element is not None: 96 | pdsc_metadata['keywords'] = [keyword.text.strip() for keyword in keywords_element.findall('keyword')] 97 | 98 | except Exception as e: 99 | print(f"Error parsing {pdsc_path}: {e}") 100 | 101 | return pdsc_metadata 102 | 103 | # Example usage: 104 | if __name__ == '__main__': 105 | root_directory = os.getcwd() # Use current directory as root 106 | generate_pidx_xml(root_directory) 107 | --------------------------------------------------------------------------------