Esempio n. 1
0
// main
int app_main(void){

    printf("BTstack: setup\n");

    // enable packet logger
    hci_dump_open(NULL, HCI_DUMP_STDOUT);

    /// GET STARTED with BTstack ///
    btstack_memory_init();
    btstack_run_loop_init(btstack_run_loop_freertos_get_instance());

    // init HCI
    hci_init(transport_get_instance(), NULL);

    // setup TLV ESP32 implementation
    const btstack_tlv_t * btstack_tlv_impl = btstack_tlv_esp32_get_instance();

    // setup Link Key DB using TLV
    const btstack_link_key_db_t * btstack_link_key_db = btstack_link_key_db_tlv_get_instance(btstack_tlv_impl, NULL);
    hci_set_link_key_db(btstack_link_key_db);

    // setup LE Device DB using TLV
    le_device_db_tlv_configure(btstack_tlv_impl, NULL);

    // inform about BTstack state
    hci_event_callback_registration.callback = &packet_handler;
    hci_add_event_handler(&hci_event_callback_registration);

    btstack_main(0, NULL);

    printf("BTstack: execute run loop\n");
    btstack_run_loop_execute();
    return 0;
}
Esempio n. 2
0
int main(int argc, const char * argv[]){

	/// GET STARTED with BTstack ///
	btstack_memory_init();
    btstack_run_loop_init(btstack_run_loop_posix_get_instance());
	    
    // use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
    hci_dump_open("/tmp/hci_dump.pklg", HCI_DUMP_PACKETLOGGER);

    // init HCI
	hci_init(hci_transport_usb_instance(), NULL);
    hci_set_link_key_db(btstack_link_key_db_fs_instance());
    
    // inform about BTstack state
    hci_event_callback_registration.callback = &packet_handler;
    hci_add_event_handler(&hci_event_callback_registration);

    // handle CTRL-c
    signal(SIGINT, sigint_handler);

    // setup app
    btstack_main(argc, argv);

    // go
    btstack_run_loop_execute();    

    return 0;
}
Esempio n. 3
0
int main(int argc, const char * argv[]){

	/// GET STARTED with BTstack ///
	btstack_memory_init();
    run_loop_init(RUN_LOOP_POSIX);
	    
    // use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
    hci_dump_open("/tmp/hci_dump.pklg", HCI_DUMP_PACKETLOGGER);

    // init HCI
	hci_transport_t    * transport = hci_transport_usb_instance();
    hci_uart_config_t * config = NULL;
	bt_control_t       * control   = NULL;
    remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_fs;
        
	hci_init(transport, config, control, remote_db);
    
    // handle CTRL-c
    signal(SIGINT, sigint_handler);

    // setup app
    btstack_main(argc, argv);

    // go
    run_loop_execute();    

    return 0;
}
Esempio n. 4
0
int main(void)
{
	clock_setup();
	gpio_setup();
	hal_tick_init();
	debug_usart_setup();
	bluetooth_setup();

	// start with BTstack init - especially configure HCI Transport
    btstack_memory_init();
    run_loop_init(RUN_LOOP_EMBEDDED);
    
    // init HCI
    hci_transport_t    * transport = hci_transport_h4_dma_instance();
    bt_control_t       * control   = bt_control_cc256x_instance();
    remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
    hci_init(transport, (void*) &hci_uart_config_cc256x, control, remote_db);

    // enable eHCILL
    bt_control_cc256x_enable_ehcill(1);

	// hand over to btstack embedded code 
    btstack_main();

    // go
    run_loop_execute();

	return 0;
}
Esempio n. 5
0
int main(int argc, const char * argv[]){

	/// GET STARTED with BTstack ///
	btstack_memory_init();
    run_loop_init(RUN_LOOP_POSIX);
	    
    // use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
    hci_dump_open("/tmp/hci_dump.pklg", HCI_DUMP_PACKETLOGGER);

    // pick serial port
    hci_uart_config_cc256x.device_name = "/dev/tty.usbserial-AD025KU2";

    // init HCI
	hci_transport_t    * transport = hci_transport_h4_instance();
	bt_control_t       * control   = bt_control_stlc2500d_instance();
    remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_fs;
        
	hci_init(transport, (void*) &hci_uart_config_cc256x, control, remote_db);
    
    // handle CTRL-c
    signal(SIGINT, sigint_handler);

    // setup app
    btstack_main(argc, argv);

    // go
    run_loop_execute();    

    return 0;
}
Esempio n. 6
0
// main
int main(void){

    hw_setup();

    btstack_setup();
    btstack_main(0, NULL);

    btstack_run_loop_execute();

    return 0;
}
Esempio n. 7
0
void BTSTACK_Initialize ( void )
{
    printf("\n\nBTstack_Initialize()\n");

    btstack_memory_init();
    run_loop_init(RUN_LOOP_EMBEDDED);

    hci_dump_open(NULL, HCI_DUMP_STDOUT);

    hci_transport_t * transport = hci_transport_h4_dma_instance();
    bt_control_t    * control   = bt_control_csr_instance();
    hci_init(transport, (void*) &hci_uart_config_csr, control, NULL);

    // hci_power_control(HCI_POWER_ON);
    btstack_main(0, NULL);
}
Esempio n. 8
0
int main(int argc, const char * argv[]){

	/// GET STARTED with BTstack ///
	btstack_memory_init();
    btstack_run_loop_init(btstack_run_loop_posix_get_instance());
	    
    // use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
    hci_dump_open("/tmp/hci_dump.pklg", HCI_DUMP_PACKETLOGGER);

    // pick serial port
    // config.device_name = "/dev/tty.usbserial-A900K2WS"; // DFROBOT
    // config.device_name = "/dev/tty.usbserial-A50285BI"; // BOOST-CC2564MODA New
    // config.device_name = "/dev/tty.usbserial-A9OVNX5P"; // RedBear IoT pHAT breakout board
    config.device_name = "/dev/tty.usbserial-A900K0VK"; // CSR8811 breakout board

    // init HCI
    const btstack_uart_block_t * uart_driver = btstack_uart_block_posix_instance();
    const hci_transport_t * transport = hci_transport_h5_instance(uart_driver);
    const btstack_link_key_db_t * link_key_db = btstack_link_key_db_fs_instance();
	hci_init(transport, (void*) &config);
    hci_set_link_key_db(link_key_db);

    // enable BCSP mode for CSR chipsets - auto detect might not work
    // hci_transport_h5_enable_bcsp_mode();

    // set BD_ADDR for CSR without Flash/unique address
    // bd_addr_t own_address = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
    // btstack_chipset_csr_set_bd_addr(own_address);

    // enable auto-sleep mode
    // hci_transport_h5_set_auto_sleep(300);

    // register for HCI events
    hci_event_callback_registration.callback = &packet_handler;
    hci_add_event_handler(&hci_event_callback_registration);

    // handle CTRL-c
    signal(SIGINT, sigint_handler);

    // setup app
    btstack_main(argc, argv);

    // go
    btstack_run_loop_execute();    

    return 0;
}
Esempio n. 9
0
void BTSTACK_Initialize ( void )
{
    printf("\n\nBTstack_Initialize()\n");

    btstack_memory_init();
    btstack_run_loop_init(btstack_run_loop_embedded_get_instance());

    hci_dump_open(NULL, HCI_DUMP_STDOUT);

    const hci_transport_t * transport = hci_transport_h4_instance();
    hci_init(transport, &config);
    hci_set_chipset(btstack_chipset_csr_instance());

    // inform about BTstack state
    hci_event_callback_registration.callback = &packet_handler;
    hci_add_event_handler(&hci_event_callback_registration);

    btstack_main(0, NULL);
}
Esempio n. 10
0
int main(int argc, const char * argv[]){

	/// GET STARTED with BTstack ///
	btstack_memory_init();
    btstack_run_loop_init(btstack_run_loop_posix_get_instance());
	    
    // use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
    hci_dump_open("/tmp/hci_dump.pklg", HCI_DUMP_PACKETLOGGER);

    // pick serial port
    config.device_name = "/dev/tty.usbserial-A900K0VK";

    // init HCI
    const btstack_uart_block_t * uart_driver = btstack_uart_block_posix_instance();
	const hci_transport_t * transport = hci_transport_h4_instance(uart_driver);
    const btstack_link_key_db_t * link_key_db = btstack_link_key_db_fs_instance();
	hci_init(transport, (void*) &config);
    hci_set_link_key_db(link_key_db);
    
    // inform about BTstack state
    hci_event_callback_registration.callback = &packet_handler;
    hci_add_event_handler(&hci_event_callback_registration);

    // setup dynamic chipset driver setup
    hci_set_local_version_information_callback(&local_version_information_callback);

    // handle CTRL-c
    signal(SIGINT, sigint_handler);

    // setup app
    btstack_main(argc, argv);

    // go
    btstack_run_loop_execute();    

    return 0;
}
Esempio n. 11
0
int main()
{
	int i;

#ifdef FPGA 
	pll_init();
#else
	bt16_pll_init();
#endif
    delay(500000);

    uart_init((96000000/ 460800));  // pa8
    puts(pubDate);
    puts("...fpga bt16 setup ok.......\n");

#ifdef FPGA 
	spi_int();  
#endif
    puts("-----1\n");
	system_init();

    puts("-----2\n");
	timer0_start();

    puts("-----3\n");
	RF_init();

    //----------debug
    HWI_Install(1, exception_isr, 3) ; //timer0_isr
    

	ENABLE_INT();

    puts("-----4\n");
	thread_init(os_create_thread, os_delete_thread);

    puts("-----5\n");
	sys_timer_init();

    puts("-----6\n");
    ble_main();
    btstack_main();

	/* device_manager_init(); */

	/*INTALL_HWI(BT_BLE_INT, le_hw_isr, 0);
	INTALL_HWI(18, le_test_uart_isr, 0);*/

	lbuf_init(malloc_buf, sizeof(malloc_buf)*4);

	/* btstack_v21_main(); */

    puts("------------4.0 start run loop-----------\n");
    while(1)
    {
		int c;
       //asm("idle");
	   /*delay(100000);*/
		for (i=0; i<PRIORITY_NUM; i++)
		{
			if (thread_fun[i]){
				thread_fun[i](i);
			}

		}
        c = getchar();
        switch(c)
        {
            case 'A':
                puts("user cmd : ADV\n");
                ble_set_adv();
                break;
            case 'S':
                puts("user cmd : SCAN\n");
                ble_set_scan();
                break;
            default:
                break;
        }

		/*run_loop_execute();*/
	   /*printf("k");*/
    }

    return 0;
}