diff --git a/libraries/STM32PWR/examples/SleepMode/SleepMode.ino b/libraries/STM32PWR/examples/SleepMode/SleepMode.ino deleted file mode 100644 index 51ed733..0000000 --- a/libraries/STM32PWR/examples/SleepMode/SleepMode.ino +++ /dev/null @@ -1,39 +0,0 @@ -/* - SleepMode.ino - - Written by Jeff Wu (jeff@arduino.org) - - This example for the Arduino Primo board shows how to use - stm32pwr library. - The STM32 has two functions for power savings. One is sleep mode, - and the other is standby mode. The USER1 BUTTON allows you setup - as an interrupt to trigger STM32 enter to sleep mode or wake up - from sleep mode. When the Primo board is powered by USB cable and - battery, and then disconnect the USB cable, the STM32 will enter - to standby mode or the Primo board is only powered by battery. - Waiting for Primo board reconnect to USB cable to wake up from - standby mode. The disableStandbyMode() function allows you to - disable STM32 enter to standby mode when the Primo disconnect - the USB cable. - - This example code is in the public domain. - -*/ - -#include - -void setup() { - // start serial port at 9600 bps - Serial.begin(9600); - // setup USER1_BUTTON as an interrupt to trigger STM32 - // enter to sleep mode or wake up from sleep mode - stm32pwr.enableSleepMode(); - // disable STM32 enter to standby mode - stm32pwr.disableStandbyMode() ; -} - -void loop() { - //Waiting for USER1 BUTTON press trigger STM32 enter to sleep mode - Serial.println("Waiting for USER1 BUTTON press"); - delay(5000); -} \ No newline at end of file diff --git a/libraries/STM32PWR/examples/WiFiPowerManagement/WiFiPowerManagement.ino b/libraries/STM32PWR/examples/WiFiPowerManagement/WiFiPowerManagement.ino deleted file mode 100644 index 2f689f4..0000000 --- a/libraries/STM32PWR/examples/WiFiPowerManagement/WiFiPowerManagement.ino +++ /dev/null @@ -1,45 +0,0 @@ -/* - WiFiPowerManagement.ino - - Written by Jeff Wu (jeff@arduino.org) - - This example for the Arduino Primo board shows how to use - stm32pwr library. - The STM32 is able to turn the WiFi on or off directly, - Reducing the power consumption of Primo board. - - This example code is in the public domain. - -*/ - -#include - -int reading; // the current reading from the input pin -int state = true; //variable for setting WiFi status -long last_time = 0; // the last time the output pin was toggled -long debounce = 200; // the debounce time, increase if the output flickers - -void setup() { - // initialize the pushbutton pin as an input: - pinMode(USER2_BUTTON, INPUT); -} - -void loop() { - // read the state of the USER2 BUTTON value: - reading = digitalRead(USER2_BUTTON); - - // if the input is LOW and we've Waiting long enough to ignore any noise - // on the circuit, toggle the output pin and remember the time - if(reading == 0 && millis() - last_time > debounce ) { - state = !state; // reverse state - if(state == true) { - stm32pwr.powerOnWiFi(); //turn the WiFi on - stm32pwr.enableWiFi(); //enable WiFi - } - else { - stm32pwr.powerOffWiFi(); //turn the WiFi off - stm32pwr.disableWiFi(); //disable WiFi - } - last_time = millis(); - } -} \ No newline at end of file diff --git a/libraries/STM32PWR/keywords.txt b/libraries/STM32PWR/keywords.txt deleted file mode 100644 index fd4ca2b..0000000 --- a/libraries/STM32PWR/keywords.txt +++ /dev/null @@ -1,24 +0,0 @@ -####################################### -# Syntax Coloring Map stm32pwr -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -stm32pwr KEYWORD1 - -####################################### -# Methods and Functions (KEYWORD2) -####################################### - -powerOnWiFi KEYWORD2 -powerOffWiFi KEYWORD2 -enableWiFi KEYWORD2 -disableWiFi KEYWORD2 -enableSleepMode KEYWORD2 -disableStandbyMode KEYWORD2 - -####################################### -# Constants (LITERAL1) -####################################### diff --git a/libraries/STM32PWR/library.properties b/libraries/STM32PWR/library.properties deleted file mode 100644 index cf1d058..0000000 --- a/libraries/STM32PWR/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=STM32PWR -version=0.0.1 -author=Jeff Wu -maintainer=Arduino -sentence=stm32pwr -paragraph=Allows STM32 enter to Sleep mode or standby mode -category=Communication -url=http://www.arduino.org/learning/reference/stm32pwr -architectures=nrf52 \ No newline at end of file diff --git a/libraries/STM32PWR/stm32pwr.cpp b/libraries/STM32PWR/stm32pwr.cpp deleted file mode 100644 index 61dd80a..0000000 --- a/libraries/STM32PWR/stm32pwr.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -**************************************************************************** -* Copyright (c) 2017 Arduino srl. All right reserved. -* -* File : stm32pwr.cpp -* Date : 2017/04/30 -* Revision : 0.0.1 $ -* Author: jeff[at]arduino[dot]org -* -**************************************************************************** - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - -#include "stm32pwr.h" - - - -void stm32pwrClass::powerOnWiFi() -{ - digitalWrite(GPIO_ESP_PW, HIGH); -} - -void stm32pwrClass::powerOffWiFi() -{ - digitalWrite(GPIO_ESP_PW, LOW); -} - -void stm32pwrClass::enableWiFi() -{ - digitalWrite(GPIO_ESP_EN, HIGH); -} - -void stm32pwrClass::disableWiFi() -{ - digitalWrite(GPIO_ESP_EN, LOW); -} - -void stm32pwrClass::enableSleepMode() -{ - pinMode(USER1_BUTTON, STM32_IT); -} - -void stm32pwrClass::disableStandbyMode() -{ - pinMode(BAT_VOL, INPUT); -} - - -stm32pwrClass stm32pwr; diff --git a/libraries/STM32PWR/stm32pwr.h b/libraries/STM32PWR/stm32pwr.h deleted file mode 100644 index a669abf..0000000 --- a/libraries/STM32PWR/stm32pwr.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -**************************************************************************** -* Copyright (c) 2017 Arduino srl. All right reserved. -* -* File : stm32pwr.h -* Date : 2017/04/30 -* Revision : 0.0.1 $ -* Author: jeff[at]arduino[dot]org -* -**************************************************************************** - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - -#ifndef STM32PWR_h -#define STM32PWR_h - -#include "Arduino.h" - -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif - - -class stm32pwrClass{ - - public: - - /** - * \turn the WiFi on - */ - void powerOnWiFi(void) ; - - /** - * \turn the WiFi off - */ - void powerOffWiFi(void) ; - - /** - * \enable WiFi - */ - void enableWiFi(void) ; - - /** - * \disable WiFi - */ - void disableWiFi(void) ; - - /** - * \setup USER1_BUTTON as an interrupt to trigger STM32 enter to sleep mode or wake up from sleep mode - */ - void enableSleepMode(void) ; - - /** - * \disable STM32 enter to standby mode - */ - void disableStandbyMode(void) ; - - private: - -}; - -extern stm32pwrClass stm32pwr; - -#endif //STM32PWR_h \ No newline at end of file