From 338a4606c611a99e29a849c895e9972e78568c14 Mon Sep 17 00:00:00 2001 From: Siddharth Chandrasekaran Date: Sat, 23 Mar 2024 10:54:44 +0100 Subject: [PATCH] examples: cpp: Use std::this_thread::sleep_for instead of usleep Signed-off-by: Siddharth Chandrasekaran --- examples/cpp/cp_app.cpp | 5 +++-- examples/cpp/pd_app.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/cpp/cp_app.cpp b/examples/cpp/cp_app.cpp index 5733f220..b9f4c9c2 100644 --- a/examples/cpp/cp_app.cpp +++ b/examples/cpp/cp_app.cpp @@ -5,7 +5,8 @@ */ #include -#include +#include +#include #include int sample_cp_send_func(void *data, uint8_t *buf, int len) @@ -60,7 +61,7 @@ int main() // your application code. cp.refresh(); - usleep(1000); + std::this_thread::sleep_for(std::chrono::microseconds(10 * 1000)); } return 0; diff --git a/examples/cpp/pd_app.cpp b/examples/cpp/pd_app.cpp index c856d896..14cc2832 100644 --- a/examples/cpp/pd_app.cpp +++ b/examples/cpp/pd_app.cpp @@ -5,7 +5,8 @@ */ #include -#include +#include +#include #include int sample_pd_send_func(void *data, uint8_t *buf, int len) @@ -86,7 +87,7 @@ int main() pd.refresh(); // your application code. - usleep(1000); + std::this_thread::sleep_for(std::chrono::microseconds(10 * 1000)); } return 0;