6 Commits

Author SHA1 Message Date
4e7a5d58aa Merge branch 'master' into pico_sdk 2026-03-29 12:28:36 +03:00
a450235743 PIP_NO_FILESYSTEM and PIP_NO_THREADS 2026-03-29 12:22:35 +03:00
15f90d9e17 Try MICRO_PIP fixes via opencode 2026-03-29 11:21:12 +03:00
c60a682279 missing include 2026-01-02 20:48:37 +03:00
cf89d77981 pip micro disable piintrospection piwaitevent
PIP_NO_SOCET
2025-10-18 11:20:18 +03:00
4885623492 Add pico sdk define 2025-10-18 08:53:47 +03:00
37 changed files with 834 additions and 512 deletions

165
AGENTS.md Normal file
View File

@@ -0,0 +1,165 @@
# PIP Codebase Guide for AGENTS
## Build Commands
### Basic Build
```bash
# Configure with CMake (release build)
cmake -B build -j16
# Build the project
cmake --build build -j16
# Install (default system location)
cmake --build build --target install -j16
# Local install (bin/lib/include in build directory)
cmake -B build -DLOCAL=ON -j16
```
### With Tests
```bash
cmake -B build -DTESTS=ON -j16
cmake --build build -j16
cd build && ctest
```
### Build Only
```bash
cmake --build build -j16
```
### Run Single Test
```bash
# After building with TESTS=ON
./build/tests/math/pip_math_test --gtest_filter="Vector2DTest.defaultConstructor*"
# Or use ctest
ctest -R math -V
# List all tests
ctest -N
```
### Build Options
- `TESTS=ON` - Build tests (requires Google Test)
- `COVERAGE=ON` - Build with coverage instrumentation
- `ICU=ON` - Enable ICU support for string conversion
- `STD_IOSTREAM=ON` - Enable std::iostream operators
- `INTROSPECTION=ON` - Build with introspection support
- `PIP_BUILD_*` - Enable/disable modules (e.g., `PIP_BUILD_CRYPT=OFF`)
### Code Generation Tools
- `pip_cmg` - Code model generator (auto-generates code from comments)
- `pip_rc` - Resources compiler (embeds resources into C++ code)
- `pip_tr` - Translation tool (compiles .btf translation files)
### Linting & Formatting
- **clang-format**: Run `clang-format -i <file>` or `find . -name "*.cpp" -o -name "*.h" | xargs clang-format -i`
- **Format config**: `.clang-format` (ColumnLimit: 140, IndentWidth: 4, BraceWrapping: Attach)
- **Includes sorting**: Enabled (CaseSensitive, SortIncludes: true)
- **Macro blocks**: `PRIVATE_DEFINITION_START/END`, `STATIC_INITIALIZER_BEGIN/END`, `DECLARE_UNIT_CLASS_BEGIN/END`
- **No Cursor/Copilot rules** found in this repository
## Code Style Guidelines
### General
- **Language Standard**: C++11 (CMAKE_CXX_STANDARD 11)
- **File Encoding**: UTF-8
- **Line Endings**: Unix (LF)
- **Column Limit**: 140 characters
### Naming Conventions
- **Classes**: `PascalCase` (e.g., `PIObject`, `PIString`)
- **Functions/Methods**: `camelCase` (e.g., `toString()`, `isEmpty()`)
- **Variables**: `camelCase` (e.g., `rowCount`, `isReady`)
- **Constants**: `kPrefixCamelCase` (e.g., `kMaxSize`)
- **Macros**: `UPPER_CASE` (e.g., `PIP_EXPORT`, `NO_COPY_CLASS`)
- **Types**: `PascalCase` with `p` prefix for internal/private (e.g., `PIString_p.h`)
### File Naming
- Headers: `pi<name>.h` (e.g., `piobject.h`, `pistring.h`)
- Private headers: `pi<name>_p.h` (e.g., `piobject_p.h`)
- Test files: `test<name>.cpp` (e.g., `testpivector2d.cpp`)
### Comments & Documentation
- Use Doxygen-style comments for all public APIs
- Include `\~english` and `\~russian` translations
- Group related classes/modules with `//! \defgroup`
- Use `\ingroup` to assign files to groups
- Example:
```cpp
//! \file piobject.h
//! \ingroup Core
//! \~\brief
//! \~english Base object
//! \~russian Базовый класс
```
### Includes
- Order: System headers → PIP headers → Local headers
- Sort alphabetically within groups
- Use `#pragma once` or include guards
- PIP includes use `#include "pi<name>.h"`
### Formatting (clang-format)
- **Indentation**: 4 spaces (no tabs for code)
- **Braces**: Attach style (`if (x) {`)
- **Pointers/References**: `Type* ptr`, `Type& ref`
- **Templates**: Always break before `>` in nested templates
- **Empty Lines**: Max 2 consecutive empty lines
- **Namespace**: No indentation (`Namespace { ... }`)
### Error Handling
- Use `PIString` for error messages
- Return bool for success/failure
- Use `assert()` for debug-only checks
- Avoid exceptions (RTTI disabled in some builds)
### Memory Management
- Prefer stack allocation
- Use `NO_COPY_CLASS(MyClass)` to disable copy
- Implement proper move semantics when needed
- Use `std::unique_ptr`/`std::shared_ptr` sparingly
### Macros
- PIMETA(...) - Add metadata for code model generator
- PIP_EXPORT - Export/import symbols for DLLs
- NO_COPY_CLASS - Disable copy constructor and operator=
- PRIVATE_DECLARATION - Private implementation macro
## Testing
- Framework: Google Test (fetched automatically when TESTS=ON)
- Test files: `tests/<module>/test<name>.cpp`
- Use `pip_test(module)` macro in `tests/CMakeLists.txt`
- Test discovery via `gtest_discover_tests()`
### Running Tests
```bash
# Run all tests
ctest
# Run specific test suite
ctest -R math -V
# List all available tests
ctest -N
# Run single test with gtest filter
./build/tests/math/pip_math_test --gtest_filter="Vector2DTest.defaultConstructor*"
```
## Module Structure
```
libs/
├── main/ # Core modules
│ ├── core/ # Base types, PIObject, PIString
│ ├── thread/ # Threading primitives
│ ├── math/ # Math functions, vectors, matrices
│ └── ...
└── <module>/ # Feature modules (fftw, crypt, compress, etc.)
```
## Additional Notes
- Project uses custom CMake macros from `cmake/` directory
- Version format: `MAJOR.MINOR.REVISION` (e.g., 5.6.0)
- All files have LGPL license header
- Support for multiple platforms: Windows, Linux, QNX, Android, Apple

