static void try_send_sco(void) { printf("try send handle %x\n", sco_handle); if (!sco_handle) return; if (!hci_can_send_sco_packet_now(sco_handle)) { printf("try_send_sco, cannot send now\n"); return; } const int frames_per_packet = 9; hci_reserve_packet_buffer(); uint8_t * sco_packet = hci_get_outgoing_packet_buffer(); // set handle + flags bt_store_16(sco_packet, 0, sco_handle); // set len sco_packet[2] = frames_per_packet; int i; for (i=0; i<frames_per_packet; i++) { sco_packet[3+i] = sine[phase]; phase++; if (phase >= TABLE_SIZE) phase = 0; } hci_send_sco_packet_buffer(3 + frames_per_packet); }
static void try_send_sco(void){ if (!sco_handle) return; if (!hci_can_send_sco_packet_now(sco_handle)) { // printf("try_send_sco, cannot send now\n"); return; } const int frames_per_packet = 180; hci_reserve_packet_buffer(); uint8_t * sco_packet = hci_get_outgoing_packet_buffer(); // set handle + flags bt_store_16(sco_packet, 0, sco_handle); // set len sco_packet[2] = frames_per_packet; int i; for (i=0;i<frames_per_packet;i++){ sco_packet[3+i] = sine[phase]; phase++; if (phase >= sizeof(sine)) phase = 0; } hci_send_sco_packet_buffer(3 + frames_per_packet); static int count = 0; count++; if ((count & 15) == 0) printf("Sent %u\n", count); }