当前位置: 首页>>代码示例>>C++>>正文


C++ bsp_init函数代码示例

本文整理汇总了C++中bsp_init函数的典型用法代码示例。如果您正苦于以下问题:C++ bsp_init函数的具体用法?C++ bsp_init怎么用?C++ bsp_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bsp_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: utils_setup

/**
 * @brief Function for setup all thinks not directly associated witch ANT stack/protocol.
 * @desc Initialization of: @n
 *         - app_tarce for debug.
 *         - app_timer, presetup for bsp and ant pulse simulation.
 *         - bsp for signaling leds and user buttons (if use button is enabled in example).
 *         - ant pulse simulate for task of filling hrm profile data.
 */
static void utils_setup(void)
{
    uint32_t err_code;

    app_trace_init();

    // Initialize and start a single continuous mode timer, which is used to update the event time
    // on the main data page.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    #if (MODIFICATION_TYPE == MODIFICATION_TYPE_BUTTON)
    /** @snippet [ANT Pulse simulator button init] */
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        bsp_evt_handler);
    /** @snippet [ANT Pulse simulator button init] */
    #else
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);
    #endif

    err_code = app_timer_create(&m_tick_timer,
                                APP_TIMER_MODE_REPEATED,
                                app_tick_handler);
    APP_ERROR_CHECK(err_code);

    // Schedule a timeout event every 2 seconds
    err_code = app_timer_start(m_tick_timer, APP_TICK_EVENT_INTERVAL, NULL);
    APP_ERROR_CHECK(err_code);
}
开发者ID:kevin-ledinh,项目名称:banana-tree,代码行数:38,代码来源:main.c

示例2: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    // Initialize.
    app_trace_init();
    ble_stack_init();
    device_manager_init();
    timers_init();
    APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS);
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        NULL);
    APP_ERROR_CHECK(err_code);
    gap_params_init();
    advertising_init();
    services_init();
    sensor_simulator_init();
    conn_params_init();

    // Start execution.
    application_timers_start();
    advertising_start();

    // Enter main loop.
    for (;; )
    {
        power_manage();
    }
}
开发者ID:tkadom,项目名称:TWBLE,代码行数:31,代码来源:main.c

示例3: main

/**
 * @brief Function for application main entry.
 * @return 0. int return type required by ANSI/ISO standard.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    clock_initialization();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);

    // Set radio configuration parameters
    radio_configure();
    NRF_RADIO->PACKETPTR = (uint32_t)&packet;

    err_code = bsp_indication_set(BSP_INDICATE_USER_STATE_OFF);
    NRF_LOG_INFO("Wait for first packet\r\n");
    APP_ERROR_CHECK(err_code);
    NRF_LOG_FLUSH();    

    while (true)
    {
        uint32_t received = read_packet();

        err_code = bsp_indication_set(BSP_INDICATE_RCV_OK);
        NRF_LOG_INFO("Packet was received\r\n");
        APP_ERROR_CHECK(err_code);

        NRF_LOG_INFO("The contents of the package is %u\r\n", (unsigned int)received);
        NRF_LOG_FLUSH();
    }
}
开发者ID:Goodjamp,项目名称:ble_app_template,代码行数:37,代码来源:main.c

示例4: main

int main(void)
{
    uint32_t err_code;
    // Initialize.
    timers_init();
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);

    uart_init();
    ble_stack_init();

    twi_master_init();

    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
    nrf_delay_ms(200);
    bsp_indication_set(BSP_INDICATE_IDLE);
    nrf_delay_ms(200);
    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);

    update_sensor(0);
    start_advertising();
    timers_start();

    // Enter main loop.
    for (;; )
    {
        power_manage();
    }
}
开发者ID:ix-wetterstation,项目名称:sensor,代码行数:29,代码来源:main.c

示例5: main

/**@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();
		}
}
开发者ID:inamuj,项目名称:ble_app_uart,代码行数:36,代码来源:main.c

示例6: utils_setup

/**@brief Function for the timer, tracer, and BSP initialization.
 */
static void utils_setup(bool * p_erase_bonds)
{
		uint32_t err_code;
		bsp_event_t startup_event;

    app_trace_init();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);

		//bsp init ant
		err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
	//FROM BLE uint32_t err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),bsp_event_handler);

    APP_ERROR_CHECK(err_code);
	
	  // Create timers for BLE
    err_code = app_timer_create(&m_battery_timer_id,
                                APP_TIMER_MODE_REPEATED,
                                battery_level_meas_timeout_handler);
    APP_ERROR_CHECK(err_code);

    // Create battery timer.
    err_code = app_timer_create(&m_rsc_meas_timer_id,
                                APP_TIMER_MODE_REPEATED,
                                rsc_meas_timeout_handler);
    APP_ERROR_CHECK(err_code);
		
		  err_code = bsp_btn_ble_init(NULL, &startup_event);
    APP_ERROR_CHECK(err_code);

    *p_erase_bonds = (startup_event == BSP_EVENT_CLEAR_BONDING_DATA);
		
}
开发者ID:pavarinna,项目名称:AntBleCommunication,代码行数:34,代码来源:main.c

