File tree Expand file tree Collapse file tree 2 files changed +10
-18
lines changed
features/cellular/framework/targets/QUECTEL/EC2X Expand file tree Collapse file tree 2 files changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -66,29 +66,27 @@ CellularDevice *CellularDevice::get_default_instance()
66
66
return &device;
67
67
}
68
68
69
- nsapi_error_t QUECTEL_EC2X::hard_power_on ( )
69
+ nsapi_error_t QUECTEL_EC2X::press_power_button ( uint32_t timeout )
70
70
{
71
71
if (_pwr_key.is_connected ()) {
72
72
_pwr_key = 1 ;
73
- ThisThread::sleep_for (600 );
73
+ ThisThread::sleep_for (timeout );
74
74
_pwr_key = 0 ;
75
75
ThisThread::sleep_for (100 );
76
76
}
77
77
78
78
return NSAPI_ERROR_OK;
79
79
}
80
80
81
+ nsapi_error_t QUECTEL_EC2X::hard_power_on ()
82
+ {
83
+ return press_power_button (600 );
84
+ }
85
+
81
86
nsapi_error_t QUECTEL_EC2X::hard_power_off ()
82
87
83
88
{
84
- if (_pwr_key.is_connected ()) {
85
- _pwr_key = 1 ;
86
- ThisThread::sleep_for (750 );
87
- _pwr_key = 0 ;
88
- ThisThread::sleep_for (100 );
89
- }
90
-
91
- return NSAPI_ERROR_OK;
89
+ return press_power_button (750 );
92
90
}
93
91
94
92
nsapi_error_t QUECTEL_EC2X::soft_power_on ()
@@ -119,14 +117,7 @@ nsapi_error_t QUECTEL_EC2X::soft_power_on()
119
117
120
118
nsapi_error_t QUECTEL_EC2X::soft_power_off ()
121
119
{
122
- if (_pwr_key.is_connected ()) {
123
- _pwr_key = 1 ;
124
- ThisThread::sleep_for (750 );
125
- _pwr_key = 0 ;
126
- ThisThread::sleep_for (100 );
127
- }
128
-
129
- return NSAPI_ERROR_OK;
120
+ return hard_power_off ();
130
121
}
131
122
132
123
#endif
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ class QUECTEL_EC2X : public AT_CellularDevice {
41
41
virtual nsapi_error_t soft_power_off ();
42
42
43
43
private:
44
+ nsapi_error_t press_power_button (uint32_t timeout);
44
45
DigitalOut _pwr_key;
45
46
DigitalOut _rst;
46
47
};
You can’t perform that action at this time.
0 commit comments