sti cali do NOT use number less than 1

This commit is contained in:
weiting2
2020-04-27 13:21:43 +08:00
parent e4f9ba5ba3
commit 007ffcbe85
5 changed files with 44 additions and 32 deletions
@@ -56,10 +56,10 @@ instruction operator
| VIS_INT | 0x60 | interrupt device |
| | 0x70 | not used |
| | 0x80 | not used |
| VIS_FUH | 0x90 | not used |
| VIS_STI | 0x90 | en/disable stimulation |
| VIS_CAL | 0xA0 | not used |
| | 0xB0 | not used |
| VIS_STI | 0xC0 | device start working |
| VIS_START| 0xC0 | device start working |
| | 0xD0 | not used |
| | 0xE0 | not used |
| VIS_RST | 0xF0 | device reset |
@@ -184,9 +184,9 @@ extern ICall_Semaphore semaphore;
// VIS operator
#define VIS_ASK 0x30
#define VIS_INT 0x60
#define VIS_FUH 0x90
#define VIS_STI 0x90
#define VIS_CAL 0xA0
#define VIS_STI 0xC0
#define VIS_START 0xC0
#define VIS_RST 0xF0
// CIS operator
@@ -16,41 +16,41 @@ struct _StiCaliStiTable{
#ifdef BOARD_TEST
{
.p_ch.coefficient = 1,
.p_ch.coefficient = 10000,
.p_ch.offset = 0,
.n_ch.coefficient = 1,
.n_ch.coefficient = 10000,
.n_ch.offset = 0
};
#elif defined(BOARD_00_81_F9_E4_8C_D0)
{
.p_ch.coefficient = 0.2199,
.p_ch.offset = -0.4615,
.n_ch.coefficient = 0.2162,
.n_ch.offset = -1.6395
.p_ch.coefficient = 2199,
.p_ch.offset = -4615,
.n_ch.coefficient = 2162,
.n_ch.offset = -16395
};
#elif defined(BOARD_18_04_ED_37_C6_BE)
{
.p_ch.coefficient = 0.2270,
.p_ch.offset = -0.7039,
.n_ch.coefficient = 0.2259,
.n_ch.offset = -1.412
.p_ch.coefficient = 2270,
.p_ch.offset = -7039,
.n_ch.coefficient = 2259,
.n_ch.offset = -14128
};
#elif defined(BOARD_18_04_ED_37_C6_41)
{
.p_ch.coefficient = 0.2090,
.p_ch.offset = 0.4616,
.n_ch.coefficient = 0.1997,
.n_ch.offset = -4.0664
.p_ch.coefficient = 2090,
.p_ch.offset = 4616,
.n_ch.coefficient = 1997,
.n_ch.offset = -40664
};
#else
{
.p_ch.coefficient = 1,
.p_ch.coefficient = 10000,
.p_ch.offset = 0,
.n_ch.coefficient = 1,
.n_ch.coefficient = 10000,
.n_ch.offset = 0
};
@@ -200,7 +200,8 @@ static uint8_t SPICallBack = 0;
#define NEU_CHECK_STI_POL 10
#define NEU_CHECK_STI_MODE 11
#define NEU_CHECK_STI_CLK 12
#define NEU_CHECK_STI_AMP 13
#define NEU_CHECK_POS_AMP 13
#define NEU_CHECK_NEG_AMP 17
#define NEU_CHECK_STI_CH 14
#define NEU_START_STI 15
#define NEU_IDLE 16
@@ -780,7 +781,7 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
/**< stop spi transaction */
break; /**< reset all the parameter */
}
case VIS_STI: {
case VIS_START: {
for(int i=0 ; i<12 ; i++){
FlushNotify();
}
@@ -798,6 +799,11 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
flag_notify(EVT_NEU_SPI);
break; /**< start to operate */
}
case VIS_STI:{
}
case VIS_INT: {
// headstage_spi_transaction_cancel(headstage_spi_handle);
SPICallBack = ONE_SHOT_SPI;
@@ -1133,7 +1139,8 @@ static uint8_t build_neu_ins_config(uint8_t config_type, uint32_t* value) {
#define REC_SAMPLE_RATE 0x33
#define REC_CHECK_GENERAL_EN 0x2F
#define STI_POLARITY_REG 0x28
#define STI_AMP_REG 0x25
#define STI_AMP_POS_REG 0x25
#define STI_AMP_NEG_REG 0x26
#define STI_CHANNEL_REG 0x2E
#define STI_MODE_REG 0x38
#define STI_CLK_REG 0x34
@@ -1199,16 +1206,20 @@ static void headstage_neu_state_spi() {
}
case NEU_CHECK_STI_CLK:{
check_register(STI_CLK_REG, 2, NEU_CHECK_STI_AMP);
check_register(STI_CLK_REG, 2, NEU_CHECK_POS_AMP);
break;
}
case NEU_CHECK_STI_AMP:{
case NEU_CHECK_POS_AMP:{
check_register(STI_AMP_POS_REG, INSTRUCTION.sti_amplitude_h, NEU_CHECK_NEG_AMP);
break;
}
case NEU_CHECK_NEG_AMP:{
if(INSTRUCTION.recording_channel){
check_register(STI_AMP_REG, INSTRUCTION.sti_amplitude_h, NEU_CHECK_REC_CH);
check_register(STI_AMP_POS_REG, INSTRUCTION.sti_amplitude_l, NEU_CHECK_REC_CH);
}
else{
check_register(STI_AMP_REG, INSTRUCTION.sti_amplitude_h, NEU_START_STI);
check_register(STI_AMP_POS_REG, INSTRUCTION.sti_amplitude_l, NEU_START_STI);
}
break;
}
@@ -6,7 +6,7 @@
static uint16_t UserCode2StiCode(uint16_t amp, uint8_t positive_ch){
// get real current value (uA)
uint16_t sti_code, real_amp = amp * 5;
uint32_t sti_code, real_amp = amp * 5;
// trans into sti code
if(positive_ch){
@@ -16,7 +16,8 @@ static uint16_t UserCode2StiCode(uint16_t amp, uint8_t positive_ch){
sti_code = StiCaliTable.n_ch.coefficient * real_amp + StiCaliTable.n_ch.offset;
}
return sti_code;
sti_code = sti_code / 10000;
return (uint16_t) (sti_code);
}
#endif
@@ -5,12 +5,12 @@
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 4
#define VERSION_DATE_DAY 27
#define VERSION_DATE_HOUR 12
#define VERSION_DATE_MINUTE 20
#define VERSION_DATE_HOUR 13
#define VERSION_DATE_MINUTE 21
// this is NOT the version hash !!
// it's the last version hash
#define VERSION_HASH d9b611a72aa8d4a20853c5fb15df92c556e9819e
#define VERSION_HASH e4f9ba5ba364ce32cc778377a7c2a1bc227c0ecf
#define VERSION_GIT_BRANCH Neulive2.0_developement
#endif