mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-26 02:37:41 +00:00
use common init in main.c
This commit is contained in:
parent
e5985bbbf8
commit
f61a6c2b1a
@ -34,6 +34,7 @@ CORE = \
|
|||||||
run_loop.c \
|
run_loop.c \
|
||||||
run_loop_embedded.c \
|
run_loop_embedded.c \
|
||||||
utils.c \
|
utils.c \
|
||||||
|
main.c \
|
||||||
|
|
||||||
COMMON = \
|
COMMON = \
|
||||||
hal_uart_dma.c \
|
hal_uart_dma.c \
|
||||||
@ -41,11 +42,11 @@ COMMON = \
|
|||||||
hci.c \
|
hci.c \
|
||||||
hci_cmds.c \
|
hci_cmds.c \
|
||||||
hci_transport_h4_ehcill_dma.c \
|
hci_transport_h4_ehcill_dma.c \
|
||||||
|
remote_device_db_memory.c \
|
||||||
|
|
||||||
SPP = \
|
SPP = \
|
||||||
l2cap.c \
|
l2cap.c \
|
||||||
l2cap_signaling.c \
|
l2cap_signaling.c \
|
||||||
remote_device_db_memory.c \
|
|
||||||
rfcomm.c \
|
rfcomm.c \
|
||||||
sdp_util.c \
|
sdp_util.c \
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ all: led_counter.hex spp_counter.hex spp_accel.hex gap_inquiry.hex spp_flowcontr
|
|||||||
python ${BTSTACK_ROOT}/ble/compile-gatt.py $< $@
|
python ${BTSTACK_ROOT}/ble/compile-gatt.py $< $@
|
||||||
|
|
||||||
|
|
||||||
led_counter.out: ${CORE_OBJ} led_counter.o
|
led_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${CC2560B} led_counter.o
|
||||||
${CC} $^ ${LDFLAGS} -o $@
|
${CC} $^ ${LDFLAGS} -o $@
|
||||||
|
|
||||||
ant-test.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} profile.h sdp.o ant_cmds.o ${CC2567} ant-test.o
|
ant-test.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} profile.h sdp.o ant_cmds.o ${CC2567} ant-test.o
|
||||||
@ -110,22 +111,22 @@ hid_demo.out: ${CORE_OBJ} ${COMMON_OBJ} ${LCD_OBJ} ${SPP_OBJ} ${CC2560B} hid_dem
|
|||||||
spp_accel.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_accel.o sdp.o hal_adc.o
|
spp_accel.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_accel.o sdp.o hal_adc.o
|
||||||
${CC} $^ ${LDFLAGS} -o $@
|
${CC} $^ ${LDFLAGS} -o $@
|
||||||
|
|
||||||
spp_and_le_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${BLE_OBJ} main.o spp_and_le_counter.h spp_and_le_counter.o sdp.o hal_adc.o
|
spp_and_le_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${BLE_OBJ} spp_and_le_counter.h spp_and_le_counter.o sdp.o hal_adc.o
|
||||||
${CC} $^ ${LDFLAGS} -o $@
|
${CC} $^ ${LDFLAGS} -o $@
|
||||||
|
|
||||||
spp_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} main.o spp_counter.o sdp.o hal_adc.o
|
spp_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_counter.o sdp.o hal_adc.o
|
||||||
${CC} $^ ${LDFLAGS} -o $@
|
${CC} $^ ${LDFLAGS} -o $@
|
||||||
|
|
||||||
spp_flowcontrol.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} main.o spp_flowcontrol.o sdp.o hal_adc.o
|
spp_flowcontrol.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_flowcontrol.o sdp.o hal_adc.o
|
||||||
${CC} $^ ${LDFLAGS} -o $@
|
${CC} $^ ${LDFLAGS} -o $@
|
||||||
|
|
||||||
gap_inquiry.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} main.o gap_inquiry.o hal_adc.o
|
gap_inquiry.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} gap_inquiry.o hal_adc.o
|
||||||
${CC} $^ ${LDFLAGS} -o $@
|
${CC} $^ ${LDFLAGS} -o $@
|
||||||
|
|
||||||
sdp_rfcomm_query.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${SDP_CLIENT} ${CC2560B} main.o sdp_rfcomm_query.o hal_adc.o
|
sdp_rfcomm_query.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${SDP_CLIENT} ${CC2560B} sdp_rfcomm_query.o hal_adc.o
|
||||||
${CC} $^ ${LDFLAGS} -o $@
|
${CC} $^ ${LDFLAGS} -o $@
|
||||||
|
|
||||||
sdp_general_query.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${SDP_CLIENT} ${CC2560B} main.o sdp_general_query.o hal_adc.o
|
sdp_general_query.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${SDP_CLIENT} ${CC2560B} sdp_general_query.o hal_adc.o
|
||||||
${CC} $^ ${LDFLAGS} -o $@
|
${CC} $^ ${LDFLAGS} -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -179,38 +179,9 @@ static void heartbeat_handler(struct timer *ts){
|
|||||||
run_loop_add_timer(ts);
|
run_loop_add_timer(ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// main
|
int btstack_main(int argc, const char * argv[]);
|
||||||
int main(void)
|
int btstack_main(int argc, const char * argv[]){
|
||||||
{
|
|
||||||
// stop watchdog timer
|
|
||||||
WDTCTL = WDTPW + WDTHOLD;
|
|
||||||
|
|
||||||
//Initialize clock and peripherals
|
|
||||||
halBoardInit();
|
|
||||||
halBoardStartXT1();
|
|
||||||
halBoardSetSystemClock(SYSCLK_16MHZ);
|
|
||||||
|
|
||||||
// init debug UART
|
|
||||||
halUsbInit();
|
|
||||||
|
|
||||||
// init LEDs
|
|
||||||
LED_PORT_OUT |= LED_1 | LED_2;
|
|
||||||
LED_PORT_DIR |= LED_1 | LED_2;
|
|
||||||
|
|
||||||
/// GET STARTED with BTstack ///
|
|
||||||
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();
|
|
||||||
hci_uart_config_t * config = hci_uart_config_cc256x_instance();
|
|
||||||
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
|
|
||||||
hci_init(transport, config, control, remote_db);
|
|
||||||
|
|
||||||
// use eHCILL
|
|
||||||
bt_control_cc256x_enable_ehcill(1);
|
|
||||||
|
|
||||||
// init L2CAP
|
// init L2CAP
|
||||||
l2cap_init();
|
l2cap_init();
|
||||||
l2cap_register_packet_handler(packet_handler);
|
l2cap_register_packet_handler(packet_handler);
|
||||||
@ -236,9 +207,6 @@ int main(void)
|
|||||||
|
|
||||||
printf("Run...\n\r");
|
printf("Run...\n\r");
|
||||||
|
|
||||||
// ready - enable irq used in h4 task
|
|
||||||
__enable_interrupt();
|
|
||||||
|
|
||||||
// turn on!
|
// turn on!
|
||||||
hci_power_control(HCI_POWER_ON);
|
hci_power_control(HCI_POWER_ON);
|
||||||
|
|
||||||
|
@ -247,43 +247,12 @@ static int att_write_callback(uint16_t con_handle, uint16_t att_handle, uint16_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// main
|
int btstack_main(int argc, const char * argv[]);
|
||||||
int main(void)
|
int btstack_main(int argc, const char * argv[]){
|
||||||
{
|
|
||||||
// stop watchdog timer
|
|
||||||
WDTCTL = WDTPW + WDTHOLD;
|
|
||||||
|
|
||||||
//Initialize clock and peripherals
|
|
||||||
halBoardInit();
|
|
||||||
halBoardStartXT1();
|
|
||||||
halBoardSetSystemClock(SYSCLK_16MHZ);
|
|
||||||
|
|
||||||
// Debug UART
|
|
||||||
halUsbInit();
|
|
||||||
|
|
||||||
// show off
|
// show off
|
||||||
doLCD();
|
doLCD();
|
||||||
|
|
||||||
// init debug UART
|
|
||||||
halUsbInit();
|
|
||||||
|
|
||||||
// init LEDs
|
|
||||||
LED_PORT_OUT |= LED_1 | LED_2;
|
|
||||||
LED_PORT_DIR |= LED_1 | LED_2;
|
|
||||||
|
|
||||||
/// GET STARTED with BTstack ///
|
|
||||||
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();
|
|
||||||
hci_uart_config_t * config = hci_uart_config_cc256x_instance();
|
|
||||||
hci_init(transport, config, control, NULL);
|
|
||||||
|
|
||||||
// use eHCILL
|
|
||||||
// bt_control_cc256x_enable_ehcill(1);
|
|
||||||
|
|
||||||
// set up l2cap_le
|
// set up l2cap_le
|
||||||
l2cap_init();
|
l2cap_init();
|
||||||
|
|
||||||
@ -301,9 +270,6 @@ int main(void)
|
|||||||
|
|
||||||
printf("Run...\n\r");
|
printf("Run...\n\r");
|
||||||
|
|
||||||
// ready - enable irq used in h4 task
|
|
||||||
__enable_interrupt();
|
|
||||||
|
|
||||||
// turn on!
|
// turn on!
|
||||||
hci_power_control(HCI_POWER_ON);
|
hci_power_control(HCI_POWER_ON);
|
||||||
|
|
||||||
|
@ -49,41 +49,13 @@ static void timer_setup(){
|
|||||||
run_loop_register_timer(&heartbeat, HEARTBEAT_PERIOD_MS);
|
run_loop_register_timer(&heartbeat, HEARTBEAT_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hw_setup(){
|
int btstack_main(int argc, const char * argv[]);
|
||||||
// stop watchdog timer
|
int btstack_main(int argc, const char * argv[]){
|
||||||
WDTCTL = WDTPW + WDTHOLD;
|
|
||||||
|
|
||||||
//Initialize clock and peripherals
|
|
||||||
halBoardInit();
|
|
||||||
halBoardStartXT1();
|
|
||||||
halBoardSetSystemClock(SYSCLK_16MHZ);
|
|
||||||
|
|
||||||
// init debug UART
|
|
||||||
halUsbInit();
|
|
||||||
|
|
||||||
// init LEDs
|
|
||||||
LED_PORT_OUT |= LED_1 | LED_2;
|
|
||||||
LED_PORT_DIR |= LED_1 | LED_2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void btstack_setup(){
|
|
||||||
/// GET STARTED with BTstack ///
|
|
||||||
btstack_memory_init();
|
|
||||||
run_loop_init(RUN_LOOP_EMBEDDED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// main
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
hw_setup();
|
|
||||||
btstack_setup();
|
|
||||||
timer_setup();
|
timer_setup();
|
||||||
|
|
||||||
printf("Run...\n\r");
|
printf("Run...\n\r");
|
||||||
|
|
||||||
// ready - enable irq used in h4 task
|
|
||||||
__enable_interrupt();
|
|
||||||
|
|
||||||
// turn on!
|
// turn on!
|
||||||
// go!
|
// go!
|
||||||
run_loop_execute();
|
run_loop_execute();
|
||||||
|
@ -166,48 +166,13 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// main
|
int btstack_main(int argc, const char * argv[]);
|
||||||
int main(void) {
|
int btstack_main(int argc, const char * argv[]){
|
||||||
|
|
||||||
// stop watchdog timer
|
|
||||||
WDTCTL = WDTPW + WDTHOLD;
|
|
||||||
|
|
||||||
//Initialize clock and peripherals
|
|
||||||
halBoardInit();
|
|
||||||
halBoardStartXT1();
|
|
||||||
halBoardSetSystemClock(SYSCLK_16MHZ);
|
|
||||||
|
|
||||||
// Debug UART
|
|
||||||
halUsbInit();
|
|
||||||
|
|
||||||
// Accel
|
// Accel
|
||||||
halAccelerometerInit();
|
halAccelerometerInit();
|
||||||
|
|
||||||
// MindTree demo doesn't calibrate
|
|
||||||
// halAccelerometerCalibrate();
|
|
||||||
|
|
||||||
// init LEDs
|
|
||||||
LED_PORT_OUT |= LED_1 | LED_2;
|
|
||||||
LED_PORT_DIR |= LED_1 | LED_2;
|
|
||||||
|
|
||||||
prepare_accel_packet();
|
prepare_accel_packet();
|
||||||
|
|
||||||
printf("Init BTstack...\n\r");
|
|
||||||
|
|
||||||
/// GET STARTED ///
|
|
||||||
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();
|
|
||||||
hci_uart_config_t * config = hci_uart_config_cc256x_instance();
|
|
||||||
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
|
|
||||||
hci_init(transport, config, control, remote_db);
|
|
||||||
|
|
||||||
// use eHCILL
|
|
||||||
bt_control_cc256x_enable_ehcill(1);
|
|
||||||
|
|
||||||
// init L2CAP
|
// init L2CAP
|
||||||
l2cap_init();
|
l2cap_init();
|
||||||
l2cap_register_packet_handler(packet_handler);
|
l2cap_register_packet_handler(packet_handler);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user