4k with data process

This commit is contained in:
weiting2
2020-07-22 10:16:01 +08:00
parent 332e8a127f
commit f3391fe63b
3 changed files with 46 additions and 41 deletions
@@ -353,19 +353,19 @@ static void headstage_neu_append_notify_data() {
uint8_t channel = spi_rxbuf[0];
// close-reopen SPI, if the first channel received is invalid
// if(IsFirstData){
// // start record
// if((INSTRUCTION.recording_channel & (0x0001 << channel)) && (channel < 16)){
// IsFirstData = false;
// }
// // restart SPI
// else{
// SPI_close(headstage_spi_handle);
// ReopenSPI();
// IsFirstData = true;
// return;
// }
// }
if(IsFirstData){
// start record
if((INSTRUCTION.recording_channel & (0x0001 << channel)) && (channel < 16)){
IsFirstData = false;
}
// restart SPI
else{
SPI_close(headstage_spi_handle);
ReopenSPI();
IsFirstData = true;
return;
}
}
// discard illegal channel
// uint16_t valid_channel = INSTRUCTION.recording_channel & (0x0001 << channel);
@@ -574,7 +574,7 @@ static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instructi
INSTRUCTION.vgr_intn = 16;
INSTRUCTION.vgr_int_old = 16;
INSTRUCTION.recording_channel = 0b0000000001000010;
INSTRUCTION.adc_clock_ratio = 50; // sample rate = [NEU_SYS_CLK / (sys_clk_ratio = 10)] / adc_clock_ratio
INSTRUCTION.adc_clock_ratio = 100; // sample rate = [NEU_SYS_CLK / (sys_clk_ratio = 10)] / adc_clock_ratio
INSTRUCTION.sys_clk_ratio = 10;
INSTRUCTION.sti_clock_ratio = 10;
INSTRUCTION.amplifier_gain = 0;
@@ -1094,19 +1094,19 @@ static void headstage_neu_state_spi() {
// recording
else{
for(int i=0 ; i<SPI_BUFFER_SIZE ; i++){
spi_txbuf[i] = 0;
}
if(data_rate_counter >= 63){
data_rate_counter = 0;
SimpleBLEPeripheral_blastData();
}
data_rate_counter ++;
headstage_spi_transaction(3);
// headstage_neu_append_notify_data();
// AppendSPITX(0, 0);
// headstage_spi_transaction(SPI_BUFFER_SIZE);
// for(int i=0 ; i<SPI_BUFFER_SIZE ; i++){
// spi_txbuf[i] = 0;
// }
//
// if(data_rate_counter >= 63){
// data_rate_counter = 0;
// SimpleBLEPeripheral_blastData();
// }
// data_rate_counter ++;
// headstage_spi_transaction(3);
headstage_neu_append_notify_data();
AppendSPITX(0, 0);
headstage_spi_transaction(SPI_BUFFER_SIZE);
}
break;
}
@@ -4,13 +4,13 @@
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 7
#define VERSION_DATE_DAY 21
#define VERSION_DATE_HOUR 16
#define VERSION_DATE_MINUTE 25
#define VERSION_DATE_DAY 22
#define VERSION_DATE_HOUR 10
#define VERSION_DATE_MINUTE 15
// this is NOT the version hash !!
// it's the last version hash
#define VERSION_HASH ab83ab2ce0c78fe4ff0b3bbc6fe97150b00a0895
#define VERSION_HASH 332e8a127fd02a8122c330ae9aa88e5b7ac51f85
#define VERSION_GIT_BRANCH neulive20_linux_debug
static void get_board_name(char *board_name_ch, uint8 *board_name_int, uint8 name_size){
@@ -15,13 +15,18 @@ static uint32_t not_time_stamp = 0;
static uint32_t debug_counter = 0;
static void headstage_notify_set_timestamp() {
// not_time_stamp = headstage_time_stamp_us();
//
not_time_stamp = headstage_time_stamp_us();
// headstage_notify_buffer[2] = not_time_stamp & 0xFF;
// headstage_notify_buffer[3] = (not_time_stamp >> 8) & 0xFF;
// headstage_notify_buffer[4] = (not_time_stamp >> 16) & 0xFF;
// headstage_notify_buffer[5] = (not_time_stamp >> 24) & 0xFF;
// debug_counter ++;
headstage_notify_buffer[2] = (debug_counter >> 24) & 0xFF;
headstage_notify_buffer[3] = (debug_counter >> 16) & 0xFF;
headstage_notify_buffer[4] = (debug_counter >> 8) & 0xFF;
headstage_notify_buffer[5] = debug_counter & 0xFF;
debug_counter ++;
}
static void headstage_notify_flip_buffer() {
@@ -49,13 +54,13 @@ static uint8_t headstage_notify_append_data(uint8_t *data_value) {
headstage_notify_buffer[not_buf_offset++] = data_value[2];
}
// if (not_buf_offset >= BLE_NOT_BUFF_SIZE - 1) {
// uint32_t current = headstage_time_stamp_us();
// uint32_t time_delta = ((current - not_time_stamp)) & 0xFFFF;
//
// headstage_notify_buffer[6] = time_delta & 0xFF;
// headstage_notify_buffer[7] = (time_delta >> 8) & 0xFF;
// }
if (not_buf_offset >= BLE_NOT_BUFF_SIZE - 1) {
uint32_t current = headstage_time_stamp_us();
uint32_t time_delta = ((current - not_time_stamp)) & 0xFFFF;
headstage_notify_buffer[6] = time_delta & 0xFF;
headstage_notify_buffer[7] = (time_delta >> 8) & 0xFF;
}
uint8_t ret = not_buf_offset;