{"id":18523369,"url":"https://github.com/mhx/libembedded","last_synced_at":"2025-06-18T14:37:20.246Z","repository":{"id":146758165,"uuid":"340707557","full_name":"mhx/libembedded","owner":"mhx","description":"Modern C++ for Embedded Systems","archived":false,"fork":false,"pushed_at":"2022-02-18T14:00:49.000Z","size":1550,"stargazers_count":14,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T03:56:38.498Z","etag":null,"topics":["c-plus-plus","c-plus-plus-11","constexpr","cpp","cpp-library","cpp11","embedded","embedded-applications","embedded-cpp","embedded-systems","iir-filters","mit-license","modern-cpp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mhx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-02-20T17:05:20.000Z","updated_at":"2025-01-21T03:03:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"3987e0d0-421c-4282-898a-a51889c8d30c","html_url":"https://github.com/mhx/libembedded","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mhx/libembedded","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhx%2Flibembedded","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhx%2Flibembedded/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhx%2Flibembedded/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhx%2Flibembedded/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhx","download_url":"https://codeload.github.com/mhx/libembedded/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhx%2Flibembedded/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260571758,"owners_count":23029944,"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":["c-plus-plus","c-plus-plus-11","constexpr","cpp","cpp-library","cpp11","embedded","embedded-applications","embedded-cpp","embedded-systems","iir-filters","mit-license","modern-cpp"],"created_at":"2024-11-06T17:35:24.527Z","updated_at":"2025-06-18T14:37:15.232Z","avatar_url":"https://github.com/mhx.png","language":"C++","readme":"[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5e1f58ea5d434b09bfba571413a02811)](https://www.codacy.com/gh/mhx/libembedded/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=mhx/libembedded\u0026amp;utm_campaign=Badge_Grade)\n\n# libembedded - Modern C++ for Embedded Systems\n\nThis library will hopefully, over time, become a collection of useful,\nmodern C++ abstractions, with a particular focus on being useful in\nthe context of embedded systems.\n\nThe goal for this library is to provide abstractions that\n\n- work nicely without exceptions and RTTI enabled,\n\n- work nicely without dynamic memory allocation and\n\n- require only C++11 compliant compilers.\n\n# What's inside\n\n## A polymorphic function wrapper with in-place storage\n\n`embedded::function` is loosely modeled after `std::function` and inspired\nby both SG14's `inplace_function` and `folly::Function`. It requires no\ndynamic memory allocation, but, contrary to `etl::delegate`, is able to\nwrap lambdas and other function objects as long as they fit into the\nin-place storage.\n\n## A circular buffer adapter\n\nThe `circular_buffer_adapter` template allows the construction of circular\nbuffers on top of a arbitrary, and possibly persistent, memory. This means\nthat you can easily build circular buffers on top of EEPROM sections.\n\n## Variable length integers\n\n`embedded::varint` implements encoding and decoding of interger values to\nand from byte streams, using as few bytes as possible, and independent of\nbyte order.\n\n## Type traits\n\nA few type traits have been back-ported from later C++ standards. More\nwill be added on-demand.\n\n## An experimental compile-time IIR filter design library\n\nThis library (in `embedded/signal`) can be used to directly design IIR\nfilters in C++ code without any run-time overhead. This is currently in\nexperimental state as the interface isn't yet settled and there's quite\na few things that are still missing. However, you can do things like:\n\n```\nconstexpr auto design =\n    iirfilter\u003c\u003e(1000.0).lowpass(chebyshev1\u003c8\u003e(3.0), 40.0).sos\u003cfloat\u003e();\n\nauto filter = design.instance();\n\nfor (;;) {\n    output(filter(input()));\n}\n```\n\nThis will design an 8th-order Chebyshev Type I low-pass filter with\n3 dB of passband ripple, a sample rate of 1 kHz and a cutoff frequency\nof 40 Hz. All filter coefficients will be determined at compile-time\nand the run-time filter code is extremely efficient. For example, this\nis the full ARM assembly for the above code, but using a second-order\nfilter:\n\n```\nprocess():\n        push            {r3, lr}\n        vpush.64        {d8, d9, d10}\n        vldr.32         s17, .L5\n        vldr.32         s20, .L5+4\n        vldr.32         s19, .L5+8\n        vmov.f32        s16, s17\n        vldr.32         s18, .L5+12\n.L2:\n        bl              input()\n        vmul.f32        s13, s0, s20\n        vmov.f32        s15, s0\n        vldr.32         s12, .L5+16\n        vadd.f32        s14, s16, s13\n        vmul.f32        s16, s14, s18\n        vmls.f32        s13, s14, s12\n        vmov.f32        s0, s14\n        vnmls.f32       s16, s15, s19\n        vadd.f32        s16, s16, s17\n        vmov.f32        s17, s13\n        bl              output(float)\n        b               .L2\n.L5:\n        .word   0\n        .word   1005574271\n        .word   1013962879\n        .word   -1075339548\n        .word   1062851613\n```\n\nThe library is also able to build fixed-point arithmetic filters\nif a suitable fixed-point implementation is provided\n(e.g. [fpm](https://github.com/MikeLankamp/fpm)).\n\nYou can find examples in the `examples` directory of the repo.\n\n## Experimental compile-time math library\n\nThis is primarily used by the compile-time filter design library and\ncurrently only contains the minimum functionality needed to implement\nthe filter design. It does contain things like `constexpr` functions\n(provided either via `libstdc++`'s non-standard builtins or via the\n[gcem library](https://github.com/kthohr/gcem)), `constexpr` complex\nnumbers and `constexpr` vectors.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhx%2Flibembedded","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhx%2Flibembedded","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhx%2Flibembedded/lists"}