示例#1
0
int main (void) {
    uint32_t err_code;

    //
    // Initialization
    //

    led_init(LED_0);

    // We default to doing ranging at the start
    app.app_ranging = 1;

    // Set to effective -1
    app.calibration_index = 255;

    // Get stored address
    memcpy(_ble_address, (uint8_t*) ADDRESS_FLASH_LOCATION, 6);
    // And use it to setup the BLE
    ble_config.device_id = (_ble_address[1] << 8) | _ble_address[0];

    // Setup BLE
    simple_ble_app = simple_ble_init(&ble_config);

    // Setup the advertisement to use the Eddystone format.
    // We include the device name in the scan response
    ble_advdata_t srdata;
    memset(&srdata, 0, sizeof(srdata));
    srdata.name_type = BLE_ADVDATA_FULL_NAME;
    eddystone_adv(PHYSWEB_URL, &srdata);

    // Need a timer to make sure we have inited the tripoint
    timers_init();

    // Init the nRF hardware to work with the tripoint module.
    err_code = tripoint_hw_init();
    APP_ERROR_CHECK(err_code);

    // Init the state machine on the tripoint
    err_code = tripoint_init(updateData);
    if (err_code == NRF_SUCCESS) {
        tripoint_inited = true;
    }

    // Start the ranging!!!
    if (tripoint_inited) {
        tripoint_start_ranging(true, 10);
    }

    led_on(LED_0);

    while (1) {
        power_manage();
		if (updated) {
			tripointDataUpdate();
		}
    }
}
示例#2
0
文件: main.c 项目: shaneleonard/tock
int main (void) {
  printf("[BLE] UART over BLE\n");

  // Setup BLE
  conn_handle = simple_ble_init(&ble_config)->conn_handle;

  // Advertise the UART service
  ble_uuid_t adv_uuid = {0x0001, BLE_UUID_TYPE_VENDOR_BEGIN};
  simple_adv_service(&adv_uuid);
}
示例#3
0
文件: main.c 项目: hanyelkomy/squall
int main(void) {

    // Setup BLE
    simple_ble_init(&ble_config);

    // Advertise this
    simple_adv_service(&dis_service_uuid);

    // Enter main loop
    while(1) {
		power_manage();
    }
}
示例#4
0
文件: main.c 项目: lab11/nucleum
int main(void) {
    uint32_t err_code;

    led_init(LED_0);

    // Setup BLE
    simple_ble_init(&ble_config);

    // Advertise because why not
    simple_adv_only_name();

    led_on(LED_0);
    while (1) {
        power_manage();
    }
}
示例#5
0
文件: main.c 项目: cdealti/nrf5x-base
int main (void) {
    uint32_t err_code;

    // Setup BLE
    simple_ble_init(&ble_config);

    // Advertise because why not
    simple_adv_only_name();

    // RTT code
    log_rtt_init();
    log_rtt_printf(0, "Debug to RTT\n");

    while (1) {
        power_manage();
    }
}