Skip to content

Commit 12acfb3

Browse files
committed
Beetle: Implement sleep API
1 parent 862db41 commit 12acfb3

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

hal/targets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@
16401640
"template": ["uvision5_arm_beetle_soc.uvproj.tmpl"]
16411641
}
16421642
},
1643-
"device_has": ["ANALOGIN", "CLCD", "I2C", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "SERIAL", "SPI"],
1643+
"device_has": ["ANALOGIN", "CLCD", "I2C", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "SERIAL", "SLEEP", "SPI"],
16441644
"features": ["BLE"],
16451645
"release_versions": ["2", "5"]
16461646
},
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2016 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#include "sleep_api.h"
17+
#include "cmsis.h"
18+
19+
void sleep(void)
20+
{
21+
SystemPowerSuspend(POWER_MODE_SLEEP);
22+
SystemPowerResume(POWER_MODE_SLEEP);
23+
}
24+
25+
void deepsleep(void)
26+
{
27+
SystemPowerSuspend(POWER_MODE_DEEP_SLEEP);
28+
SystemPowerResume(POWER_MODE_DEEP_SLEEP);
29+
}

0 commit comments

Comments
 (0)