refactor: migrate MICRO_PIP to fine-grained feature flags
Replace monolithic MICRO_PIP/PIP_MICRO with granular flags: Feature flags (CMake options + platform auto-detection): - PIP_NO_FILESYSTEM, PIP_NO_THREADS, PIP_NO_SOCKET - PIP_NO_PROCESS, PIP_NO_DYNLIB, PIP_NO_FFT, PIP_NO_SERIAL Embedded optimization flag: - PIP_EMBEDDED (auto-set for Pico SDK and FreeRTOS) Controls buffer sizes, time stubs, terminal fallback, init stubs Platform blocks in CMakeLists.txt: - Pico SDK: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL; conditionally disables THREADS (no FreeRTOS) and SOCKET (no LWIP) - FreeRTOS: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL; conditionally disables SOCKET (no LWIP) - Android: auto-disables PROCESS, DYNLIB, FFT Updated 96 files across libs/, utils/, tests/, and CMakeLists.txt. Builds verified for Linux (547 tests pass) and Pico SDK (100%). Removed all MICRO_PIP and PIP_MICRO references (0 remaining).
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#endif
|
||||
#include "piliterals.h"
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
|
||||
//! \class PIGPIO pigpio.h
|
||||
//! \~english \section PIGPIO_sec0 Synopsis
|
||||
@@ -74,7 +75,7 @@ PIGPIO::~PIGPIO() {
|
||||
stop();
|
||||
waitForFinish(100_ms);
|
||||
PIMutexLocker ml(mutex);
|
||||
#ifdef GPIO_SYS_CLASS
|
||||
# ifdef GPIO_SYS_CLASS
|
||||
PIVector<int> ids = gpio_.keys();
|
||||
for (int i = 0; i < ids.size_s(); i++) {
|
||||
GPIOData & g(gpio_[ids[i]]);
|
||||
@@ -84,7 +85,7 @@ PIGPIO::~PIGPIO() {
|
||||
}
|
||||
}
|
||||
gpio_.clear();
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +101,7 @@ PIString PIGPIO::GPIOName(int gpio_num) {
|
||||
|
||||
|
||||
void PIGPIO::exportGPIO(int gpio_num) {
|
||||
#ifdef GPIO_SYS_CLASS
|
||||
# ifdef GPIO_SYS_CLASS
|
||||
PIString valfile = "/sys/class/gpio/" + GPIOName(gpio_num) + "/value";
|
||||
int fd = ::open(valfile.dataAscii(), O_RDONLY);
|
||||
if (fd != -1) {
|
||||
@@ -120,12 +121,12 @@ void PIGPIO::exportGPIO(int gpio_num) {
|
||||
piMSleep(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void PIGPIO::openGPIO(GPIOData & g) {
|
||||
#ifdef GPIO_SYS_CLASS
|
||||
# ifdef GPIO_SYS_CLASS
|
||||
if (g.fd != -1) {
|
||||
::close(g.fd);
|
||||
g.fd = -1;
|
||||
@@ -133,12 +134,12 @@ void PIGPIO::openGPIO(GPIOData & g) {
|
||||
PIString fp = "/sys/class/gpio/" + g.name + "/value";
|
||||
g.fd = ::open(fp.dataAscii(), O_RDWR);
|
||||
// piCoutObj << "initGPIO" << g.num << ":" << fp << g.fd << errorString();
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
bool PIGPIO::getPinState(int gpio_num) {
|
||||
#ifdef GPIO_SYS_CLASS
|
||||
# ifdef GPIO_SYS_CLASS
|
||||
GPIOData & g(gpio_[gpio_num]);
|
||||
char r = 0;
|
||||
int ret = 0;
|
||||
@@ -151,7 +152,7 @@ bool PIGPIO::getPinState(int gpio_num) {
|
||||
}
|
||||
}
|
||||
// piCoutObj << "pinState" << gpio_num << ":" << ret << (int)r << errorString();
|
||||
#endif
|
||||
# endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -201,9 +202,9 @@ void PIGPIO::end() {
|
||||
for (int i = 0; i < ids.size_s(); i++) {
|
||||
GPIOData & g(gpio_[ids[i]]);
|
||||
if (g.fd != -1) {
|
||||
#ifdef GPIO_SYS_CLASS
|
||||
# ifdef GPIO_SYS_CLASS
|
||||
::close(g.fd);
|
||||
#endif
|
||||
# endif
|
||||
g.fd = -1;
|
||||
}
|
||||
}
|
||||
@@ -211,7 +212,7 @@ void PIGPIO::end() {
|
||||
|
||||
|
||||
void PIGPIO::initPin(int gpio_num, Direction dir) {
|
||||
#ifdef GPIO_SYS_CLASS
|
||||
# ifdef GPIO_SYS_CLASS
|
||||
PIMutexLocker ml(mutex);
|
||||
GPIOData & g(gpio_[gpio_num]);
|
||||
if (g.num == -1) {
|
||||
@@ -228,12 +229,12 @@ void PIGPIO::initPin(int gpio_num, Direction dir) {
|
||||
default: break;
|
||||
}
|
||||
openGPIO(g);
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void PIGPIO::pinSet(int gpio_num, bool value) {
|
||||
#ifdef GPIO_SYS_CLASS
|
||||
# ifdef GPIO_SYS_CLASS
|
||||
PIMutexLocker ml(mutex);
|
||||
GPIOData & g(gpio_[gpio_num]);
|
||||
int ret = 0;
|
||||
@@ -245,7 +246,7 @@ void PIGPIO::pinSet(int gpio_num, bool value) {
|
||||
ret = ::write(g.fd, "0", 1);
|
||||
}
|
||||
// piCoutObj << "pinSet" << gpio_num << ":" << ret << errorString();
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
@@ -267,9 +268,9 @@ void PIGPIO::pinBeginWatch(int gpio_num) {
|
||||
PIMutexLocker ml(mutex);
|
||||
GPIOData & g(gpio_[gpio_num]);
|
||||
if (g.fd != -1) {
|
||||
#ifdef GPIO_SYS_CLASS
|
||||
# ifdef GPIO_SYS_CLASS
|
||||
::close(g.fd);
|
||||
#endif
|
||||
# endif
|
||||
g.fd = -1;
|
||||
}
|
||||
watch_state.insert(gpio_num, false);
|
||||
@@ -304,6 +305,8 @@ void PIGPIO::clearWatch() {
|
||||
}
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
# ifdef __GNUC__
|
||||
// # pragma GCC diagnostic pop
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif // PIP_NO_THREADS
|
||||
|
||||
Reference in New Issue
Block a user