View File

@@ -70,6 +70,8 @@ option(INTROSPECTION "Build with introspection" OFF)
option(TESTS "Build tests" OFF) option(TESTS "Build tests" OFF)
option(TESTS_RUN "Run tests before install step" OFF) option(TESTS_RUN "Run tests before install step" OFF)
option(COVERAGE "Build project with coverage info" OFF) option(COVERAGE "Build project with coverage info" OFF)
option(PIP_NO_FILESYSTEM "Disable filesystem support" OFF)
option(PIP_NO_THREADS "Disable threading support" OFF)
option(PIP_FFTW_F "Support fftw module for float" ON) option(PIP_FFTW_F "Support fftw module for float" ON)
option(PIP_FFTW_L "Support fftw module for long double" ON) option(PIP_FFTW_L "Support fftw module for long double" ON)
option(PIP_FFTW_Q "Support fftw module for quad double" OFF) option(PIP_FFTW_Q "Support fftw module for quad double" OFF)
@@ -223,11 +225,26 @@ if (TESTS)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
if(PIP_FREERTOS) if(PIP_MICRO)
add_definitions(-DPIP_FREERTOS) add_definitions(-DMICRO_PIP)
set(ICU OFF) set(ICU OFF)
set(LOCAL ON) set(LOCAL ON)
endif() endif()
if(PIP_FREERTOS)
add_definitions(-DPIP_FREERTOS)
endif()
if(DEFINED PICO_BOARD)
add_definitions(-DPICO_SDK)
set(PIP_NO_FILESYSTEM ON CACHE BOOL "" FORCE)
message(STATUS "Building PIP for Pi Pico SDK ${PICO_SDK_VERSION_STRING}")
endif()
if(PIP_NO_FILESYSTEM)
add_definitions(-DPIP_NO_FILESYSTEM)
endif()
if(PIP_NO_THREADS)
add_definitions(-DPIP_NO_THREADS)
endif()
# Check Bessel functions # Check Bessel functions
set(CMAKE_REQUIRED_INCLUDES math.h) set(CMAKE_REQUIRED_INCLUDES math.h)
@@ -331,7 +348,7 @@ if ((NOT DEFINED SHSTKPROJECT) AND (DEFINED ANDROID_PLATFORM))
#message("${ANDROID_NDK}/sysroot/usr/include") #message("${ANDROID_NDK}/sysroot/usr/include")
endif() endif()
if(NOT PIP_FREERTOS) if(NOT PIP_MICRO)
if(WIN32) if(WIN32)
if(${C_COMPILER} STREQUAL "cl.exe") if(${C_COMPILER} STREQUAL "cl.exe")
else() else()
@@ -352,7 +369,7 @@ if(NOT PIP_FREERTOS)
endif() endif()
endif() endif()
set(PIP_LIBS) set(PIP_LIBS)
if(PIP_FREERTOS) if(PIP_MICRO)
set(PIP_LIBS ${LIBS_MAIN}) set(PIP_LIBS ${LIBS_MAIN})
else() else()
foreach(LIB_ ${LIBS_MAIN}) foreach(LIB_ ${LIBS_MAIN})
@@ -369,11 +386,11 @@ else()
if (NOT DEFINED ANDROID_PLATFORM) if (NOT DEFINED ANDROID_PLATFORM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
endif() endif()
if(DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32")
endif()
endif() endif()
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
if(DEFINED ENV{QNX_HOST} OR PIP_MICRO)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32")
endif()
set(PCRE2_BUILD_PCRE2_8 OFF CACHE BOOL "" FORCE) set(PCRE2_BUILD_PCRE2_8 OFF CACHE BOOL "" FORCE)
set(PCRE2_BUILD_PCRE2_16 ON CACHE BOOL "" FORCE) set(PCRE2_BUILD_PCRE2_16 ON CACHE BOOL "" FORCE)
@@ -411,7 +428,7 @@ endif()
if (NOT CROSSTOOLS) if (NOT CROSSTOOLS)
if (NOT PIP_FREERTOS) if (NOT PIP_MICRO)
if (PIP_BUILD_CONSOLE) if (PIP_BUILD_CONSOLE)
pip_module(console "" "PIP console support" "" "" "") pip_module(console "" "PIP console support" "" "" "")
@@ -649,9 +666,12 @@ if (NOT CROSSTOOLS)
endif() endif()
if (PIP_BUILD_IO_UTILS) if (PIP_BUILD_IO_UTILS)
if(PIP_BUILD_CRYPT)
pip_module(io_utils "pip_crypt" "PIP I/O support" "" "" " (+crypt)") pip_module(io_utils "pip_crypt" "PIP I/O support" "" "" " (+crypt)")
else()
pip_module(io_utils "" "PIP I/O support" "" "" "")
endif()
endif() endif()
endif() endif()
endif() endif()
@@ -659,7 +679,7 @@ string(REPLACE ";" "," PIP_EXPORTS_STR "${PIP_EXPORTS}")
target_compile_definitions(pip PRIVATE "PICODE_DEFINES=\"${PIP_EXPORTS_STR}\"") target_compile_definitions(pip PRIVATE "PICODE_DEFINES=\"${PIP_EXPORTS_STR}\"")
if(NOT PIP_FREERTOS) if(NOT PIP_MICRO)
# Auxiliary # Auxiliary
if (NOT CROSSTOOLS) if (NOT CROSSTOOLS)
@@ -736,7 +756,7 @@ if(NOT LOCAL)
install(TARGETS ${PIP_MODULES} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) install(TARGETS ${PIP_MODULES} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif() endif()
else() else()
if(NOT PIP_FREERTOS) if(NOT PIP_MICRO)
if(WIN32) if(WIN32)
install(TARGETS ${PIP_MODULES} RUNTIME DESTINATION bin) install(TARGETS ${PIP_MODULES} RUNTIME DESTINATION bin)
install(TARGETS ${PIP_MODULES} ARCHIVE DESTINATION lib) install(TARGETS ${PIP_MODULES} ARCHIVE DESTINATION lib)
@@ -764,7 +784,7 @@ endif()
# #
# Build Documentation # Build Documentation
# #
if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS)) if ((NOT PIP_MICRO) AND (NOT CROSSTOOLS))
include(PIPDocumentation) include(PIPDocumentation)
find_package(Doxygen) find_package(Doxygen)
if(DOXYGEN_FOUND) if(DOXYGEN_FOUND)
@@ -833,7 +853,7 @@ message(" Type : ${CMAKE_BUILD_TYPE}")
if (NOT LOCAL) if (NOT LOCAL)
message(" Install: \"${CMAKE_INSTALL_PREFIX}\"") message(" Install: \"${CMAKE_INSTALL_PREFIX}\"")
else() else()
if(NOT PIP_FREERTOS) if(NOT PIP_MICRO)
message(" Install: local \"bin\", \"lib\" and \"include\"") message(" Install: local \"bin\", \"lib\" and \"include\"")
endif() endif()
endif() endif()
@@ -869,7 +889,7 @@ message(" Utilites:")
foreach(_util ${PIP_UTILS_LIST}) foreach(_util ${PIP_UTILS_LIST})
message(" * ${_util}") message(" * ${_util}")
endforeach() endforeach()
if(NOT PIP_FREERTOS) if(NOT PIP_MICRO)
message("") message("")
message(" Using libraries:") message(" Using libraries:")
foreach(LIB_ ${LIBS_STATUS}) foreach(LIB_ ${LIBS_STATUS})

View File

@@ -72,7 +72,7 @@ if (NOT BUILDING_PIP)
find_library(PTHREAD_LIBRARY pthread) find_library(PTHREAD_LIBRARY pthread)
find_library(UTIL_LIBRARY util) find_library(UTIL_LIBRARY util)
set(_PIP_ADD_LIBS_ ${PTHREAD_LIBRARY} ${UTIL_LIBRARY}) set(_PIP_ADD_LIBS_ ${PTHREAD_LIBRARY} ${UTIL_LIBRARY})
if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT PIP_FREERTOS)) if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT PIP_MICRO))
find_library(RT_LIBRARY rt) find_library(RT_LIBRARY rt)
list(APPEND _PIP_ADD_LIBS_ ${RT_LIBRARY}) list(APPEND _PIP_ADD_LIBS_ ${RT_LIBRARY})
endif() endif()

