add build instruction

This commit is contained in:
YiChin2018
2019-09-06 22:09:15 +08:00
parent becdca9dc7
commit 92b6a3a4f2
@@ -126,8 +126,9 @@
#define NEU_REC_CHANNEL_COUNTS 16 /** recording channel counts */
/** state for CC2650 to control DBS */
#define NEU_WRITE_INSTRUCTION 0
#define NEU_READ_DATA 1
#define NEU_WRITE_INSTRUCTION 0
#define NEU_READ_DATA 1
#define NEU_SINGLE_INSTRUCTION 2
/** macros for build up DBS instruction */
#define NEU_LNA_BIAS_ONE 0x0210 /** vgrp(1_0000) left shift 5bits | vgrn(1_0000) */
@@ -335,6 +336,22 @@ static bool build_sti_cur_instruction(uint8_t sti_channel, uint32_t* value) {
}
}
/**
@fn headstage_neu_append_notify_data
*/
static void headstage_neu_append_notify_data() {
uint8_t not_buf[2];
not_buf[0] = (spi_rxbuf[0] << 4) | spi_rxbuf[1];
not_buf[1] = spi_rxbuf[2];
uint8_t data_size = headstage_notify_append_data(channel, not_buf);
if (data_size >= BLE_NOT_BUFF_SIZE) {
headstage_notify_send();
headstage_notify_flip_buffer();
}
}
/**
@fn build stimulation voltage
*/
@@ -646,7 +663,9 @@ static void headstage_neu_state_spi() {
break;
case NEU_READ_DATA:
headstage_spi_transaction(3);
headstage_neu_append_notify_data(spi_rxbuf);
break;
case NEU_SINGLE_INSTRUCTION:
default:
break;
}