how can nrf51822 make 2.4G communication and BLE communication arbitrary switch?
how can nrf51822 make 2.4G communication and BLE communication arbitrary switch?
yes,I know the example of "\examples\multiprotocol\ble_app_gzll",but i have some troubles when i transplant to my project of "ble_uart_app".
// Enter main loop. for (;;) { power_manage(); //pinvalue = nrf_gpio_pin_read(switch_24toble); //pinvalue = 0 if (pinvalue == 1) { running_mode = BLE; } else { running_mode = GHZ; } if (running_mode != previous_mode) { previous_mode = running_mode; if (running_mode == BLE) { AppTx_stop(); ble_stack_init(); ble_app_cfg_start(); } else if (running_mode == GHZ) { //ble_app_cfg_stop(); ble_stack_stop(); esb_tx_init(); ret = AppTx_Send((uint8_t *)buf,5); if (ret < 0) { ret = 0; } if (TxRxPacket.TxFlage == 1) { TxRxPacket.TxFlage = 0; // Toggle one of the LEDs. nrf_gpio_pin_write(LED_TXS, 1); nrf_delay_us(100000); nrf_gpio_pin_write(LED_TXS, 0); nrf_delay_us(100000); } } }
first,the code dehind of "power_manage()" is not running when the "power_manage();"has executed. when i put him somewhere else the softdevice is not close(sd_softdevice_disable() running will lead to program go into "while (loop);" in the "app_error.c").
void ble_stack_stop(void) { uint32_t err_code; err_code = softdevice_handler_sd_disable(); APP_ERROR_CHECK(err_code); }