{"id":19783893,"url":"https://github.com/hempflower/tiny-eventloop","last_synced_at":"2026-06-08T01:31:10.692Z","repository":{"id":159192917,"uuid":"634483986","full_name":"hempflower/tiny-eventloop","owner":"hempflower","description":"Simple eventloop library for mcu.","archived":false,"fork":false,"pushed_at":"2023-05-03T11:46:41.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T13:20:11.061Z","etag":null,"topics":["async","embedded","library","task"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hempflower.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":"2023-04-30T09:20:56.000Z","updated_at":"2024-10-12T06:11:24.000Z","dependencies_parsed_at":"2023-05-09T11:49:18.810Z","dependency_job_id":null,"html_url":"https://github.com/hempflower/tiny-eventloop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hempflower/tiny-eventloop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hempflower%2Ftiny-eventloop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hempflower%2Ftiny-eventloop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hempflower%2Ftiny-eventloop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hempflower%2Ftiny-eventloop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hempflower","download_url":"https://codeload.github.com/hempflower/tiny-eventloop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hempflower%2Ftiny-eventloop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34044919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["async","embedded","library","task"],"created_at":"2024-11-12T06:09:34.361Z","updated_at":"2026-06-08T01:31:10.687Z","avatar_url":"https://github.com/hempflower.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tiny-eventloop —— Simple Eventloop library\n\n[中文](README.zh_CN.md) | English\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n![GitHub stars](https://img.shields.io/github/stars/hempflower/tiny-eventloop.svg?style=social\u0026label=Star)\n\nThis is a simple eventloop library for embedded c projects. It is designed to be simple and easy to use. \n\n## Features\n\n- Simple and easy to use\n- No dynamic memory allocation\n- No dependencies\n- No operating system required\n- Port easily to any platform. Without asm code.\n- Low memory usage\n- Implement by pure C\n\n\n## Usage\n\n### 1. Define task functions\n\n```c\nvoid async_task(void *arg) {\n    // do something\n}\n```\n\n### 2. Add task to eventloop\n\n```c\n// async_task will be called after 1000ms\nel_setTimeout(async_task,NULL,1000);\n\n// async_task will be called every 1000ms\nel_setInterval(async_task,NULL,1000);\n```\n\n### 3. Run eventloop\n\n```c\nel_enterLoop();\n```\n\nYou can see more examples in [examples](examples) directory.\n\n## Porting\n\n### 1. Define el_tick_t\n\nOpen el_port.h and define el_tick_t to the type of your system tick. For example, if your system tick is 32bit, you can define el_tick_t as uint32_t.\n\n```c\ntypedef uint32_t el_tick_t;\n```\n\n### 2. Implement el_portTickGet\n\nDefine el_portTickGet to get system tick. System tick is the millisecond since system startup. For example, in linux, we can use gettimeofday to get system tick.\n\n```c\nel_tick_t el_portTickGet() {\n    struct timeval tv;\n    gettimeofday(\u0026tv, NULL);\n    return tv.tv_sec * 1000 + tv.tv_usec / 1000;\n}\n```\n\nLuckly, many platforms such as STM32 has a system tick counter. You can get system tick by reading the counter.\n\n\n## API\n\n### el_setTimeout\nRun task after timeout.\n\n```c\nvoid el_setTimeout(el_task_t task, void *arg, uint32_t timeout);\n```\n\n### el_setInterval\n\nRun task every interval.\n```c\nvoid el_setInterval(el_task_t task, void *arg, uint32_t interval);\n```\n\n### el_clearTimeout\n\nCancel timeout task.\n```c\nvoid el_clearTimeout(el_task_t task);\n```\n\n### el_clearInterval\n\nCancel interval task.\n```c\nvoid el_clearInterval(el_task_t task);\n```\n\n### el_enterLoop\n\nRun eventloop.\n```c\nvoid el_enterLoop();\n```\n\n## License\n\nMIT License   \nAuthor: Evan Xiao\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhempflower%2Ftiny-eventloop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhempflower%2Ftiny-eventloop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhempflower%2Ftiny-eventloop/lists"}