4K sample / sec

This commit is contained in:
yichin
2020-04-21 18:30:47 +08:00
parent 8e21db3440
commit 7a3c746547
2 changed files with 42 additions and 44 deletions
@@ -370,29 +370,27 @@ static void headstage_update_instruction(uint8_t *instruction) {
uint8_t ins_oper = instruction[1] & 0xF0;
uint8_t ins_len = instruction[1] & 0x0F;
// switch (ins_type) {
// case INS_TYPE_RIS: {
// headstage_update_ris_instruction(ins_len, instruction + 2);
// break;
// }
// case INS_TYPE_VIS: {
// headstage_update_vis_instruction(ins_oper);
// break;
// }
// case INS_TYPE_CIS: {
// if(ins_oper == CIS_CALI){
// // CIS has only 20 byte now
// // need ins[2] to choose return gain or offset
// SendCaliValue(instruction[2]);
// }
// else{
// headstage_update_cis_instruction(ins_oper);
// }
// break;
// }
// }
switch (ins_type) {
case INS_TYPE_RIS: {
headstage_update_ris_instruction(ins_len, instruction + 2);
break;
}
case INS_TYPE_VIS: {
headstage_update_vis_instruction(ins_oper);
break;
}
case INS_TYPE_CIS: {
if(ins_oper == CIS_CALI){
// CIS has only 20 byte now
// need ins[2] to choose return gain or offset
SendCaliValue(instruction[2]);
}
else{
headstage_update_cis_instruction(ins_oper);
}
break;
}
}
}
/**
@@ -627,14 +627,14 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
// headstage_event_handle();
// }
if (events & SBP_PERIODIC_EVT) {
events &= ~SBP_PERIODIC_EVT;
Util_startClock(&periodicClock);
// Perform periodic application task
SimpleBLEPeripheral_performPeriodicTask();
}
// if (events & SBP_PERIODIC_EVT) {
// events &= ~SBP_PERIODIC_EVT;
//
// Util_startClock(&periodicClock);
//
// // Perform periodic application task
// SimpleBLEPeripheral_performPeriodicTask();
// }
#ifdef FEATURE_OAD
while (!Queue_empty(oad_queue_handle)) {
@@ -801,7 +801,7 @@ static void SimpleBLEPeripheral_processAppMsg(sbpEvt_t *message) {
break;
case SBP_CHAR_CHANGE_EVT:
Util_startClock(&periodicClock);
// Util_startClock(&periodicClock);
headstage_characteristic_updated(message->hdr.state);
break;
}
@@ -998,18 +998,18 @@ static void SimpleBLEPeripheral_enqueueMsg(uint8_t event, uint8_t state) {
*/
static void SimpleBLEPeripheral_blastData() {
uint32_t not_time_stamp = headstage_time_stamp_us();
headstage_notify_buffer[0] = msg_counter & 0xFF;
headstage_notify_buffer[1] = (msg_counter >> 8) & 0xFF;
headstage_notify_buffer[2] = (msg_counter >> 16) & 0xFF;
headstage_notify_buffer[3] = (msg_counter >> 24) & 0xFF;
headstage_notify_buffer[4] = 0xFB;
headstage_notify_buffer[5] = not_time_stamp & 0xFF;
headstage_notify_buffer[6] = (not_time_stamp >> 8) & 0xFF;
headstage_notify_buffer[7] = (not_time_stamp >> 16) & 0xFF;
headstage_notify_buffer[8] = (not_time_stamp >> 24) & 0xFF;
msg_counter++;
SimpleProfile_SetParameter(BLE_NOT_BUFF_CHAR, BLE_NOT_BUFF_SIZE, headstage_notify_buffer);
// uint32_t not_time_stamp = headstage_time_stamp_us();
// headstage_notify_buffer[0] = msg_counter & 0xFF;
// headstage_notify_buffer[1] = (msg_counter >> 8) & 0xFF;
// headstage_notify_buffer[2] = (msg_counter >> 16) & 0xFF;
// headstage_notify_buffer[3] = (msg_counter >> 24) & 0xFF;
// headstage_notify_buffer[4] = 0xFB;
// headstage_notify_buffer[5] = not_time_stamp & 0xFF;
// headstage_notify_buffer[6] = (not_time_stamp >> 8) & 0xFF;
// headstage_notify_buffer[7] = (not_time_stamp >> 16) & 0xFF;
// headstage_notify_buffer[8] = (not_time_stamp >> 24) & 0xFF;
// msg_counter++;
// SimpleProfile_SetParameter(BLE_NOT_BUFF_CHAR, BLE_NOT_BUFF_SIZE, headstage_notify_buffer);
// Subtract the total packet overhead of ATT and L2CAP layer from notification payload
// uint16_t len = MAX_PDU_SIZE - TOTAL_PACKET_OVERHEAD;