From 96a9754dfd70d7e4ed2cb96ded6b8c784e9de322 Mon Sep 17 00:00:00 2001 From: Federico Pellegrin Date: Sat, 29 Jun 2024 04:58:33 +0200 Subject: [PATCH] esp-idf: add documentation on adding missing nanosleep function --- src/esp-idf/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/esp-idf/README.md b/src/esp-idf/README.md index 7beafd32..aefebdf7 100644 --- a/src/esp-idf/README.md +++ b/src/esp-idf/README.md @@ -24,6 +24,15 @@ namely: If you already have other components you may just add the reference to the newly added component. +- As the ESP-IDF does not provide a `nanosleep` function in its SDK, you should add + this in your project so you will be able to find it at linking time, for example: + +``` +int nanosleep(const struct timespec *req, struct timespec *_Nullable rem) { + return usleep(req->tv_sec*1000 + req->tv_nsec / 1000); +} +``` + Now you are almost ready to use libmodbus in your project! If you desire to use the library for serial communication, you will need to do a few