/**@brief Application main function. */ int main(void) { // Initialize leds_init(); buttons_init(); ble_stack_init(); bond_manager_init(); timers_init(); gap_params_init(); advertising_init(); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution application_timers_start(); advertising_start(); // Enter main loop for (;;) { power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; // Initialize timers_init(); ble_stack_init(); bsp_module_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); adc_init(); // Start execution timers_start(); err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); // Enter main loop for (;;) { if(start_adc_sampling == true) { nrf_drv_saadc_sample_convert(0, &adc_value); ble_android_characteristic_update(&m_android, &adc_value); start_adc_sampling = false; } app_sched_execute(); // power_manage(); } }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); bond_manager_init(); ble_stack_init(); scheduler_init(); gap_params_init(); advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution timers_start(); advertising_start(); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
uint32_t dfu_transport_update_start() { uint32_t err_code; m_pkt_type = PKT_TYPE_INVALID; leds_init(); err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); if (err_code != NRF_SUCCESS) { return err_code; } dfu_register_callback(dfu_cb_handler); err_code = hci_mem_pool_open(); if (err_code != NRF_SUCCESS) { return err_code; } gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); advertising_start(); return NRF_SUCCESS; }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); timers_init(); buttons_init(); ble_stack_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); nrf6350_lcd_init(); nrf6350_lcd_write_string("Ok a ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0); advertising_start(); nrf6350_lcd_write_string("Ok b ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0); // Enter main loop while(true) { power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; // Initialize timers_init(); ble_stack_init(); bsp_module_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Start execution timers_start(); err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
*/ int main(void) { // Initialize. leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); bond_manager_init(); gap_params_init(); advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); // Start execution. advertising_start(); // Enter main loop. for (;;) { power_manage(); }
/**@brief Function for application main entry. */ int main(void) { gpio_config(); bool success = nrf6350_lcd_init(); APP_ERROR_CHECK_BOOL(success); success = nrf6350_lcd_write_string(" BLE ANCS ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0); APP_ERROR_CHECK_BOOL(success); // Initialize. leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); bond_manager_init(); gap_params_init(); service_add(); advertising_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution. advertising_start(); // Enter main loop. for (;;) { power_manage(); } }
void BLE_init() { ble_stack_init(); gap_params_init(); services_init(); sec_params_init(); ble_gap_addr_t MAC; sd_ble_gap_address_get(&MAC); debug_log("MAC address: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X", MAC.addr[5],MAC.addr[4],MAC.addr[3], MAC.addr[2],MAC.addr[1],MAC.addr[0]); defaultID = crc16_compute(MAC.addr,6,NULL); // compute default badge ID from MAC address debug_log("-->default ID: 0x%hX\r\n",defaultID); badgeAssignment.ID = defaultID; badgeAssignment.group = NO_GROUP; // Copy MAC address into custom advertising data struct. for(int i = 0; i <= 5; i++) { customAdvData.MAC[i] = MAC.addr[i]; } //advertising_init(); //uint32_t err_code = ble_advertising_start(BLE_ADV_MODE_FAST); //BLE_ERROR_CHECK(err_code); }
/**@brief Application main function. */ int main(void) { //printf("main"); uint8_t start_string[] = START_STRING; uint32_t err_code; // Initialize. APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false); APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS); ble_stack_init(); //uart_init(); err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL); APP_ERROR_CHECK(err_code); err_code = bsp_buttons_enable(1 << WAKEUP_BUTTON_ID); APP_ERROR_CHECK(err_code); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); printf("%s",start_string); advertising_start(); init_leds(); for (;;) { power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { // Initialize timers_init(); gpiote_init(); ble_stack_init(); bsp_module_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Start execution timers_start(); advertising_start(); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
int main(void) { // uint32_t err_code; APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false); APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS); ble_stack_init(); sys_Initialize(); sys_Timer_Handler_Init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); sys_printf("Gift Air Project Start\n\r"); advertising_start(); sys_Timer_Handler_Start(); NRF_WDT->RR[0] = WDT_RR_RR_Reload; //Reload watchdog register 0 // Enter main loop for (;;) { power_manage(); //2sec, 200ms } }
/**@brief Function for application main entry. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); simple_uart_config(UART_RTS, UART_TX, UART_CTS, UART_RX, 0); ble_stack_init(); scheduler_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); // Start execution //app_button_enable(); advertising_start(); uart_tx_str("nRF51822 run"); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); bond_manager_init(); ble_stack_init(); ble_error_log_init(); gap_params_init(); advertising_init(); alert_notification_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution advertising_start(); // Enter main loop for (;;) { power_manage(); } }
/**@brief Function for the application main entry. */ int main(void) { uint32_t err_code; timers_init(); gpiote_init(); buttons_init(); nrf_gpio_cfg_output(CONNECTED_LED_PIN_NO); //DM: Green LED controlled directly. Red through GPIOTE task (Timer1_Compare[0]) ble_stack_init(); bond_manager_init(); // Initialize Bluetooth Stack parameters gap_params_init(); advertising_init(); services_init(); conn_params_init(); //just for relayr, iBeacon does´t allow connect sec_params_init(); //iBeacon: no security // Start advertising advertising_start(); // Enter main loop for (;;) { // Switch to a low power state until an event is available for the application err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } }
void ble_hrs_app_start(void) { gap_params_init(); advertising_init(); services_init(); sensor_simulator_init(); conn_params_init(); application_timers_start(); sec_params_init(); advertising_start(); }
bool transfer_config(void) { bool ret = true; gap_params_init(); transfer_services_init(); advertising_init(); conn_params_init(); sec_params_init(); return ret; }
/**@brief Application main function. */ int main(void) { static uint8_t data_array[BLE_NUS_MAX_DATA_LEN]; static uint8_t index = 0; uint8_t newbyte; // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); uart_init(); ble_stack_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); uart_putstring(START_STRING); advertising_start(); // Enter main loop for (;;) { /*Stop reading new data if there are no ble buffers available */ if(ble_buffer_available) { if(app_uart_get(&newbyte) == NRF_SUCCESS) { data_array[index++] = newbyte; if (index >= (BLE_NUS_MAX_DATA_LEN)) { ble_buffer_available=ble_attempt_to_send(&data_array[0],index); if(ble_buffer_available) index=0; } } } /* Re-transmission if ble_buffer_available was set to false*/ if(tx_complete) { tx_complete=false; ble_buffer_available=ble_attempt_to_send(&data_array[0],index); if(ble_buffer_available) index =0; } power_manage(); } }
/** * \brief I think of main as providing initialization and BLE event handling. One of the event handlers is used by the LBL's service and is defined * in the service_init() function. service_init() calls into the LBL's BLE service's initialization code which identifies the UUIDs of the LBL service. * \note Call service_init BEFORE advertising_init() * The BLE event dispatcher (ble_evt_dispatch()) calls the LBL's BLE event dispatcher. Communications with a client is through the client read/writing to characteristics. * \note I assume the power_manage() function does a "good job" interacting with the SoftDevice stack to minimize the amount of power used up by the LBL. I don't know how to fine tune * power management at this time. I use examples from the nRF51 SDK as a crutch, assuming the code for most of main functionality is "cookie cutter" across examples and the Nordic engineers that * write the examples realizes example code would be copy/pasted into our stuff. * @return while main is defined as an int, nothing is really returned. */ int main(void) { //call flash_init() before initializing service.. the ble_lbl_service uses flash to access pH4 and 7 calibration info.... (wow - too many dependencies!) //initialize pstorage() - the way i'll read/write from flash. POR is to use flash to store the calibration info for pH 4 and pH 7.. //Note in the S110 Softdevice documentation for pstorage, there is a note: // For implementation of interface included in the example, SoftDevice should be enabled and scheduler (if used) should be initialized prior to initializing this module. // ladybug_flash_init(); //a good part of this is "cookie cutter" from the nRF51 SDK...my-o-my there is a lot of code for BLE (within SoftDevice) and once SoftDevice is initialized - unfortunately - there is no longer source code debugging. ble_stack_init(); // The app timers rely on the BLE stack being initialized. This means app timer initialization must happen after BLE initialization. timers_init(); // (pstorage api access to) flash and the app timer used within the read/write flash functions require BLE and timers init first. ladybug_flash_init(); // The device name is needed as a GAP parameter. This is the first time a flash action (flash read) happens which means BLE and app timer init must happen first. char *p_deviceName; ladybug_get_device_name(&p_deviceName); SEGGER_RTT_printf(0,"Device name: %s \n",p_deviceName); SEGGER_RTT_printf(0,"String length: %d\n",strlen(p_deviceName)); gap_params_init(p_deviceName); //call service_init() before calling advertising_init()...service_init() calls into the LBL's BLE initialization code (where the LBL peripheral service and characteristics are defined) service_init(); advertising_init(); conn_params_init(); sec_params_init(); advertising_start(); // Enter main loop for (;;) { //Lazy write of values stored in flash //writing can get messed up if it is done inline with other BLE/sensing activity, and there is no rush. storeCalibrationValues_t *p_storeCalibrationValues; if (true == ladybug_there_are_calibration_values_to_write(&p_storeCalibrationValues)){ SEGGER_RTT_printf(0,"Writing calibration values to flash. Number of bytes: %d\n",sizeof(storeCalibrationValues_t)); ladybug_flash_write(calibrationValues,(uint8_t *)p_storeCalibrationValues,sizeof(storeCalibrationValues_t),did_flash_write); } storePlantInfo_t *p_storePlantInfo; if (true == ladybug_there_are_plantInfo_values_to_write(&p_storePlantInfo)){ SEGGER_RTT_WriteString(0,"...Writing plantInfo values to flash\n"); ladybug_flash_write(plantInfo,(uint8_t *)p_storePlantInfo,sizeof(storePlantInfo_t),did_flash_write); } char *p_deviceName; if (true == ladybug_the_device_name_has_been_updated(&p_deviceName)){ SEGGER_RTT_WriteString(0,"Writing device name to flash\n"); ladybug_flash_write(deviceName,(uint8_t *)p_deviceName,DEVNAME_MAX_LEN,did_flash_write); } power_manage(); } }
int main(void){ twi_master_init(); init_sensor(); ble_stack_init(); timers_init(); gpio_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); advertising_start(); while(true){ power_manage(); } }
/**@brief Function for the application main entry. */ int ble_init(void) { // Initialize timer module. APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false); ble_stack_init(); // Initialize Bluetooth Stack parameters gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Start advertising advertising_start(); timeslot_start(); }
void BLEStart(void) { // Initialize Bluetooth Stack parameters g_LmxServ.conn_handle = BLE_CONN_HANDLE_INVALID; ble_stack_init(); services_init(); device_manager_init(); gap_params_init(); //bas_init(); dis_init(); advertising_init(); conn_params_init(); sec_params_init(); // Start advertising advertising_start(); }
/**@brief Function for application main entry. */ int main(void) { // Initialize app_trace_init(); simple_uart_putstring((const uint8_t*) "trace init\r\n"); leds_init(); simple_uart_putstring((const uint8_t*) "leds init\r\n"); timers_init(); simple_uart_putstring((const uint8_t*) "timers init\r\n"); gpiote_init(); simple_uart_putstring((const uint8_t*) "gpiote init\r\n"); buttons_init(); simple_uart_putstring((const uint8_t*) "buttons init\r\n"); ble_stack_init(); simple_uart_putstring((const uint8_t*) "stack init\r\n"); scheduler_init(); simple_uart_putstring((const uint8_t*) "schedler init\r\n"); gap_params_init(); simple_uart_putstring((const uint8_t*) "gap init\r\n"); advertising_init(); simple_uart_putstring((const uint8_t*) "adv init\r\n"); services_init(); simple_uart_putstring((const uint8_t*) "services init\r\n"); conn_params_init(); simple_uart_putstring((const uint8_t*) "conn init\r\n"); sec_params_init(); simple_uart_putstring((const uint8_t*) "sec init\r\n"); ext_sensors_init(); simple_uart_putstring((const uint8_t*) "ext init\r\n"); // lfclk_config(); // simple_uart_putstring((const uint8_t*) "lfk init\r\n"); // Start execution timers_start(); advertising_start(); simple_uart_putstring((const uint8_t*) "main\r\n"); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
uint32_t dfu_transport_update_start() { m_pkt_type = PKT_TYPE_INVALID; leds_init(); // Initialize the S110 Stack. ble_stack_init(); scheduler_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); radio_notification_init(); advertising_start(); wait_for_events(); return NRF_SUCCESS; }
/**@brief Application main function. */ int main(void) { APP_GPIOTE_INIT(1); connectivity_chip_reset(); leds_init(); buttons_init(); bond_manager_init(); ble_stack_init(); ble_error_log_init(); timers_init(); nrf_gpio_pin_set(NRF6310_LED_5); gap_params_init(); nrf_gpio_pin_clear(NRF6310_LED_5); advertising_init(); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution application_timers_start(); //m_start_adv_flag = true; advertising_start(); // Enter main loop for (;;) { // uint32_t err_code; // // Start/restart advertising. // if (m_start_adv_flag) // { // err_code = sd_ble_gap_adv_start(&m_adv_params); // APP_ERROR_CHECK(err_code); // nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO); // m_start_adv_flag = false; // } power_manage(); } }
/**@brief Application main function. */ int main(void) { uint32_t err_code; timers_init(); gpiote_init(); buttons_init(); if (is_first_start()) { // The startup was not because of button presses. This is the first start. // Go into System-Off mode. // NOTE: This register cannot be set directly after ble_stack_init() because the SoftDevice // will be enabled. GPIO_WAKEUP_BUTTON_CONFIG(HR_INC_BUTTON_PIN_NO); GPIO_WAKEUP_BUTTON_CONFIG(HR_DEC_BUTTON_PIN_NO); NRF_POWER->SYSTEMOFF = 1; } bond_manager_init(); ble_stack_init(); radio_notification_init(); // Initialize Bluetooth Stack parameters gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Actually start advertising advertising_start(); // Enter main loop for (;;) { // Switch to a low power state until an event is available for the application err_code = sd_app_event_wait(); APP_ERROR_CHECK(err_code); } }
void BLE_Primx_Apps_Int(void) { leds_init(); // configure LED output timers_init(); // configure Timer gpiote_init(); // configure maximum no of GPIO external buttons_init(); // configure the button handlering and button proporty bond_manager_init(); // load the previous bond data from flash ble_stack_init(); // Install BLE event Handler function list gap_params_init(); // set gap parameter advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); //set advertising mode, set UUID service services_init(); // add UUID service , and service function handler conn_params_init(); // set the connection parameter sec_params_init(); // set the security connect parameter radio_notification_init(); // active radio // Start execution advertising_start(); // start state mechine for adversting }
/**@brief Application main function. */ int main(void) { uint32_t err_code; connected = false; mlog_init(); timers_init(); gpiote_init(); buttons_init(); step_counter_init(); motor_init(); led1_init(); mlog_str("Starting MAIN...\r\n"); bond_manager_init(); ble_stack_init(); radio_notification_init(); // Initialize Bluetooth Stack parameters gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Actually start advertising //advertising_start(); app_button_enable(); // Enter main loop for (;;) { // Switch to a low power state until an event is available for the application err_code = sd_app_event_wait(); APP_ERROR_CHECK(err_code); } }
int main(void) { // Initialize app_trace_init(); app_trace_log("trace init\r\n"); timers_init(); ble_stack_init(); sec_params_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); motion_sensor_init(); // Start execution advertising_start(); app_trace_log("advertising start\r\n"); // Enter main loop for (;;) { power_manage(); } }
int main(void) { bool init_status; int retValue; int i = defaultPerso.fall_detection_window; // initialize LEDs nrf_gpio_cfg_output(LED_RESETTING); nrf_gpio_cfg_output(LED_NO_FALL); nrf_gpio_cfg_output(LED_FALL_DETECTED); nrf_gpio_cfg_output(LED_OTHER); welcomeLEDs(); // Initialize timers_init(); ble_stack_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); twi_master_init(); #ifdef TEST_ACTIVITY_LOG testActivityLog(); #endif initActivityLog(); initSnapshotBuffer(); initCoefficients(); // initialize values retValue = 0; init_status = mpu6050_init(MPU6050_DEVICE_ADDR); if ( false == init_status ) { init_status = mpu6050_init(MPU6050_DEVICE_ADDR+1); if ( false == init_status ) { retValue = -1; errorLEDs(); sd_nvic_SystemReset(); } } if ( 0 == retValue ) { init_status = false; i = 0; while ( false == init_status ) { if (i == 6) { errorLEDs(); sd_nvic_SystemReset(); } init_status = accel_setup(); i++; } } if (0 == retValue) { char outbuf[20]; // Start execution - write a log entry with zero steps to indicate startup // writeLogEntry(999); advertising_start(); setup_wdt(); timers_start(); // start sampliing while(1) { if (ReadSnapshots == 1) { FullSnapshotEntry* entry = (FullSnapshotEntry*)(SNAPSHOT_DATA_ADDRESS_START) ; SnapshotHeader *h; Sensor_Reading *r; sprintf (outbuf, "ID: %s ", getPerso()->uname); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); for(int i=0;i < getActivityLogSize(); i++) { h = &entry->hdr; sprintf (outbuf, ": SNAPSHOT # %d \n ",(i)); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 16); sprintf (outbuf, "Version: 2 \n");// ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 12); sprintf (outbuf, "t:%d n:%d last:%d",h->data.time, h->data.num_of_data_points, h->data.latest_data_point_index); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); // ptr++; r = entry->r; for (int j = 0; j < NUMBER_OF_ENTRIES; j++) { #define FLASH_READ_DELAY 40 nrf_gpio_pin_set(LED_RESETTING); sprintf (outbuf, "i: %d T: %04x ",j,r[j].val.temp); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(FLASH_READ_DELAY); sprintf (outbuf, "A: x%04xy%04xz%04x",r[j].val.x_ac,r[j].val.y_ac,r[j].val.z_ac); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(FLASH_READ_DELAY); sprintf (outbuf, "G: x%04xy%04xz%04x",r[j].val.x_gy,r[j].val.y_gy,r[j].val.z_gy); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(FLASH_READ_DELAY); nrf_gpio_pin_clear(LED_RESETTING); nrf_delay_ms(FLASH_READ_DELAY); //ptr += sizeof(Sensor_Reading); } entry++; } ReadSnapshots = 0; } if (ReadSnapshotsPartial == 1) { PartialSnapTotal = ((PartialSnap1-('0'))*10)+(PartialSnap2-('0')); FullSnapshotEntry* entry = (FullSnapshotEntry*)(SNAPSHOT_DATA_ADDRESS_START+(((PartialSnapTotal*sizeof(FullSnapshotEntry)*10))/4)) ; SnapshotHeader *h; Sensor_Reading *r; sprintf (outbuf, "ID: %s ", getPerso()->uname); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); for(int i=0;i < 10; i++) { h = &entry->hdr; sprintf (outbuf, ": SNAPSHOT # %d \n ",(i+(PartialSnapTotal*10))); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 16); sprintf (outbuf, "Version: 2 \n");// ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 12); sprintf (outbuf, "t:%d n:%d last:%d",h->data.time, h->data.num_of_data_points, h->data.latest_data_point_index); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); // ptr++; r = entry->r; for (int j = 0; j < NUMBER_OF_ENTRIES; j++) { #define FLASH_READ_DELAY 40 nrf_gpio_pin_set(LED_RESETTING); sprintf (outbuf, "i: %d T: %04x ",j,r[j].val.temp); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(FLASH_READ_DELAY); sprintf (outbuf, "A: x%04xy%04xz%04x",r[j].val.x_ac,r[j].val.y_ac,r[j].val.z_ac); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(FLASH_READ_DELAY); sprintf (outbuf, "G: x%04xy%04xz%04x",r[j].val.x_gy,r[j].val.y_gy,r[j].val.z_gy); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(FLASH_READ_DELAY); nrf_gpio_pin_clear(LED_RESETTING); nrf_delay_ms(FLASH_READ_DELAY); //ptr += sizeof(Sensor_Reading); } entry++; } ReadSnapshotsPartial = 0; } if (ReadDataBuffer == 1) { LogEntry *addr; sprintf (outbuf, "ID: %s ", getPerso()->uname); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); addr = (LogEntry *)(STEP_DATA_ADDRESS_START); for(int i=0;i < getActivityLogSize(); i++) { nrf_gpio_pin_set(LED_RESETTING); nrf_delay_ms(20); nrf_gpio_pin_clear(LED_RESETTING); nrf_delay_ms(20); // sprintf ( outbuf, ": h:%d s:%d a:%04f ",addr->item.hour, addr->item.sec, addr->item.activity_level); sprintf ( outbuf, "%d:%d - %03f ",addr->item.hour, (addr->item.sec)/60, addr->item.activity_level); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); //nrf_delay_ms(1); addr++; } ReadDataBuffer = 0; } if (ReadDataBufferPartial == 1) { LogEntry *addr; sprintf (outbuf, "ID: %s ", getPerso()->uname); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); PartialCountTotal = ((PartialCount1-('0'))*10)+(PartialCount2-('0')); addr = (LogEntry *)(STEP_DATA_ADDRESS_START+(2*(PartialCountTotal*1000))); for(int i=0;i < 1000; i++) { nrf_gpio_pin_set(LED_RESETTING); nrf_delay_ms(20); nrf_gpio_pin_clear(LED_RESETTING); nrf_delay_ms(20); // sprintf ( outbuf, ": h:%d s:%d a:%04f ",addr->item.hour, addr->item.sec, addr->item.activity_level); sprintf ( outbuf, "%d:%d - %03f ",addr->item.hour, (addr->item.sec)/60, addr->item.activity_level); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); //nrf_delay_ms(1); addr++; } ReadDataBufferPartial = 0; } if (Dumper == 1) { sprintf (outbuf, "Log: %d ",getActivityLogSize()); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); Dumper = 0; } if (ReadBigSnapshot == 1) { SnapshotHeader *h = getSnapshotHeader(); sprintf (outbuf, "t:%d n:%d last:%d",h->data.time, h->data.num_of_data_points, h->data.latest_data_point_index); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); for (i = 0; i < NUMBER_OF_ENTRIES; i++) //i <= h->data.latest_data_point_index; i++) { #define RAM_READ_DELAY 15 sprintf (outbuf, "i: %d T: %04x ",i,raw_data[i].val.temp); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(RAM_READ_DELAY); sprintf (outbuf, "A: x%04xy%04xz%04x",raw_data[i].val.x_ac,raw_data[i].val.y_ac,raw_data[i].val.z_ac); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(RAM_READ_DELAY); sprintf (outbuf, "G: x%04xy%04xz%04x",raw_data[i].val.x_gy,raw_data[i].val.y_gy,raw_data[i].val.z_gy); ble_nus_send_string(&m_nus, (unsigned char*)outbuf, 20); nrf_delay_ms(RAM_READ_DELAY); } ReadBigSnapshot = 0; } if (do_post_processing == true) { do_post_processing = false; if (emergencyCall == 1) { makeTheCall(); emergencyCall = 0; } post_comm_processing(); } // Power Method 1 // nrf_gpio_pin_write(LED_OTHER,1); // power_manage(); // nrf_gpio_pin_write(LED_OTHER,0); } } return retValue; }