error fix

This commit is contained in:
yichin
2020-05-08 17:33:26 +08:00
parent eee659d320
commit 57641a2e4c
3 changed files with 31 additions and 27 deletions
@@ -304,29 +304,6 @@ static uint8_t headstage_debug_instruction(uint8_t* ins_buf) {
return 0;
}
/**
* @fn build amplifier bias
*/
static bool build_amp_bias(uint32_t* value) {
uint8_t ins_opcode = INSTRUCTION.ins_opcode;
switch (ins_opcode) {
case BIAS_ONE: {
*value = (0x01 << 23) | (0x39 << 16) | NEU_LNA_BIAS_ONE;
INSTRUCTION.ins_opcode = BIAS_TWO;
return false;
}
case BIAS_TWO: {
*value = (0x01 << 23) | (0x3A << 16) | NEU_LNA_BIAS_TWO;
INSTRUCTION.ins_opcode = BIAS_TWO;
return true;
}
default: {
return false;
}
}
}
/**
* @fn headstage_init
*
@@ -1017,7 +994,7 @@ static void headstage_neu_state_spi() {
SPICallBack = ONE_SHOT_SPI;
INSTRUCTION.ins_opcode = T_ZE;
nxt_ins = build_ins_ins(NEULIVE_STATE.config_type, &value); /**< set instruction one by one in order to set all the parameter.*/
nxt_ins = build_sti_ins(NEULIVE_STATE.config_type, &value); /**< set instruction one by one in order to set all the parameter.*/
NEULIVE_STATE.config_type = nxt_ins;
if (nxt_ins == NEU_SETUP_DONE) {
@@ -1135,7 +1112,7 @@ static void headstage_neu_state_spi() {
// terminate stimulation
case NEU_STI_INT {
case NEU_STI_INT: {
NEULIVE_STATE.state = NEU_STI_INT_TWICE;
SPICallBack = ONE_SHOT_SPI;
@@ -1145,7 +1122,7 @@ static void headstage_neu_state_spi() {
break;
}
case NEU_STI_INT_TWICE {
case NEU_STI_INT_TWICE: {
NEULIVE_STATE.state = NEU_CHECK_STI_INT;
SPICallBack = ONE_SHOT_SPI;
@@ -1155,7 +1132,7 @@ static void headstage_neu_state_spi() {
break;
}
case NEU_CHECK_STI_INT {
case NEU_CHECK_STI_INT: {
rec_sti_command &= ~STATUS_STI;
if(rec_sti_command & STATUS_REC){
check_register(STI_CHANNEL_REG, 0, NEU_PREPARE_READ);
@@ -4,6 +4,29 @@
#include "headstage_instruction.h"
/**
* @fn build amplifier bias
*/
static bool build_amp_bias(uint32_t* value) {
uint8_t ins_opcode = INSTRUCTION.ins_opcode;
switch (ins_opcode) {
case BIAS_ONE: {
*value = (0x01 << 23) | (0x39 << 16) | NEU_LNA_BIAS_ONE;
INSTRUCTION.ins_opcode = BIAS_TWO;
return false;
}
case BIAS_TWO: {
*value = (0x01 << 23) | (0x3A << 16) | NEU_LNA_BIAS_TWO;
INSTRUCTION.ins_opcode = BIAS_TWO;
return true;
}
default: {
return false;
}
}
}
static uint8_t build_rec_ins(uint8_t config_type, uint32_t* value) {
bool single_ch_config_done;
bool done;
@@ -198,6 +198,10 @@ static uint8_t build_sti_ins(uint8_t config_type, uint32_t* value){
*value = (0x01 << 23) | (0x38 << 16) | (INSTRUCTION.sti_mode << 2) | (INSTRUCTION.sti_h_bridge << 1) | (INSTRUCTION.sti_ref);
return NEU_SETUP_DONE;
}
default: {
return NEU_WARM_UP;
}
}
}
#endif