System interrupts
System features
The system allows to alter certain aspects of its default behavior via the system features. The following system features are defined:
FEATURE_RETAINED_MEMORY
: enables/disables retained memory on backup power (disabled by default) (see Enabling Backup RAM (SRAM))FEATURE_WIFI_POWERSAVE_CLOCK
: enables/disables the Wi-Fi Powersave Clock on P1S6 on P1 (enabled by default).
FEATURE_RETAINED_MEMORY
Enables/disables retained memory on backup power (disabled by default) (see Enabling Backup RAM (SRAM))
// SYNTAX
// enable RETAINED MEMORY
System.enableFeature(FEATURE_RETAINED_MEMORY);
// disable RETAINED MEMORY (default)
System.disableFeature(FEATURE_RETAINED_MEMORY);
FEATURE_WIFI_POWERSAVE_CLOCK
Since 0.6.1:
This feature is only available on the P1, and is enabled by default.
// SYNTAX
// enable POWERSAVE_CLOCK on P1S6 on P1 (default)
System.enableFeature(FEATURE_WIFI_POWERSAVE_CLOCK);
// disable POWERSAVE_CLOCK on P1S6 on P1
System.disableFeature(FEATURE_WIFI_POWERSAVE_CLOCK);
Enables/disables the Wi-Fi Powersave Clock on P1S6 on P1 (enabled by default). Useful for gaining 1 additional GPIO or PWM output on the P1. When disabled, the 32kHz oscillator will not be running on this pin, and subsequently Wi-Fi Eco Mode (to be defined in the future) will not be usable.
Note: the FEATURE_WIFI_POWERSAVE_CLOCK feature setting is remembered even after power off or when entering safe mode. This is to allow your device to be configured once and then continue to function with the feature enabled/disabled.
// Use the STARTUP() macro to disable the powersave clock at the time of boot
STARTUP(System.disableFeature(FEATURE_WIFI_POWERSAVE_CLOCK));
void setup() {
pinMode(P1S6, OUTPUT);
analogWrite(P1S6, 128); // set PWM output on P1S6 to 50% duty cycle
}
void loop() {
// your loop code
}