View File

@@ -17,6 +17,7 @@ list(APPEND COMPONENT_ADD_INCLUDEDIRS "../libs/main/thread")
set(COMPONENT_PRIV_REQUIRES pthread lwip freertos vfs spi_flash libsodium) set(COMPONENT_PRIV_REQUIRES pthread lwip freertos vfs spi_flash libsodium)
register_component() register_component()
set(PIP_FREERTOS ON) set(PIP_FREERTOS ON)
set(PIP_MICRO ON)
set(LIB OFF) set(LIB OFF)
set(INCLUDE_DIRS ${IDF_INCLUDE_DIRECTORIES}) set(INCLUDE_DIRS ${IDF_INCLUDE_DIRECTORIES})
list(APPEND INCLUDE_DIRS $ENV{IDF_PATH}/components/newlib/platform_include) list(APPEND INCLUDE_DIRS $ENV{IDF_PATH}/components/newlib/platform_include)

View File

@@ -178,6 +178,9 @@ PISystemTime uint64toST(uint64_t v) {
void PISystemMonitor::run() { void PISystemMonitor::run() {
cur_tm.clear(); cur_tm.clear();
tbid.clear(); tbid.clear();
ProcessStats tstat;
tstat.ID = pID_;
#ifndef PIP_NO_THREADS
__PIThreadCollection * pitc = __PIThreadCollection::instance(); __PIThreadCollection * pitc = __PIThreadCollection::instance();
pitc->lock(); pitc->lock();
PIVector<PIThread *> tv = pitc->threads(); PIVector<PIThread *> tv = pitc->threads();
@@ -185,12 +188,10 @@ void PISystemMonitor::run() {
if (t->isPIObject()) tbid[t->tid()] = t->name(); if (t->isPIObject()) tbid[t->tid()] = t->name();
pitc->unlock(); pitc->unlock();
// piCout << tbid.keys().toType<uint>(); // piCout << tbid.keys().toType<uint>();
ProcessStats tstat; # ifdef FREERTOS
tstat.ID = pID_;
#ifdef MICRO_PIP
for (auto * t: tv) for (auto * t: tv)
if (t->isPIObject()) gatherThread(t->tid()); if (t->isPIObject()) gatherThread(t->tid());
#else # else // FREERTOS
# ifndef WINDOWS # ifndef WINDOWS
double delay_ms = delay_.toMilliseconds(); double delay_ms = delay_.toMilliseconds();
tbid[pID_] = "main"; tbid[pID_] = "main";
@@ -210,7 +211,7 @@ void PISystemMonitor::run() {
tstat.cpu_load_user = 100.f * (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms; tstat.cpu_load_user = 100.f * (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms;
cycle = 0; cycle = 0;
// piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms; // piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms;
# else # else // MAC_OS
PRIVATE->file.seekToBegin(); PRIVATE->file.seekToBegin();
PIString str = PIString::fromAscii(PRIVATE->file.readAll()); PIString str = PIString::fromAscii(PRIVATE->file.readAll());
int si = str.find('(') + 1, fi = 0, cc = 1; int si = str.find('(') + 1, fi = 0, cc = 1;
@@ -264,8 +265,8 @@ void PISystemMonitor::run() {
if (i.flags[PIFile::FileInfo::Dot] || i.flags[PIFile::FileInfo::DotDot]) continue; if (i.flags[PIFile::FileInfo::Dot] || i.flags[PIFile::FileInfo::DotDot]) continue;
gatherThread(i.name().toInt()); gatherThread(i.name().toInt());
} }
# endif # endif // MAC_OS
# else # else // WINDOWS
if (GetProcessMemoryInfo(PRIVATE->hProc, &PRIVATE->mem_cnt, sizeof(PRIVATE->mem_cnt)) != 0) { if (GetProcessMemoryInfo(PRIVATE->hProc, &PRIVATE->mem_cnt, sizeof(PRIVATE->mem_cnt)) != 0) {
tstat.physical_memsize = PRIVATE->mem_cnt.WorkingSetSize; tstat.physical_memsize = PRIVATE->mem_cnt.WorkingSetSize;
} }
@@ -315,8 +316,9 @@ void PISystemMonitor::run() {
tstat.cpu_load_user = 0.f; tstat.cpu_load_user = 0.f;
} }
PRIVATE->tm.reset(); PRIVATE->tm.reset();
# endif # endif // WINDOWS
#endif # endif // FREERTOS
#endif // PIP_NO_THREADS
tstat.cpu_load_system = piClampf(tstat.cpu_load_system, 0.f, 100.f); tstat.cpu_load_system = piClampf(tstat.cpu_load_system, 0.f, 100.f);
tstat.cpu_load_user = piClampf(tstat.cpu_load_user, 0.f, 100.f); tstat.cpu_load_user = piClampf(tstat.cpu_load_user, 0.f, 100.f);

View File

@@ -18,6 +18,8 @@
*/ */
#include "pikbdlistener.h" #include "pikbdlistener.h"
#ifndef MICRO_PIP
# include "piincludes_p.h" # include "piincludes_p.h"
# include "piliterals.h" # include "piliterals.h"
# include "piwaitevent_p.h" # include "piwaitevent_p.h"
@@ -587,3 +589,5 @@ void PIKbdListener::setActive(bool yes) {
# endif # endif
} }
} }
#endif // MICRO_PIP

View File

@@ -25,6 +25,10 @@
#ifndef PIKBDLISTENER_H #ifndef PIKBDLISTENER_H
#define PIKBDLISTENER_H #define PIKBDLISTENER_H
#include "pibase.h"
#ifndef MICRO_PIP
# include "pithread.h" # include "pithread.h"
# include "pitime.h" # include "pitime.h"
@@ -377,4 +381,5 @@ REGISTER_PIVARIANTSIMPLE(PIKbdListener::KeyEvent)
REGISTER_PIVARIANTSIMPLE(PIKbdListener::MouseEvent) REGISTER_PIVARIANTSIMPLE(PIKbdListener::MouseEvent)
REGISTER_PIVARIANTSIMPLE(PIKbdListener::WheelEvent) REGISTER_PIVARIANTSIMPLE(PIKbdListener::WheelEvent)
#endif // MICRO_PIP
#endif // PIKBDLISTENER_H #endif // PIKBDLISTENER_H

View File

@@ -225,8 +225,10 @@ extern char ** environ;
# ifdef MICRO_PIP # ifdef MICRO_PIP
# define __PIP_TYPENAME__(T) "?" # define __PIP_TYPENAME__(T) "?"
# else # elif defined(__GXX_RTTI__) || defined(__RTTI__)
# define __PIP_TYPENAME__(T) typeid(T).name() # define __PIP_TYPENAME__(T) typeid(T).name()
# else
# define __PIP_TYPENAME__(T) "?"
# endif # endif
# ifdef CC_GCC # ifdef CC_GCC

View File

@@ -31,13 +31,14 @@
#include "pibase.h" #include "pibase.h"
#ifndef MICRO_PIP #ifndef PIP_NO_THREADS
# include "piincludes.h" # include "piincludes.h"
class PIFile; class PIFile;
class PIStringList; class PIStringList;
class PIInit;
class PIP_EXPORT __PIInit_Initializer__ { class PIP_EXPORT __PIInit_Initializer__ {
public: public:
@@ -49,6 +50,31 @@ public:
static __PIInit_Initializer__ __piinit_initializer__; static __PIInit_Initializer__ __piinit_initializer__;
#ifdef MICRO_PIP
#ifndef PIINIT_MICRO_STUB_DEFINED
#define PIINIT_MICRO_STUB_DEFINED
int __PIInit_Initializer__::count_ = 0;
PIInit * __PIInit_Initializer__::__instance__ = nullptr;
__PIInit_Initializer__::__PIInit_Initializer__() {
count_++;
if (count_ > 1) return;
__instance__ = nullptr;
}
__PIInit_Initializer__::~__PIInit_Initializer__() {
count_--;
if (count_ > 0) return;
if (__instance__ != nullptr) {
__instance__ = nullptr;
}
}
#endif
#endif
//! \~\ingroup Core //! \~\ingroup Core
//! \~\brief //! \~\brief
//! \~english Library initialization singleton and build information access point. //! \~english Library initialization singleton and build information access point.
@@ -96,5 +122,5 @@ private:
}; };
#endif // MICRO_PIP #endif // PIP_NO_THREADS
#endif // PIINIT_H #endif // PIINIT_H

View File

@@ -21,6 +21,7 @@
#include "piconditionvar.h" #include "piconditionvar.h"
#include "pithread.h" #include "pithread.h"
#include "pitime.h"
#ifndef MICRO_PIP #ifndef MICRO_PIP
# include "pifile.h" # include "pifile.h"
# include "piiostream.h" # include "piiostream.h"

View File

@@ -18,6 +18,7 @@
*/ */
#include "piwaitevent_p.h" #include "piwaitevent_p.h"
#ifndef MICRO_PIP
# ifdef WINDOWS # ifdef WINDOWS
// # ifdef _WIN32_WINNT // # ifdef _WIN32_WINNT
// # undef _WIN32_WINNT // # undef _WIN32_WINNT
@@ -151,3 +152,5 @@ void * PIWaitEvent::getEvent() const {
return nullptr; return nullptr;
# endif # endif
} }
#endif // MICRO_PIP

View File

@@ -20,6 +20,8 @@
#ifndef PIWAITEVENT_P_H #ifndef PIWAITEVENT_P_H
#define PIWAITEVENT_P_H #define PIWAITEVENT_P_H
#ifndef MICRO_PIP
# include "pibase.h" # include "pibase.h"
// clang-format off // clang-format off
#ifdef WINDOWS #ifdef WINDOWS
@@ -65,4 +67,5 @@ private:
}; };
#endif // MICRO_PIP
#endif // PIWAITEVENT_P_H #endif // PIWAITEVENT_P_H

