{"id":16239627,"url":"https://github.com/nopnop2002/esp-idf-serial","last_synced_at":"2025-06-22T06:37:10.937Z","repository":{"id":108987861,"uuid":"591959645","full_name":"nopnop2002/esp-idf-serial","owner":"nopnop2002","description":"User-level UART I/O library for ESP-IDF","archived":false,"fork":false,"pushed_at":"2024-06-13T18:57:25.000Z","size":25,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T04:41:34.839Z","etag":null,"topics":["esp-idf","esp32","uart"],"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/nopnop2002.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-01-22T13:44:29.000Z","updated_at":"2024-07-29T21:34:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3eb3067-5e35-436a-9aef-8e6db0f4a788","html_url":"https://github.com/nopnop2002/esp-idf-serial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nopnop2002/esp-idf-serial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-serial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-serial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-serial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-serial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nopnop2002","download_url":"https://codeload.github.com/nopnop2002/esp-idf-serial/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-serial/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261249556,"owners_count":23130494,"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":["esp-idf","esp32","uart"],"created_at":"2024-10-10T13:44:27.071Z","updated_at":"2025-06-22T06:37:05.922Z","avatar_url":"https://github.com/nopnop2002.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp-idf-serial\nUser-level UART I/O library for ESP-IDF.\n\n# Background\nThe Arduino environment has several libraries and applications for handling UART devices such as MP3 players, GPS receivers, and gas sensors.   \nESP-IDF provides a highly functional UART driver.   \nBut we can't treat it like STDIN/STDOUT.   \nI created this to port applications and libraries that use UART from the Arduino environment to the ESP-IDF environment.   \n\n\n# Software requirements\nESP-IDF V4.4 or later.   \n\n# Installation\n\n```Shell\ngit clone https://github.com/nopnop2002/esp-idf-serial\ncd esp-idf-serial\nidf.py flash\n```\n\n# Wirering\n|ESP32||TTL-USB Converter|\n|:-:|:-:|:-:|\n|GPIO4|--|TX|\n|GPIO5|--|RX|\n|GND|--|GND|\n\nPlug the TTL-USB Converter into your host and open a serial terminal on your host.   \nI use GtkTerm on linux.   \n\n# Limitation\nWhen using this library, the task that initializes and the task that does the IO must be the same.   \nUnlike other drivers provided by ESP-IDF, initialization and IO cannot be separated into separate tasks.   \n\n# Arduno code\n```\n#include \u003cSoftwareSerial.h\u003e\n\nSoftwareSerial _serial(4, 5); // RX, TX\n\nunsigned long lastMillis;\n\nvoid setup() {\n  Serial.begin(115200);\n  _serial.begin(115200);\n  lastMillis = 0;\n}\n\nvoid loop() {\n  int len = Serial.available();\n  if (len \u003e 0) {\n    for (int i=0;i\u003clen;i++) {\n      char ch = Serial.read();\n      _serial.println(ch, HEX);\n    }\n  }\n\n  long nowMillis = millis();\n  if (nowMillis - lastMillis \u003e 1000) {\n    lastMillis = nowMillis;\n    char buffer[64];\n    sprintf(buffer, \"Hello World %d\",nowMillis);  \n    Serial.println(buffer);\n  }\n}\n```\n\n\n}\n\n# ESP-IDF code using this\n```\n#include \u003cstdio.h\u003e\n#include \u003cinttypes.h\u003e\n#include \u003cstring.h\u003e\n#include \"freertos/FreeRTOS.h\"\n#include \"freertos/task.h\"\n#include \"esp_system.h\"\n#include \"esp_log.h\"\n#include \"driver/gpio.h\"\n\n#include \"serial.h\"\n\n#define TAG \"MAIN\"\n\n#define TXD_PIN (GPIO_NUM_4)\n#define RXD_PIN (GPIO_NUM_5)\n\nvoid app_main(void)\n{\n    serial_begin(112500, TXD_PIN, RXD_PIN);\n    TickType_t lastTick = xTaskGetTickCount();\n    while(1) {\n        int len = serial_available();\n        if (len \u003e 0) {\n            ESP_LOGI(TAG, \"serial_available=%d\", len);\n            for (int i=0;i\u003clen;i++) {\n                uint8_t ch = serial_read();\n                ESP_LOGI(TAG, \"serial_read=%x\", ch);\n            }\n        }\n\n        TickType_t nowTick = xTaskGetTickCount();\n        if (nowTick - lastTick \u003e 100) {\n            lastTick = xTaskGetTickCount();\n            char buffer[64];\n            sprintf(buffer, \"Hello World %\"PRIu32, nowTick);\n            ESP_LOGI(TAG, \"buffer=[%s]\", buffer);\n            serial_println(buffer);\n        }\n        vTaskDelay(1);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnopnop2002%2Fesp-idf-serial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnopnop2002%2Fesp-idf-serial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnopnop2002%2Fesp-idf-serial/lists"}