Landtiger LPC1768 C BigLib 1
A self made, custom C library for the LandTiger board.
 
Loading...
Searching...
No Matches
power.c
Go to the documentation of this file.
1#include "power.h"
2#include <LPC17xx.h>
3
4void POWER_Init(u8 config)
5{
6 SCB->SCR |= (config & POWR_CFG_SLEEP_ON_EXIT);
7 SCB->SCR |= (config & POWR_CFG_DEEP);
8}
9
11{
12 LPC_SC->PCON &= ~0x3; // Sets B[1,0] = 00
13}
14
16{
17 SET_BIT(LPC_SC->PCON, 0); // 01
18}
19
21{
22 LPC_SC->PCON |= 0x3; // 11
23}
24
26{
27 SET_BIT(LPC_SC->PCONP, bit);
28}
29
31{
32 CLR_BIT(LPC_SC->PCONP, bit);
33}
34
36{
37 __asm volatile("wfi");
38}
void POWER_PowerDownOnWFI(void)
WFI/WFE puts device to power down power down mode.
Definition power.c:15
void POWER_WaitForInterrupts(void)
Definition power.c:35
void POWER_TurnOffPeripheral(u8 bit)
Turns off a peripheral.
Definition power.c:30
void POWER_Init(u8 config)
Configures sleep/power down mode for the device.
Definition power.c:4
void POWER_TurnOnPeripheral(u8 bit)
Turns on a peripheral.
Definition power.c:25
void POWER_SleepOnWFI(void)
WFI/WFE puts device to sleep or deep sleep mode depending on the configuration specified in the POWER...
Definition power.c:10
void POWER_DeepPowerDownOnWFI(void)
WFI/WFE puts device to deep power down mode provided that the SLEEPDEEP bit is set.
Definition power.c:20
@ POWR_CFG_SLEEP_ON_EXIT
Definition power_types.h:7
@ POWR_CFG_DEEP
Definition power_types.h:6
#define CLR_BIT(reg, bit)
Definition types.h:27
#define SET_BIT(reg, bit)
Definition types.h:26
uint8_t u8
Definition types.h:8