View File

@@ -19,6 +19,8 @@
#include "piintrospection_server_p.h" #include "piintrospection_server_p.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
# include "pichunkstream.h" # include "pichunkstream.h"
# include "piinit.h" # include "piinit.h"
# include "piobject.h" # include "piobject.h"
@@ -170,3 +172,5 @@ void PIIntrospection::unpackObjects(PIByteArray & ba, PIVector<PIIntrospection::
objects.clear(); objects.clear();
ba >> objects; ba >> objects;
} }
#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)

View File

@@ -27,6 +27,7 @@
#include "piintrospection_threads_p.h" #include "piintrospection_threads_p.h"
#include "pisystemmonitor.h" #include "pisystemmonitor.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
class PIP_EXPORT PIIntrospection { class PIP_EXPORT PIIntrospection {
public: public:
@@ -168,4 +169,5 @@ BINARY_STREAM_READ(PIIntrospection::ObjectInfo) {
return s; return s;
} }
#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
#endif // PIINTROSPECTION_SERVER_P_H #endif // PIINTROSPECTION_SERVER_P_H

View File

@@ -19,6 +19,7 @@
#include "piintrospection_threads_p.h" #include "piintrospection_threads_p.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
PIIntrospectionThreads::ThreadInfo::ThreadInfo() { PIIntrospectionThreads::ThreadInfo::ThreadInfo() {
id = delay = 0; id = delay = 0;
@@ -78,3 +79,5 @@ void PIIntrospectionThreads::threadRunDone(PIThread * t, ullong us) {
ThreadInfo & ti(threads[t]); ThreadInfo & ti(threads[t]);
ti.run_us = (ti.run_us * 0.8) + (us * 0.2); /// WARNING ti.run_us = (ti.run_us * 0.8) + (us * 0.2); /// WARNING
} }
#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)

View File

@@ -20,6 +20,10 @@
#ifndef PIINTROSPECTION_THREADS_P_H #ifndef PIINTROSPECTION_THREADS_P_H
#define PIINTROSPECTION_THREADS_P_H #define PIINTROSPECTION_THREADS_P_H
#include "pibase.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
#include "pimap.h" #include "pimap.h"
#include "pithread.h" #include "pithread.h"
@@ -68,4 +72,5 @@ BINARY_STREAM_READ(PIIntrospectionThreads::ThreadInfo) {
return s; return s;
} }
#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
#endif // PIINTROSPECTION_THREADS_P_H #endif // PIINTROSPECTION_THREADS_P_H

View File

@@ -20,7 +20,7 @@
#include "pipropertystorage.h" #include "pipropertystorage.h"
#include "piwaitevent_p.h" #include "piwaitevent_p.h"
#if !defined(WINDOWS) && !defined(MAC_OS) && !defined(MICRO_PIP) #if !defined(WINDOWS) && !defined(MAC_OS) && !defined(PIP_NO_SOCKET)
# define PIP_CAN # define PIP_CAN
#endif #endif
#ifdef PIP_CAN #ifdef PIP_CAN
@@ -39,25 +39,29 @@
REGISTER_DEVICE(PICAN) REGISTER_DEVICE(PICAN)
#ifdef PIP_CAN
PRIVATE_DEFINITION_START(PICAN) PRIVATE_DEFINITION_START(PICAN)
PIWaitEvent event; PIWaitEvent event;
PRIVATE_DEFINITION_END(PICAN) PRIVATE_DEFINITION_END(PICAN)
#endif
PICAN::PICAN(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(path, mode) { PICAN::PICAN(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(path, mode) {
setThreadedReadBufferSize(256); setThreadedReadBufferSize(256);
setPath(path); setPath(path);
#ifdef PIP_CAN
can_id = 0; can_id = 0;
sock = 0; sock = 0;
PRIVATE->event.create(); PRIVATE->event.create();
#endif
} }
PICAN::~PICAN() { PICAN::~PICAN() {
stopAndWait(); stopAndWait();
close(); close();
#ifdef PIP_CAN
PRIVATE->event.destroy(); PRIVATE->event.destroy();
#endif
} }
@@ -164,7 +168,9 @@ int PICAN::readedCANID() const {
void PICAN::interrupt() { void PICAN::interrupt() {
#ifdef PIP_CAN
PRIVATE->event.interrupt(); PRIVATE->event.interrupt();
#endif
} }

View File

@@ -16,6 +16,7 @@
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIP_NO_FILESYSTEM
#include "pidir.h" #include "pidir.h"
#include "piincludes_p.h" #include "piincludes_p.h"
@@ -610,3 +611,4 @@ void PIDir::CurrentDirOverrider::save(const PIFile::FileInfo & info) {
else else
PIDir::setCurrent(PIDir::current().path() + PIDir::separator + p); PIDir::setCurrent(PIDir::current().path() + PIDir::separator + p);
} }
#endif // PIP_NO_FILESYSTEM

View File

@@ -30,6 +30,7 @@
#include "piregularexpression.h" #include "piregularexpression.h"
#ifndef PIP_NO_FILESYSTEM
//! \~\ingroup IO //! \~\ingroup IO
//! \~\brief //! \~\brief
//! \~english Local directory. //! \~english Local directory.
@@ -217,8 +218,10 @@ private:
PIString path_, scan_; PIString path_, scan_;
}; };
#endif // PIP_NO_FILESYSTEM
#ifndef PIP_NO_FILESYSTEM
inline bool operator<(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1) { inline bool operator<(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1) {
return (v0.path < v1.path); return (v0.path < v1.path);
} }
@@ -242,6 +245,7 @@ inline PICout operator<<(PICout s, const PIDir & v) {
s.restoreControls(); s.restoreControls();
return s; return s;
} }
#endif // PIP_NO_FILESYSTEM
#endif // PIDIR_H #endif // PIDIR_H

