Test code for Grove Node BLE
Dependencies: BLE_API nRF51822
Fork of BLE_LoopbackUART by
power.c
00001 00002 #include "nrf51.h" 00003 #include "nrf51_bitfields.h" 00004 00005 #define POWER_PIN 8 00006 00007 void power_on() 00008 { 00009 NRF_GPIO->PIN_CNF[POWER_PIN] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) 00010 | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) 00011 | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) 00012 | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) 00013 | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos); 00014 NRF_GPIO->OUTSET = (1UL << POWER_PIN); 00015 } 00016 00017 00018 void power_off() 00019 { 00020 NRF_GPIO->OUTCLR = (1UL << POWER_PIN); 00021 00022 // Enter system OFF. After wakeup the chip will be reset, and the MCU will run from the top 00023 NRF_POWER->SYSTEMOFF = 1; 00024 }
Generated on Tue Jul 12 2022 21:43:25 by 1.7.2