Compare commits

..

3 Commits

Author SHA1 Message Date
weiting2 93cdfd00f2 add fast settle function 2020-07-03 16:03:52 +08:00
yichin b10ee4de65 error fix 2020-07-03 15:33:14 +08:00
weiting2 1d3068ac7c add VIS_FAST_SET function 2020-07-03 10:57:26 +08:00
4 changed files with 66 additions and 20 deletions
@@ -238,15 +238,16 @@ extern ICall_Semaphore semaphore;
#define INS_TYPE_CIS 0x70
// VIS operator
#define VIS_INT 0x60
#define VIS_RST 0xF0
#define VIS_START 0xC0
#define VIS_REC 0x10
#define VIS_STI 0x20
#define VIS_STOP_REC 0x30
#define VIS_STOP_STI 0x40
#define VIS_CAL 0xA0
#define VIS_ASK 0x50
#define VIS_INT 0x60
#define VIS_FAST_SET 0x70
#define VIS_CAL 0xA0
#define VIS_START 0xC0
#define VIS_RST 0xF0
// CIS operator
@@ -379,10 +379,6 @@ static void headstage_neu_append_notify_data() {
uint8_t data_size = headstage_notify_append_data(not_buf);
if (data_size >= BLE_NOT_BUFF_SIZE) {
if(not_time_stamp % 200 == 0){
headstage_led_color(COLOR_GREEN);
headstage_led_color(COLOR_MAGENTA);
}
headstage_notify_flip_buffer();
headstage_notify_send();
}
@@ -568,7 +564,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 = 100;
INSTRUCTION.adc_clock_ratio = 50;
INSTRUCTION.sys_clk_ratio = 10;
INSTRUCTION.sti_clock_ratio = 10;
INSTRUCTION.amplifier_gain = 0;
@@ -590,7 +586,7 @@ static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instructi
INSTRUCTION.current_sti_cycle[0] = 100;
INSTRUCTION.current_sti_cycle[1] = 100;
INSTRUCTION.current_sti_cycle[8] = 10; // ch8 is volt ch
INSTRUCTION.sti_channel = 0b0000000000000000; // 0bxxxx_xxxv_cccc_cccc, c = current; v = volt, x = don't care
INSTRUCTION.sti_channel = 0b0000000000000011; // 0bxxxx_xxxv_cccc_cccc, c = current; v = volt, x = don't care
INSTRUCTION.arbitrary_en = 0;
INSTRUCTION.arbitrary_index = 0;
INSTRUCTION.sti_mode = 0; // 1 = continuous mode; 0 = limit mode
@@ -639,6 +635,56 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
/**< stop spi transaction */
break; /**< reset all the parameter */
}
case VIS_FAST_SET:{
INSTRUCTION.sti_t1[7] = 25;
INSTRUCTION.sti_t2[7] = 0;
INSTRUCTION.sti_t3[7] = 25;
INSTRUCTION.sti_t4[7] = 0;
INSTRUCTION.sti_t5[7] = 0;
INSTRUCTION.sti_t1[7] = 25;
INSTRUCTION.sti_t2[7] = 0;
INSTRUCTION.sti_t3[7] = 25;
INSTRUCTION.sti_t4[7] = 0;
INSTRUCTION.sti_t5[7] = 0;
INSTRUCTION.current_sti_cycle[7] = 0;
INSTRUCTION.current_sti_cycle[8] = 10; // ch8 is volt ch
INSTRUCTION.sti_channel = 0b0000000010000000; // 0bxxxx_xxxv_cccc_cccc, c = current; v = volt, x = don't care
INSTRUCTION.arbitrary_en = 0;
INSTRUCTION.arbitrary_index = 0;
INSTRUCTION.sti_mode = 0; // 1 = continuous mode; 0 = limit mode
INSTRUCTION.sti_h_bridge = 0; // voltage sti must use H-bridge
INSTRUCTION.sti_ref = 0; // 1 = GND; 0 = Vref
/* the first byte decide current sti polarity */
// e.g. 0b0000_0101 => ch0, ch2 positive, others negative
/* the second byte decide voltage sti polarity */
// for the second byte, 0bxxxx_XXXX, decide voltage sti p & n channel;
// xxxx is p-channel (16 choose 1), XXXX is n-channel
INSTRUCTION.current_sti_polarity = 0b1000000000000000;
INSTRUCTION.sti_amplitude_h = 0x0000; // it's t1 amplitude
INSTRUCTION.sti_amplitude_l = 0x0000; // it's t3 amplitude
INSTRUCTION.voltage_sti_amplitude = 0x0F;
rec_sti_command |= ENABLE_STI;
NEULIVE_STATE.state = NEU_WRITE_STI_INS;
NEULIVE_STATE.config_type = NEU_WARM_UP;
SPICallBack = ONE_SHOT_SPI;
INSTRUCTION.ins_opcode = T_ZE;
// is neu wording now?
if( (rec_sti_command & STATUS_STI) || (rec_sti_command & STATUS_REC) ){
// nothing to do
}
else{
flag_notify(EVT_NEU_SPI);
}
break;
}
case VIS_START: {
// for(int i=0 ; i<12 ; i++){
// FlushNotify();
@@ -5,13 +5,13 @@
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 7
#define VERSION_DATE_DAY 3
#define VERSION_DATE_HOUR 10
#define VERSION_DATE_MINUTE 24
#define VERSION_DATE_HOUR 16
#define VERSION_DATE_MINUTE 3
// this is NOT the version hash !!
// it's the last version hash
#define VERSION_HASH 0d8b548a31813f9b04de280259ae78e8263c72b3
#define VERSION_GIT_BRANCH CentralDataRateTest_neulive2
#define VERSION_HASH b10ee4de657a39fc4d8179822d4bf0f2231b3b73
#define VERSION_GIT_BRANCH Neulive2.0_developement
static void get_board_name(char *board_name_ch, uint8 *board_name_int, uint8 name_size){
uint8 name_offset = 18;
@@ -14,13 +14,12 @@ static uint8_t not_buf_offset = NOT_BUF_OFFSET_INIT;
static uint32_t not_time_stamp = 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 >> 24) & 0xFF;
headstage_notify_buffer[3] = (not_time_stamp >> 16) & 0xFF;
headstage_notify_buffer[4] = (not_time_stamp >> 8) & 0xFF;
headstage_notify_buffer[5] = not_time_stamp & 0xFF;
not_time_stamp ++;
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;
}
static void headstage_notify_flip_buffer() {