View File

@@ -18,6 +18,8 @@
*/ */
#include "piethernet.h" #include "piethernet.h"
#ifndef PIP_NO_SOCKET
# include "piconfig.h" # include "piconfig.h"
# include "piconstchars.h" # include "piconstchars.h"
# include "piincludes_p.h" # include "piincludes_p.h"
@@ -25,7 +27,7 @@
# include "pipropertystorage.h" # include "pipropertystorage.h"
# include "pisysteminfo.h" # include "pisysteminfo.h"
# include "pitranslator.h" # include "pitranslator.h"
// clang-format off
# ifdef QNX # ifdef QNX
# include <arpa/inet.h> # include <arpa/inet.h>
# include <fcntl.h> # include <fcntl.h>
@@ -49,21 +51,21 @@
# else # else
# ifdef WINDOWS # ifdef WINDOWS
# include <io.h> # include <io.h>
# include <winsock2.h>
# include <iphlpapi.h> # include <iphlpapi.h>
# include <psapi.h> # include <psapi.h>
# include <winsock2.h>
# include <ws2tcpip.h> # include <ws2tcpip.h>
# define ip_mreqn ip_mreq # define ip_mreqn ip_mreq
# define imr_address imr_interface # define imr_address imr_interface
# else # else
# include <arpa/inet.h>
# include <fcntl.h> # include <fcntl.h>
# include <sys/ioctl.h> # include <net/if.h>
# include <netdb.h>
# include <netinet/in.h> # include <netinet/in.h>
# include <netinet/tcp.h> # include <netinet/tcp.h>
# include <arpa/inet.h> # include <sys/ioctl.h>
# include <sys/socket.h> # include <sys/socket.h>
# include <netdb.h>
# include <net/if.h>
# if !defined(ANDROID) && !defined(LWIP) # if !defined(ANDROID) && !defined(LWIP)
# include <ifaddrs.h> # include <ifaddrs.h>
# endif # endif
@@ -72,7 +74,6 @@
# endif # endif
# endif # endif
# endif # endif
// clang-format on
# include "piwaitevent_p.h" # include "piwaitevent_p.h"
# include <errno.h> # include <errno.h>
@@ -196,7 +197,7 @@ void PIEthernet::construct() {
setMulticastTTL(1); setMulticastTTL(1);
server_thread_.setData(this); server_thread_.setData(this);
server_thread_.setName("_S.tcpserver"_a); server_thread_.setName("_S.tcpserver"_a);
#ifdef MICRO_PIP # ifdef LWIP
setThreadedReadBufferSize(512); setThreadedReadBufferSize(512);
# else # else
setThreadedReadBufferSize(64_KiB); setThreadedReadBufferSize(64_KiB);
@@ -1171,7 +1172,7 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
} }
if (pAdapterInfo) HeapFree(GetProcessHeap(), 0, pAdapterInfo); if (pAdapterInfo) HeapFree(GetProcessHeap(), 0, pAdapterInfo);
# else # else
# ifdef MICRO_PIP # ifdef LWIP
# else # else
# ifdef ANDROID # ifdef ANDROID
struct ifconf ifc; struct ifconf ifc;
@@ -1283,7 +1284,7 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
PINetworkAddress PIEthernet::interfaceAddress(const PIString & interface_) { PINetworkAddress PIEthernet::interfaceAddress(const PIString & interface_) {
#if defined(WINDOWS) || defined(MICRO_PIP) # if defined(WINDOWS) || defined(LWIP)
piCout << "[PIEthernet] Not implemented, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead"; piCout << "[PIEthernet] Not implemented, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead";
return PINetworkAddress(); return PINetworkAddress();
# else # else
@@ -1487,3 +1488,5 @@ bool PIEthernet::ethIsWriteable(int sock) {
return ret == 0; return ret == 0;
# endif # endif
} }
#endif // PIP_NO_SOCKET

View File

@@ -25,9 +25,12 @@
#ifndef PIETHERNET_H #ifndef PIETHERNET_H
#define PIETHERNET_H #define PIETHERNET_H
#include "piiodevice.h" #include "piiodevice.h"
#include "pinetworkaddress.h" #include "pinetworkaddress.h"
#ifndef PIP_NO_SOCKET
# ifdef ANDROID # ifdef ANDROID
struct struct
# else # else
@@ -703,4 +706,5 @@ inline bool operator!=(const PIEthernet::Interface & v0, const PIEthernet::Inter
return (v0.name != v1.name || v0.address != v1.address || v0.netmask != v1.netmask); return (v0.name != v1.name || v0.address != v1.address || v0.netmask != v1.netmask);
} }
#endif // PIP_NO_SOCKET
#endif // PIETHERNET_H #endif // PIETHERNET_H

