Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API nRF51822
Fork of BLE_NODE_TEST by
power.c
- Committer:
- yihui
- Date:
- 2014-10-29
- Revision:
- 9:05f0b5a3a70a
File content as of revision 9:05f0b5a3a70a:
#include "nrf51.h"
#include "nrf51_bitfields.h"
#define POWER_PIN 8
void power_on()
{
NRF_GPIO->PIN_CNF[POWER_PIN] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos)
| (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
| (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos)
| (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos)
| (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
NRF_GPIO->OUTSET = (1UL << POWER_PIN);
}
void power_off()
{
NRF_GPIO->OUTCLR = (1UL << POWER_PIN);
// Enter system OFF. After wakeup the chip will be reset, and the MCU will run from the top
NRF_POWER->SYSTEMOFF = 1;
}
