Disable nrf on lowpower-off

This commit is contained in:
Stefan `Sec` Zehl 2011-08-01 05:31:47 +02:00
parent 26515e2717
commit d4c48f66c2
3 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,7 @@ void VoltageCheck(void){
results /= 1024; results /= 1024;
if( results < 3500 ){ if( results < 3500 ){
nrf_off();
gpioSetValue (RB_PWR_GOOD, 0); gpioSetValue (RB_PWR_GOOD, 0);
gpioSetValue (RB_LCD_BL, 0); gpioSetValue (RB_LCD_BL, 0);
SCB_SCR |= SCB_SCR_SLEEPDEEP; SCB_SCR |= SCB_SCR_SLEEPDEEP;

View File

@ -395,3 +395,10 @@ void nrf_init() {
nrf_write_reg(R_RF_SETUP,DEFAULT_SPEED|R_RF_SETUP_RF_PWR_3); nrf_write_reg(R_RF_SETUP,DEFAULT_SPEED|R_RF_SETUP_RF_PWR_3);
}; };
void nrf_off() {
nrf_write_reg(R_CONFIG,
R_CONFIG_MASK_RX_DR|
R_CONFIG_MASK_TX_DS|
R_CONFIG_MASK_MAX_RT
); // Most important: no R_CONFIG_PWR_UP
};

View File

@ -138,6 +138,7 @@ int nrf_rcv_pkt_time_encr(int maxtime, int maxsize, uint8_t * pkt, uint32_t cons
char nrf_snd_pkt_crc_encr(int size, uint8_t * pkt, uint32_t const k[4]); char nrf_snd_pkt_crc_encr(int size, uint8_t * pkt, uint32_t const k[4]);
void nrf_init() ; void nrf_init() ;
void nrf_off() ;
void nrf_cmd(uint8_t cmd); void nrf_cmd(uint8_t cmd);
uint8_t nrf_cmd_status(uint8_t cmd); uint8_t nrf_cmd_status(uint8_t cmd);