View File

@@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIP_NO_FILESYSTEM
#include "pifile.h" #include "pifile.h"
#include "pidir.h" #include "pidir.h"
@@ -45,7 +46,7 @@
# include <utime.h> # include <utime.h>
#endif #endif
#define S_IFHDN 0x40 #define S_IFHDN 0x40
#if defined(QNX) || defined(ANDROID) || defined(FREERTOS) #if defined(QNX) || defined(ANDROID) || defined(MICRO_PIP)
# define _fopen_call_ fopen # define _fopen_call_ fopen
# define _fseek_call_ fseek # define _fseek_call_ fseek
# define _ftell_call_ ftell # define _ftell_call_ ftell
@@ -635,3 +636,4 @@ int PIFile::writeAll(const PIString & path, const PIByteArray & data) {
f.clear(); f.clear();
return f.write(data.data(), data.size_s()); return f.write(data.data(), data.size_s());
} }
#endif // PIP_NO_FILESYSTEM

View File

@@ -31,6 +31,7 @@
#include "pipropertystorage.h" #include "pipropertystorage.h"
#ifndef PIP_NO_FILESYSTEM
//! \~\ingroup IO //! \~\ingroup IO
//! \~\brief //! \~\brief
//! \~english Local file. //! \~english Local file.
@@ -361,8 +362,10 @@ private:
llong _size = -1; llong _size = -1;
PIString prec_str; PIString prec_str;
}; };
#endif // PIP_NO_FILESYSTEM
#ifndef PIP_NO_FILESYSTEM
//! \relatesalso PICout //! \relatesalso PICout
//! \~english Output operator to \a PICout. //! \~english Output operator to \a PICout.
//! \~russian Оператор вывода в \a PICout. //! \~russian Оператор вывода в \a PICout.
@@ -395,5 +398,6 @@ BINARY_STREAM_READ(PIFile::FileInfo) {
v.perm_group.raw >> v.perm_other.raw; v.perm_group.raw >> v.perm_other.raw;
return s; return s;
} }
#endif // PIP_NO_FILESYSTEM
#endif // PIFILE_H #endif // PIFILE_H

