runloop: set ds->process via setter

This commit is contained in:
Matthias Ringwald 2016-03-24 19:42:12 +01:00
parent 835c167141
commit 40403fbfd4
4 changed files with 5 additions and 8 deletions

View File

@ -145,11 +145,7 @@ static uint16_t tx_len; // 0 == no outgoing packet
static btstack_timer_source_t ehcill_sleep_ack_timer;
// data source used in run_loop
static btstack_data_source_t hci_transport_h4_dma_ds = {
/* .item = */ { NULL },
/* .fd = */ 0,
/* .process = */ h4_process
};
static btstack_data_source_t hci_transport_h4_dma_ds;
// hci_transport for use by hci
static const hci_transport_h4_t hci_transport_h4_ehcill_dma = {
@ -195,6 +191,7 @@ static int h4_open(void){
hal_uart_dma_set_csr_irq_handler(ehcill_cts_irq_handler);
// set up data_source
btstack_run_loop_set_data_source_handler(&hci_transport_h4_dma_ds);
btstack_run_loop_add_data_source(&hci_transport_h4_dma_ds);
// init state machines

View File

@ -213,7 +213,7 @@ static int h4_open(void){
if (!hci_transport_h4->ds) return -1;
hci_transport_h4->uart_fd = fd;
hci_transport_h4->ds->fd = fd;
btstack_run_loop_set_data_source_handler(hci_transport_h4, &h4_process);
btstack_run_loop_set_data_source_handler(hci_transport_h4->ds, &h4_process);
btstack_run_loop_add_data_source(hci_transport_h4->ds);
// also set baudrate

View File

@ -63,7 +63,7 @@ void btstack_stdin_setup(int (*stdin_process)(btstack_data_source_t *_ds)){
#endif
stdin_source.fd = 0; // stdin
stdin_source.process = stdin_process;
btstack_run_loop_set_data_source_handler(&stdin_source, &stdin_process);
btstack_run_loop_add_data_source(&stdin_source);
activated = 1;

View File

@ -745,7 +745,7 @@ void iphone_register_for_power_notifications(void (*cb)(POWER_NOTIFICATION_t eve
// set up data source handler
power_notification_ds.fd = power_notification_pipe_fds[0];
power_notification_ds.process = power_notification_process;
btstack_run_loop_set_data_source_handler(&power_notification_ds, &power_notification_process);
btstack_run_loop_add_data_source(&power_notification_ds);
}