Skip to content

Commit 099e0fe

Browse files
committed
Revert back to LowPower instead of Power
1 parent 2dcdcfb commit 099e0fe

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

examples/gps_tracker/gps_tracker.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#include <http_client.h>
1313
#include <led_ctrl.h>
1414
#include <log.h>
15+
#include <low_power.h>
1516
#include <lte.h>
1617
#include <mcp9808.h>
17-
#include <power.h>
1818
#include <veml3328.h>
1919

2020
#define GPSSerial Serial2
@@ -193,7 +193,7 @@ void setup() {
193193

194194
// We configure the low power module for power down configuration, where
195195
// the LTE modem and the CPU will be powered down
196-
Power.configurePowerDown();
196+
LowPower.configurePowerDown();
197197

198198
// Make sure sensors are turned off
199199
Veml3328.begin();
@@ -250,7 +250,7 @@ void loop() {
250250
GPS.sendCommand(PMTK_STANDBY);
251251
delay(1000); // Allow some time to print messages before we sleep
252252

253-
Power.powerDown(60);
253+
LowPower.powerDown(60);
254254

255255
Log.info("Woke up!");
256256
GPS.sendCommand(PMTK_AWAKE);

examples/power_down/power_down.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#include <avr/io.h>
1212
#include <led_ctrl.h>
1313
#include <log.h>
14+
#include <low_power.h>
1415
#include <lte.h>
1516
#include <mcp9808.h>
16-
#include <power.h>
1717
#include <veml3328.h>
1818

1919
#define SW0 PIN_PD2
@@ -39,7 +39,7 @@ void setup() {
3939

4040
// Now we configure the low power module for power down configuration, where
4141
// the cellular modem and the CPU will be powered down
42-
Power.configurePowerDown();
42+
LowPower.configurePowerDown();
4343

4444
// Make sure sensors are turned off
4545
Veml3328.begin();
@@ -61,7 +61,7 @@ void loop() {
6161
delay(100);
6262

6363
// Power down for 60 seconds
64-
Power.powerDown(60);
64+
LowPower.powerDown(60);
6565

6666
Log.info("Woke up!");
6767

examples/power_print_voltage/power_print_voltage.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include <led_ctrl.h>
1313
#include <log.h>
14-
#include <power.h>
14+
#include <low_power.h>
1515

1616
void setup() {
1717
Log.begin(115200);
@@ -25,7 +25,7 @@ void setup() {
2525

2626
void loop() {
2727

28-
float voltage = Power.getSupplyVoltage();
28+
float voltage = LowPower.getSupplyVoltage();
2929

3030
// Note that in order to print floats, you have to set printf support to
3131
// full in the Arduino IDE. Go to Tools -> printf() -> Full

examples/power_save/power_save.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#include <avr/io.h>
1212
#include <led_ctrl.h>
1313
#include <log.h>
14+
#include <low_power.h>
1415
#include <lte.h>
1516
#include <mcp9808.h>
16-
#include <power.h>
1717
#include <sequans_controller.h>
1818
#include <veml3328.h>
1919

@@ -67,7 +67,7 @@ void setup() {
6767
// CPU to sleep. When the time period is over, the CPU is woken at the same
6868
// time as the cellular modem is woken up.
6969

70-
Power.configurePeriodicPowerSave(
70+
LowPower.configurePeriodicPowerSave(
7171
PowerSaveModePeriodMultiplier::THIRTY_SECONDS,
7272
2);
7373

@@ -87,7 +87,7 @@ void loop() {
8787
Log.info("Power saving...");
8888
delay(100);
8989

90-
Power.powerSave();
90+
LowPower.powerSave();
9191

9292
Log.info("Woke up!");
9393

src/power.cpp renamed to src/low_power.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "led_ctrl.h"
22
#include "log.h"
3+
#include "low_power.h"
34
#include "lte.h"
4-
#include "power.h"
55
#include "sequans_controller.h"
66

77
#include <Arduino.h>
@@ -100,7 +100,7 @@
100100
#endif
101101

102102
// Singleton. Defined for use of the rest of the library.
103-
PowerClass Power = PowerClass::instance();
103+
LowPowerClass LowPower = LowPowerClass::instance();
104104

105105
static volatile bool ring_line_activity = false;
106106
static volatile bool modem_is_in_power_save = false;
@@ -414,7 +414,7 @@ static void disableLDO(void) {
414414
delay(10);
415415
}
416416

417-
void PowerClass::configurePowerDown(void) {
417+
void LowPowerClass::configurePowerDown(void) {
418418

419419
// We need sequans controller to be initialized first before configuration.
420420
// This is because we need to disable the PSM mode so that the modem don't
@@ -428,7 +428,7 @@ void PowerClass::configurePowerDown(void) {
428428
SequansController.writeCommand(AT_COMMAND_DISABLE_PSM);
429429
}
430430

431-
void PowerClass::configurePeriodicPowerSave(
431+
void LowPowerClass::configurePeriodicPowerSave(
432432
const PowerSaveModePeriodMultiplier power_save_mode_period_multiplier,
433433
const uint8_t power_save_mode_period_value) {
434434

@@ -483,7 +483,7 @@ void PowerClass::configurePeriodicPowerSave(
483483
SequansController.writeCommand(command);
484484
}
485485

486-
void PowerClass::powerSave(void) {
486+
void LowPowerClass::powerSave(void) {
487487

488488
const uint8_t cell_led_state = digitalRead(LedCtrl.getLedPin(Led::CELL));
489489
const uint8_t con_led_state = digitalRead(LedCtrl.getLedPin(Led::CON));
@@ -549,7 +549,7 @@ void PowerClass::powerSave(void) {
549549
}
550550
}
551551

552-
void PowerClass::powerDown(const uint32_t power_down_time_seconds) {
552+
void LowPowerClass::powerDown(const uint32_t power_down_time_seconds) {
553553

554554
const unsigned long start_time_ms = millis();
555555

@@ -586,7 +586,7 @@ void PowerClass::powerDown(const uint32_t power_down_time_seconds) {
586586
while (!Lte.begin()) {}
587587
}
588588

589-
float PowerClass::getSupplyVoltage(void) {
589+
float LowPowerClass::getSupplyVoltage(void) {
590590

591591
if (!digitalRead(VOLTAGE_MEASURE_EN_PIN)) {
592592
pinConfigure(VOLTAGE_MEASURE_EN_PIN, PIN_DIR_OUTPUT);

src/power.h renamed to src/low_power.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef POWER_H
2-
#define POWER_H
1+
#ifndef LOW_POWER_H
2+
#define LOW_POWER_H
33

44
#include <stdint.h>
55
#include <stdlib.h>
@@ -19,26 +19,26 @@ enum class PowerSaveModePeriodMultiplier {
1919
ONE_MINUTE = 5,
2020
};
2121

22-
class PowerClass {
22+
class LowPowerClass {
2323

2424
private:
2525
/**
2626
* @brief Hide constructor in order to enforce a single instance of the
2727
* class.
2828
*/
29-
PowerClass(){};
29+
LowPowerClass(){};
3030

3131
public:
3232
/**
3333
* @brief Singleton instance.
3434
*/
35-
static PowerClass& instance(void) {
36-
static PowerClass instance;
35+
static LowPowerClass& instance(void) {
36+
static LowPowerClass instance;
3737
return instance;
3838
}
3939

4040
/**
41-
* @brief Configures the power module for power down configuration.
41+
* @brief Configures the low power module for power down configuration.
4242
*/
4343
void configurePowerDown(void);
4444

@@ -90,6 +90,6 @@ class PowerClass {
9090
float getSupplyVoltage(void);
9191
};
9292

93-
extern PowerClass Power;
93+
extern LowPowerClass LowPower;
9494

9595
#endif

0 commit comments

Comments
 (0)