View File

@@ -19,6 +19,8 @@
#include "piserial.h" #include "piserial.h"
#ifndef MICRO_PIP
# include "piconfig.h" # include "piconfig.h"
# include "pidir.h" # include "pidir.h"
# include "piincludes_p.h" # include "piincludes_p.h"
@@ -29,9 +31,6 @@
# include <errno.h> # include <errno.h>
#if defined(MICRO_PIP)
# define PISERIAL_NO_PINS
#endif
# if defined(PISERIAL_NO_PINS) || defined(WINDOWS) # if defined(PISERIAL_NO_PINS) || defined(WINDOWS)
# define TIOCM_LE 1 # define TIOCM_LE 1
# define TIOCM_DTR 4 # define TIOCM_DTR 4
@@ -1318,3 +1317,5 @@ void PISerial::threadedReadBufferSizeChanged() {
// piCoutObj << "a" << ss.xmit_fifo_size; // piCoutObj << "a" << ss.xmit_fifo_size;
# endif # endif
} }
#endif // MICRO_PIP

View File

@@ -153,8 +153,14 @@
#ifdef PIP_FREERTOS #ifdef PIP_FREERTOS
# define FREERTOS # define FREERTOS
#endif #endif
#if defined(FREERTOS) || defined(PLATFORMIO) #ifdef MICRO_PIP
# define MICRO_PIP # ifndef FREERTOS
# define PIP_NO_THREADS
# endif
# ifndef LWIP
# define PIP_NO_SOCKET
# endif
# define PISERIAL_NO_PINS
#endif #endif
#ifndef WINDOWS #ifndef WINDOWS
# ifndef QNX # ifndef QNX

View File

@@ -41,7 +41,11 @@ template<typename... Args>
class Function: public FunctionBase { class Function: public FunctionBase {
public: public:
uint formatHash() override { uint formatHash() override {
#if defined(__GXX_RTTI__) || defined(__RTTI__)
static uint ret = PIConstChars(typeid(std::function<void(Args...)>).name()).hash(); static uint ret = PIConstChars(typeid(std::function<void(Args...)>).name()).hash();
#else
static uint ret = 0;
#endif
return ret; return ret;
} }
std::function<bool(Args...)> func; std::function<bool(Args...)> func;

View File

@@ -7,6 +7,7 @@
# include "pifile.h" # include "pifile.h"
# include "piiostream.h" # include "piiostream.h"
# ifdef LINUX
# include <fcntl.h> # include <fcntl.h>
# include <linux/input-event-codes.h> # include <linux/input-event-codes.h>
# include <linux/input.h> # include <linux/input.h>
@@ -14,6 +15,14 @@
# include <sys/time.h> # include <sys/time.h>
# include <unistd.h> # include <unistd.h>
# else # else
// Stubs for embedded/non-Linux builds
# define EV_SYN 0
# define EV_KEY 1
# define EV_REL 2
# define EV_ABS 3
# define EVIOCGABS(_v) 0
# endif
#else
// clang-format off // clang-format off
# undef _WIN32_WINNT # undef _WIN32_WINNT
# define _WIN32_WINNT 0x0600 # define _WIN32_WINNT 0x0600
@@ -399,6 +408,7 @@ PIVector<PIHIDeviceInfo> PIHIDevice::allDevices(bool try_open) {
ullong bits = readFile(hd_i.path + file).toULLong(16); ullong bits = readFile(hd_i.path + file).toULLong(16);
// piCout<< PICoutManipulators::Bin << abs; // piCout<< PICoutManipulators::Bin << abs;
if (bits > 0) { if (bits > 0) {
#ifdef LINUX
int fd = ::open(dev.path.dataAscii(), O_RDONLY); int fd = ::open(dev.path.dataAscii(), O_RDONLY);
if (fd < 0) { if (fd < 0) {
// piCout << "Warning: can`t open" << dev.path << errorString(); // piCout << "Warning: can`t open" << dev.path << errorString();
@@ -423,6 +433,19 @@ PIVector<PIHIDeviceInfo> PIHIDevice::allDevices(bool try_open) {
} }
} }
if (fd >= 0) ::close(fd); if (fd >= 0) ::close(fd);
#else
// Stub implementation for non-Linux builds
PIHIDeviceInfo::AxisInfo ai;
ai.is_relative = is_relative;
ai.min = 0;
ai.max = 1024;
for (int bit = 0; bit < 64; ++bit) {
if (checkBit(bits, bit, PIString::fromNumber(bit))) {
ai.data_index = bit;
ret << ai;
}
}
#endif
} }
return ret; return ret;
}; };

View File

