Compare commits

...

2 Commits

Author SHA1 Message Date
hchen3 09f640a461 No_Preamble_check 2020-04-08 14:36:20 +08:00
hchen3 bd5db061cf LED_cha_chb 2020-04-08 13:57:33 +08:00
@@ -702,6 +702,7 @@ static void headstage_init() {
}
static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instruction) {
uint8_t fled;
switch ((instruction[0] & 0xE0)) {
case RIS_DIR: {
uint8_t amp_lbf = (instruction[0] & 0b00000111);
@@ -740,10 +741,43 @@ static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instructi
INSTRUCTION.sti_times = sti_times;
INSTRUCTION.sti_freq = sti_freq;
INSTRUCTION.mode = mode;
if (instruction[3] & 0b10000000) INSTRUCTION.channel_table[amp_channel_table[cha] - 1] = TRUE;
if (instruction[3] & 0b01000000) INSTRUCTION.channel_table[amp_channel_table[chb] - 1] = TRUE;
if (instruction[3] & 0b00100000) INSTRUCTION.channel_table[amp_channel_table[chc] - 1] = TRUE;
if (instruction[3] & 0b00010000) INSTRUCTION.channel_table[amp_channel_table[chd] - 1] = TRUE;
if (instruction[3] & 0b10000000) {
INSTRUCTION.channel_table[amp_channel_table[cha] - 1] = TRUE;
for (fled=0; fled < amp_channel_table[cha]; fled++)
{
headstage_led_spi_color(COLOR_RED);
CPUdelay(16000*500); //100ms
headstage_led_spi_color(COLOR_GREEN);
}
}
if (instruction[3] & 0b01000000) {
INSTRUCTION.channel_table[amp_channel_table[chb] - 1] = TRUE;
for (fled=0; fled < amp_channel_table[chb]; fled++)
{
headstage_led_spi_color(COLOR_BLUE);
CPUdelay(16000*500); //100ms
headstage_led_spi_color(COLOR_GREEN);
}
}
if (instruction[3] & 0b00100000) {
INSTRUCTION.channel_table[amp_channel_table[chc] - 1] = TRUE;
for (fled=0; fled < amp_channel_table[chc]; fled++)
{
headstage_led_spi_color(COLOR_RED);
CPUdelay(16000*500); //100ms
headstage_led_spi_color(COLOR_GREEN);
}
}
if (instruction[3] & 0b00010000) {
INSTRUCTION.channel_table[amp_channel_table[chd] - 1] = TRUE;
for (fled=0; fled < amp_channel_table[chd]; fled++)
{
headstage_led_spi_color(COLOR_BLUE);
CPUdelay(16000*500); //100ms
headstage_led_spi_color(COLOR_GREEN);
}
}
break;
}
@@ -912,11 +946,11 @@ static void headstage_uni_umc_data_append_notify_buffer(uint8_t* dat_buf) {
channel = reverse_channel[INSTRUCTION.channel_mux[channel_pointer]];
break;
case 2:
if ((dat_buf[0] & 0xC1) == 0xC1) {
channel = reverse_channel[INSTRUCTION.last_enable_channel];
}
//if ((dat_buf[0] & 0xC1) == 0xC1) {
// channel = reverse_channel[INSTRUCTION.last_enable_channel];
// }
//else if (dat_buf[0] == 0 && pramb == 0) {}
else{
//else{
if(channel_pointer==0 && INSTRUCTION.channel_mux[channel_pointer]==INSTRUCTION.last_enable_channel)
{channel_pointer++;}
@@ -927,7 +961,7 @@ static void headstage_uni_umc_data_append_notify_buffer(uint8_t* dat_buf) {
{channel = reverse_channel[INSTRUCTION.channel_mux[channel_pointer + 1]];}
else
{channel = reverse_channel[INSTRUCTION.channel_mux[channel_pointer]];}
}
// }
channel_pointer++;
INSTRUCTION.channel_pointer = channel_pointer % (INSTRUCTION.last_enable_channel+1);
break;
@@ -951,15 +985,15 @@ static void headstage_uni_umc_data_append_notify_buffer(uint8_t* dat_buf) {
pramb=0;
}
if ((dat_buf[0] & 0xC1) == 0xC1) {
channel = reverse_channel[INSTRUCTION.last_enable_channel];
}
else{
//if ((dat_buf[0] & 0xC1) == 0xC1) {
// channel = reverse_channel[INSTRUCTION.last_enable_channel];
//}
//else{
if(channel_pointer==0 && INSTRUCTION.channel_mux[channel_pointer]==INSTRUCTION.last_enable_channel)
{channel_pointer++;}
channel = reverse_channel[INSTRUCTION.channel_mux[channel_pointer]];
}
//}
//else {
// channel = reverse_channel[13];
// //headstage_led_spi_color(COLOR_RED);