/**@brief Function for handling the idle state (main loop). * * @details If there is no pending log operation, then sleep until next the next event occurs. */ static void idle_state_handle(void) { if (NRF_LOG_PROCESS() == false) { nrf_pwr_mgmt_run(); } }
/** * @brief Function for application main entry. */ int main(void) { uint32_t err_code; // Initialize. err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false); err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL); APP_ERROR_CHECK(err_code); ble_stack_init(); advertising_init(); // Start execution. NRF_LOG_INFO("BLE Beacon started\r\n"); advertising_start(); // Enter main loop. for (;; ) { if (NRF_LOG_PROCESS() == false) { power_manage(); } } }
void board_role_select(void) { buttons_enable(); while (m_board_role == NOT_SELECTED) { if (!NRF_LOG_PROCESS()) { wait_for_event(); } } buttons_disable(); }
/**@brief Function for application main entry, does not return. */ int main(void) { uint32_t err_code; utils_setup(); softdevice_setup(); ant_state_indicator_init(m_ant_hrm.channel_number, HRM_DISP_CHANNEL_TYPE); profile_setup(); for (;;) { if (NRF_LOG_PROCESS() == false) { err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } } }
/**@brief Function for application main entry. */ int main(void) { bool erase_bonds; uint32_t err_code; // Initialize. err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); // Clear bond flag bond_present = false; 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(); sensor_simulator_init(); conn_params_init(); whitelist_load(); nfc_init(erase_bonds); // Start execution. NRF_LOG_INFO("Heart Rate Sensor NFC Start!\r\n"); application_timers_start(); // Enter main loop. for (;;) { if (NRF_LOG_PROCESS() == false) { power_manage(); } } }
/** * @brief Function for main application entry. */ int main(void) { uint32_t err_code; // Initialize. log_init(); NRF_LOG_INFO("\033[2J\033[;H"); // Clear screen mpu_init(); // Start execution. NRF_LOG_INFO("MPU Magnetometer example."); accel_values_t acc_values; magn_values_t magn_values; uint32_t sample_number = 0; const uint8_t MAG_DATA_SIZE = 10; uint8_t magn_data[MAG_DATA_SIZE]; memset(magn_data, 0, MAG_DATA_SIZE); while(1) { if(NRF_LOG_PROCESS() == false) { // Read accelerometer sensor values err_code = app_mpu_read_accel(&acc_values); APP_ERROR_CHECK(err_code); // Clear terminal and print values NRF_LOG_INFO("\033[3;1HAccel Sample # %d\r\nX: %06d\r\nY: %06d\r\nZ: %06d\r\n", ++sample_number, acc_values.x, acc_values.y, acc_values.z); // Read and print magnetometer sensor values err_code = app_mpu_read_magnetometer(&magn_values, NULL); APP_ERROR_CHECK(err_code); NRF_LOG_INFO("\n\rMagno Sample # %d\r\nX: %06d\r\nY: %06d\r\nZ: %06d\r\n", sample_number, magn_values.x, magn_values.y, magn_values.z); nrf_delay_ms(200); } } }
/** * @brief Function for application main entry. */ int main(void) { // Initialize. log_init(); timers_init(); leds_init(); ble_stack_init(); advertising_init(); advertising_start(); // Start execution. NRF_LOG_INFO("Beacon example started."); // Enter main loop. for (;; ) { if (NRF_LOG_PROCESS() == false) { power_manage(); } } }
/**@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(); } } }
/**@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(); } } }
int main(void) { log_init(); leds_init(); timer_init(); counter_init(); buttons_init(); ble_stack_init(); gap_params_init(); conn_params_init(); gatt_init(); advertising_data_set(); server_init(); client_init(); // Default ATT MTU size and connection interval are set at compile time. gatt_mtu_set(m_test_params.att_mtu); // Data Length Extension (DLE) is on by default. // Enable the Connection Event Length Extension. conn_evt_len_ext_set(m_test_params.conn_evt_len_ext_enabled); NRF_LOG_INFO("ATT MTU example started.\r\n"); NRF_LOG_INFO("Press button 3 on the board connected to the PC.\r\n"); NRF_LOG_INFO("Press button 4 on other board.\r\n"); NRF_LOG_FLUSH(); board_role_select(); if (m_board_role == BOARD_TESTER) { m_print_menu = true; } if (m_board_role == BOARD_DUMMY) { advertising_start(); scan_start(); } // Enter main loop. NRF_LOG_DEBUG("Entering main loop.\r\n"); for (;;) { if (m_print_menu) { menu_print(); } if (is_test_ready()) { m_run_test = true; test_run(); } if (!NRF_LOG_PROCESS()) { wait_for_event(); } } }