@@ -23,6 +23,7 @@
# define _WIN32_WINNT 0x0600 # define _WIN32_WINNT 0x0600
#endif #endif
#ifndef PIP_NO_THREADS
#include "piconditionvar.h" #include "piconditionvar.h"
#include "piincludes_p.h" #include "piincludes_p.h"
#ifdef WINDOWS #ifdef WINDOWS
@@ -175,3 +176,4 @@ void PIConditionVariable::notifyAll() {
pthread_cond_broadcast(&PRIVATE->nativeHandle); pthread_cond_broadcast(&PRIVATE->nativeHandle);
#endif #endif
} }
#endif // PIP_NO_THREADS

View File

@@ -28,6 +28,8 @@
#include "pimutex.h" #include "pimutex.h"
#include "pisystemtime.h" #include "pisystemtime.h"
#ifndef PIP_NO_THREADS
//! \~\ingroup Thread //! \~\ingroup Thread
//! \~\brief //! \~\brief
//! \~english Condition variable used together with external %PIMutex. //! \~english Condition variable used together with external %PIMutex.
@@ -173,5 +175,5 @@ private:
PRIVATE_DECLARATION(PIP_EXPORT) PRIVATE_DECLARATION(PIP_EXPORT)
}; };
#endif // PIP_NO_THREADS
#endif // PICONDITIONVAR_H #endif // PICONDITIONVAR_H

View File

@@ -107,6 +107,7 @@
//! \} //! \}
#ifndef PIP_NO_THREADS
#include "pimutex.h" #include "pimutex.h"
#include "piincludes_p.h" #include "piincludes_p.h"
@@ -228,3 +229,4 @@ void PIMutex::destroy() {
pthread_mutex_destroy(&(PRIVATE->mutex)); pthread_mutex_destroy(&(PRIVATE->mutex));
#endif #endif
} }
#endif // PIP_NO_THREADS

View File

@@ -28,6 +28,7 @@
#include "piinit.h" #include "piinit.h"
#ifndef PIP_NO_THREADS
//! \~\ingroup Thread //! \~\ingroup Thread
//! \~\brief //! \~\brief
//! \~english Mutex for mutual exclusion between threads. //! \~english Mutex for mutual exclusion between threads.
@@ -93,5 +94,5 @@ private:
bool cond; bool cond;
}; };
#endif // PIP_NO_THREADS
#endif // PIMUTEX_H #endif // PIMUTEX_H

View File

@@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIP_NO_THREADS
#include "pithread.h" #include "pithread.h"
#include "piincludes_p.h" #include "piincludes_p.h"
@@ -1086,3 +1087,4 @@ bool PIThread::_waitForFinish(PISystemTime max_tm) {
#endif #endif
return false; return false;
} }
#endif // PIP_NO_THREADS

View File

@@ -43,6 +43,7 @@
class PIThread; class PIThread;
#ifndef PIP_NO_THREADS
#ifndef MICRO_PIP #ifndef MICRO_PIP
class PIIntrospectionThreads; class PIIntrospectionThreads;
@@ -339,5 +340,5 @@ private:
void setThreadName(); void setThreadName();
}; };
#endif // PIP_NO_THREADS
#endif // PITHREAD_H #endif // PITHREAD_H

View File

@@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIP_NO_THREADS
#include "pitimer.h" #include "pitimer.h"
#include "piconditionvar.h" #include "piconditionvar.h"
@@ -315,3 +316,4 @@ void PITimer::stop() {
thread->stop(); thread->stop();
event.notifyAll(); event.notifyAll();
} }
#endif // PIP_NO_THREADS

View File

@@ -44,6 +44,7 @@
class PIThread; class PIThread;
#ifndef PIP_NO_THREADS
//! \~\ingroup Thread //! \~\ingroup Thread
//! \~\brief //! \~\brief
//! \~english Periodic timer that emits ticks from an internal worker thread. //! \~english Periodic timer that emits ticks from an internal worker thread.
@@ -246,5 +247,5 @@ protected:
PIConditionVariable event; PIConditionVariable event;
}; };
#endif // PIP_NO_THREADS
#endif // PITIMER_H #endif // PITIMER_H

View File

@@ -26,6 +26,8 @@
# include "pisystemtests.h" # include "pisystemtests.h"
#elif defined(ARDUINO) #elif defined(ARDUINO)
# include <Arduino.h> # include <Arduino.h>
#elif defined(PICO_SDK)
# include "hardware/time.h"
#endif #endif
#ifdef MICRO_PIP #ifdef MICRO_PIP
# include <sys/time.h> # include <sys/time.h>
@@ -48,15 +50,13 @@
void piUSleep(int usecs) { void piUSleep(int usecs) {
if (usecs <= 0) return; if (usecs <= 0) return;
#ifdef WINDOWS #ifdef WINDOWS
// printf("Sleep %d\n", usecs / 1000); Sleep(usecs / 1000);
if (usecs > 0) Sleep(usecs / 1000); #elif defined(FREERTOS)
// printf("Sleep end");
#else
# ifdef FREERTOS
vTaskDelay(usecs / 1000 / portTICK_PERIOD_MS); vTaskDelay(usecs / 1000 / portTICK_PERIOD_MS);
#elif defined(PICO_SDK)
sleep_us(usecs);
#else #else
usecs -= PISystemTests::usleep_offset_us; usecs -= PISystemTests::usleep_offset_us;
if (usecs > 0) usleep(usecs); if (usecs > 0) usleep(usecs);
#endif #endif
#endif
} }

View File

@@ -54,12 +54,16 @@ public:
} }
#ifdef MICRO_PIP #ifdef MICRO_PIP
PIString typeName() const final { PIString typeName() const final {
static PIString ret(PIVariant(T()).typeName()); static PIString ret(PIVariant::fromValue<T>(T()).typeName());
return ret; return ret;
} }
#else #else
PIString typeName() const final { PIString typeName() const final {
#if defined(__GXX_RTTI__) || defined(__RTTI__)
static PIString ret(typeid(T).name()); static PIString ret(typeid(T).name());
#else
static PIString ret("unknown");
#endif
return ret; return ret;
} }
#endif #endif