/**@brief Application main function. */ int main(void) { uint32_t err_code; bool erase_bonds; err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); // Initialize timers_init(); buttons_leds_init(&erase_bonds); ble_stack_init(); peer_manager_init(erase_bonds); if (erase_bonds == true) { NRF_LOG_INFO("Bonds erased!\r\n"); } gap_params_init(); advertising_init(); services_init(); sim_init(); conn_params_init(); // Start execution application_timers_start(); NRF_LOG_INFO("Location and Navigation App started\r\n"); err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); // Enter main loop for (;;) { if (NRF_LOG_PROCESS() == false) { power_manage(); } } }
int main(void) { ret_code_t err_code; bool erase_bonds; err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); NRF_LOG_PRINTF("Relay Example\r\n"); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL); buttons_leds_init(&erase_bonds); if (erase_bonds) { NRF_LOG_PRINTF("Bonds erased!\r\n"); } ble_stack_init(); peer_manager_init(erase_bonds); db_discovery_init(); hrs_c_init(); rscs_c_init(); gap_params_init(); conn_params_init(); services_init(); advertising_init(); adv_scan_start(); for (;;) { // Wait for BLE events. power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; bool erase_bonds; // Initialize. err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); timers_init(); buttons_leds_init(&erase_bonds); ble_stack_init(); peer_manager_init(erase_bonds); if (erase_bonds == true) { NRF_LOG_INFO("Bonds erased!\r\n"); } gap_params_init(); advertising_init(); gatt_init(); services_init(); sensor_simulator_init(); conn_params_init(); // Start execution. NRF_LOG_INFO("Heart Rate Sensor Start!\r\n"); application_timers_start(); advertising_start(); // Enter main loop. for (;;) { if (NRF_LOG_PROCESS() == false) { power_manage(); } } }
int main(void) { // Enable the constant latency sub power mode to minimize the time it takes // for the SPIS peripheral to become active after the CSN line is asserted // (when the CPU is in sleep mode). NRF_POWER->TASKS_CONSTLAT = 1; LEDS_CONFIGURE(BSP_LED_0_MASK); LEDS_OFF(BSP_LED_0_MASK); APP_ERROR_CHECK(NRF_LOG_INIT(NULL)); NRF_LOG_INFO("SPIS example\r\n"); nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG; spis_config.csn_pin = APP_SPIS_CS_PIN; spis_config.miso_pin = APP_SPIS_MISO_PIN; spis_config.mosi_pin = APP_SPIS_MOSI_PIN; spis_config.sck_pin = APP_SPIS_SCK_PIN; APP_ERROR_CHECK(nrf_drv_spis_init(&spis, &spis_config, spis_event_handler)); while (1) { memset(m_rx_buf, 0, m_length); spis_xfer_done = false; APP_ERROR_CHECK(nrf_drv_spis_buffers_set(&spis, m_tx_buf, m_length, m_rx_buf, m_length)); while (!spis_xfer_done) { __WFE(); } NRF_LOG_FLUSH(); LEDS_INVERT(BSP_LED_0_MASK); } }
/** * @brief Function for application main entry. */ int main(void) { NfcRetval ret_val; uint32_t len = sizeof(ndef_msg_buf); uint32_t err_code; err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); /* Configure LED-pins as outputs */ LEDS_CONFIGURE(BSP_LED_0_MASK); LEDS_OFF(BSP_LED_0_MASK); /* Set up NFC */ ret_val = nfcSetup(nfc_callback, NULL); APP_ERROR_CHECK(ret_val); /* Encode welcome message */ welcome_msg_encode(ndef_msg_buf, &len); /* Set created message as the NFC payload */ ret_val = nfcSetPayload( (char*)ndef_msg_buf, len); APP_ERROR_CHECK(ret_val); /* Start sensing NFC field */ ret_val = nfcStartEmulation(); APP_ERROR_CHECK(ret_val); while(1) { if (!NFC_NEED_MCU_RUN_STATE()) { __WFE(); } } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; bool erase_bonds; // Initialize. err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); timers_init(); buttons_leds_init(&erase_bonds); ble_stack_init(); peer_manager_init(erase_bonds); if (erase_bonds == true) { NRF_LOG_INFO("Bonds erased!\r\n"); } gap_params_init(); advertising_init(); db_discovery_init(); alert_notification_init(); conn_params_init(); // Start execution. NRF_LOG_INFO("Alert Notification started\r\n"); advertising_start(); // Enter main loop. for (;;) { if (NRF_LOG_PROCESS() == false) { power_manage(); } } }
static void nrf_log_init(void) { // Initialize logging library. uint32_t err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); }
void log_init(void) { ret_code_t err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing the nrf log module. */ void nrf_log_init(void) { ret_code_t err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); }
void app_trace_init(void) { (void)NRF_LOG_INIT(); }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; bool erase_bonds; // Initialize. gpio_init(); // TODO: Measure battery nrf_gpio_pin_set(LED_1); err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); twi_init(); sensors_init(&m_app_twi, sensors_callback); timers_init(); buttons_leds_init(); // erase_bonds = false; ble_stack_init(); detect_erase_bond_pressed(&erase_bonds); // bool button; // err_code = app_button_is_pushed(0, &button); // APP_ERROR_CHECK(err_code); // uint8_t count = 0; // while (button) { // nrf_delay_ms(100); // count++; // if (count > 20) { // erase_bonds = true; // NRF_LOG_DEBUG("Erasing bonds!\r\n"); // break; // } // err_code = app_button_is_pushed(0, &button); // APP_ERROR_CHECK(err_code); // } // while (button) { // nrf_gpio_pin_clear(LED_1); // nrf_delay_ms(200); // nrf_gpio_pin_set(LED_1); // nrf_delay_ms(200); // err_code = app_button_is_pushed(0, &button); // APP_ERROR_CHECK(err_code); // } // peer_manager_init(erase_bonds); gap_params_init(); advertising_init(); services_init(); conn_params_init(); // radio_notification_init(); nrf_gpio_pin_clear(LED_1); // Start execution. application_timers_start(); advertising_start(); // sensors_measure(); sensors_timers_init(); sensors_timers_start(); // Enter main loop. for (;;) { power_manage(); } }