{"id":16909629,"url":"https://github.com/werwolv/driverdescriptionlanguage","last_synced_at":"2025-06-26T19:33:43.246Z","repository":{"id":156780969,"uuid":"631530974","full_name":"WerWolv/DriverDescriptionLanguage","owner":"WerWolv","description":"Description language to define hardware drivers","archived":false,"fork":false,"pushed_at":"2023-04-27T20:34:02.000Z","size":63,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T12:01:41.355Z","etag":null,"topics":["description-language","driver","hardware","peripherals"],"latest_commit_sha":null,"homepage":"https://werwolv.net","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WerWolv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-23T10:09:22.000Z","updated_at":"2024-10-23T14:32:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"9844f395-569c-4cfd-9bc0-474a7c51132c","html_url":"https://github.com/WerWolv/DriverDescriptionLanguage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WerWolv%2FDriverDescriptionLanguage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WerWolv%2FDriverDescriptionLanguage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WerWolv%2FDriverDescriptionLanguage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WerWolv%2FDriverDescriptionLanguage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WerWolv","download_url":"https://codeload.github.com/WerWolv/DriverDescriptionLanguage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248434766,"owners_count":21102901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["description-language","driver","hardware","peripherals"],"created_at":"2024-10-13T18:56:40.641Z","updated_at":"2025-04-11T15:51:16.075Z","avatar_url":"https://github.com/WerWolv.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Driver Description Language\n\n## What is this?\nThis Project is an attempt to create a description language to define drivers for hardware peripherals in a reusable manner.\nInstead of having to write drivers for the same IC over and over again for different controllers, instead it allows you to simply write one interface peripheral driver for your controller family and then reuse the generic IC driver again without having to rewrite it from scratch.\nThe compiler will then generate protable C code for you that can be compiled into your project.\n\n## Example\n\n**Simple STM32 I2C driver**\n```cpp\nnamespace STM32 {\n  \n  driver I2C\u003cu8 Address\u003e : I2C {\n    \n    // Generic read function\n    fn readRegister\u003cT\u003e(u8 register) {\n      // Define the result variable\n      T result = 0x00;\n      \n      // Raw C code block to use the STM32 HAL library to read the I2C data\n      [[\n          HAL_I2C_Master_Transmit(\u0026hi2c1, Address | 0x01, \u0026register, 1, 1000);\n          HAL_I2C_Master_Receive(\u0026hi2c1, Address | 0x01, \u0026result, sizeof(result), 1000);\n      ]]\n      \n      // Return the result\n      return result;\n    }\n    \n  }\n  \n}\n```\n\n**Simple MAX17261 driver**\n```cpp\n// Defines a new driver based on the STM32 I2C driver with address 0x6C\ndriver MAX17261 : {% impl %}::I2C\u003c0x6C\u003e {\n  // Function to get the value of the status register\n  fn getStatus() =\u003e readRegister\u003cu16\u003e(0x00);\n}\n```\n\nTo use these drivers now, you need to write a specs file that tells the compiler how to combine these files into C code.\n\n```toml\n# MAX17261 Fuel Gauge\n[MAX17261]\npath = \"max17261.drv\"                     # Load its definition from the max17261.drv file\nconfig = { impl = \"STM32\" }               # Set the placeholders, define \"impl\" as \"STM32\"\ndepends = [\"STM32\"]                       # Define the dependencies\n\n# STM32 I2C driver\n[STM32]\npath = \"stm32.drv\"                        # Load its definition from the stm32.drv file\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwerwolv%2Fdriverdescriptionlanguage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwerwolv%2Fdriverdescriptionlanguage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwerwolv%2Fdriverdescriptionlanguage/lists"}