示例7: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    // Initialize.
    ble_stack_init();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(APP_BUTTON_DETECTION_DELAY, APP_TIMER_PRESCALER),
                        bsp_event_handler);
    APP_ERROR_CHECK(err_code);

    // Initialize advertising.
    advertising_init();

    // Start execution.
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:kevin-ledinh,项目名称:banana-tree,代码行数:28,代码来源:main.c

示例8: main

int main(int argc, char **argv){

    bsp_init(bspsieve, argc, argv);

    /* sequential part */
    if (argc != 2)
    {
        printf("Usage: %s N\n", argv[0]);
        bsp_abort("Incorrect invocation.\n");
    }
    sscanf(argv[1], "%lld", &N);

    printf("max prime requested = %lld\n", N);
    P = bsp_nprocs(); // maximum amount of procs

    if ( blockSize(P, 0, N) < sqrt(N))
        printf("WARNING: such a large P (%d) with relatively small N (%lld) is inefficient. \n Choosing a lower P is recommended.\n\n", P, N);

    printf("Using %d processors. \n", P);

    /* SPMD part */
    bspsieve();

    /* sequential part */
    exit(0);

} /* end main */
开发者ID:toothbrush,项目名称:eratosthenes,代码行数:27,代码来源:bspsieve.c

示例9: main

/**
 * @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();
        }
    }
}
开发者ID:AaltoNEPPI,项目名称:nRF52_dev,代码行数:29,代码来源:main.c

示例10: main

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;

    clock_init();

    // Start APP_TIMER to generate timeouts.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    leds_init();

    err_code = bsp_init(BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        bsp_evt_handler);
    APP_ERROR_CHECK(err_code);

    nfc_init();

    m_active_led_mask = BSP_LED_0_MASK;
    err_code = led_softblink_start(m_active_led_mask);
    APP_ERROR_CHECK(err_code);

    while (true)
    {
        __WFE();
        softblink_led_update();
    }
}
开发者ID:lyncxy119,项目名称:Sentry,代码行数:31,代码来源:main.c

示例11: main

int main( int argc, char **argv ) {

	#define BILLION  1E9

	const int size = 4;
	
	for(unsigned int l = 0;l < size;l++)
		vector[l] = (double) 1/size;

	clock_t start = clock();
	//start
	for(unsigned int w = 0;w<50;w++){ // Power method
		count = 0;
		for(int k = 0;k < size;k++){
			bsp_init( &spmd, argc, argv );
			spmd();
			count++;
		}
		memcpy(&vector,&vector_tmp,8*size);
	}
	//end
	clock_t end = clock();

	// Calculate time it took
	double elapsed = ((double) (end - start)) / CLOCKS_PER_SEC;
	printf("Time taken: %lfs\n", elapsed);

	for(unsigned int o = 0;o < size;o++)
		printf("Stationary vector [%d] = %f\n",o,vector_tmp[o]);
}
开发者ID:NielsVW,项目名称:PageRank,代码行数:30,代码来源:pagerank.c

示例12: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    // Initialize.
    ble_stack_init();
    timers_init();
    APP_GPIOTE_INIT(1);
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);
    device_manager_init();
    gap_params_init();
    advertising_init();
    services_init();
    sensor_simulator_init();
    conn_params_init();

    ble_evt_pool      = osPoolCreate(osPool(ble_evt_pool));
    ble_stack_msg_box = osMessageCreate(osMessageQ(ble_stack_msg_box), NULL);

    // Start execution.
    ble_stack_thread_id = osThreadCreate(osThread(ble_stack_thread), NULL);
    UNUSED_VARIABLE(ble_stack_thread_id);
    application_timers_start();
    advertising_start();

    // Enter main loop.
    for (;; )
    {
        UNUSED_VARIABLE(osDelay(1000));
    }
}
开发者ID:dhruvkakadiya,项目名称:OpenSJ_Bluz,代码行数:33,代码来源:main.c

示例13: utils_setup

/**@brief Function for the timer, tracer, and BSP initialization.
 */
static void utils_setup(void)
{
    uint32_t err_code;

    app_trace_init();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);

#if MODIFICATION_TYPE == MODIFICATION_TYPE_AUTO
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
#else
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        bsp_evt_handler);
#endif
    APP_ERROR_CHECK(err_code);
}
开发者ID:kevin-ledinh,项目名称:banana-tree,代码行数:18,代码来源:main.c

示例14: main

int main( int argc, char **argv )
{
    bsp_init( bspfft_test, argc, argv );

    printf( "How many processors do you want to use?\n" );
    fflush( stdout );

#ifdef _WIN32
    scanf_s( "%d", &P );
#else
    scanf( "%d", &P );
#endif

    if ( P > bsp_nprocs() )
    {
        printf( "Sorry, not enough processors available.\n" );
        fflush( stdout );
        exit( 1 );
    }

    bspfft_test();

    exit( 0 );

} /* end main */
开发者ID:haampie,项目名称:BSPLib,代码行数:25,代码来源:bspfft_test.cpp

示例15: main

int main() {

	printf( "Sequential part 1\n" );

	bsp_init( &spmd1, 0, NULL );
	spmd1();

	printf( "Sequential part 2\n" );

	bsp_init( &spmd2, 0, NULL );
	spmd2();

	printf( "Sequential part 3\n" );

	return EXIT_SUCCESS;	
}
开发者ID:pirp,项目名称:parallel_sieve,代码行数:16,代码来源:multistart.c


注:本文中的bsp_init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。