Compare commits

...

3 Commits

Author SHA1 Message Date
hchen3 9f30e22a63 In headstage_uni_umc_data_append_notify_buffer
Modify channel pointer counter
Remove preamble cond. in the IF condition for enable_channel_number == 1
Reset channel_pointer in the VIS instruction
2020-02-20 16:58:39 +08:00
hchen3 f4dbf99294 fix channel pointer 2020-02-15 16:31:14 +08:00
hchen3 7db559a6e7 add HCI 2020-02-15 14:13:52 +08:00
29 changed files with 32 additions and 7 deletions
@@ -0,0 +1,4 @@
#safe table
#Thu Feb 20 11:57:56 CST 2020
framework.info=0
.crc1d527c35.v1
@@ -0,0 +1,4 @@
#safe table
#Thu Feb 20 11:57:56 CST 2020
framework.info=1
.crc1c901602.v1
@@ -0,0 +1,3 @@
int main(void) {
return 0;
}
@@ -0,0 +1,3 @@
int main(void) {
return 0;
}
View File
@@ -773,11 +773,13 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
case VIS_RST:
headstage_reset();
headstage_state = UMC_STATE_HANDSHAKE;
INSTRUCTION.channel_pointer=0;
// try to pull PIN_RESET PIN to ground
break;
case VIS_STI:
if (headstage_state == UMC_STATE_INTERRUPT) {
if (headstage_state == UMC_STATE_INTERRUPT) { //This if cond. seems only for old version digital core
headstage_state = UMC_STATE_INITIAL;
INSTRUCTION.channel_pointer=0;
rearrange_channel_mux_table();
UMC_STATE.config_type = CONFIG_AMP_MUX;
headstage_led_spi_color(COLOR_BLACK);
@@ -785,6 +787,7 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
headstage_spi_ask_transaction(4);
} else {
headstage_state = UMC_STATE_HANDSHAKE;
INSTRUCTION.channel_pointer=0;
rearrange_channel_mux_table();
headstage_pwm_start(headstage_system_pwm_handle);
headstage_pwm_start(headstage_poly_r_pwm_handle);
@@ -800,6 +803,7 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
case VIS_INT:
headstage_reset();
headstage_state = UMC_STATE_HANDSHAKE;
INSTRUCTION.channel_pointer=0;
break;
case VIS_BLE_T:
@@ -890,13 +894,15 @@ static void headstage_uni_umc_data_append_notify_buffer(uint8_t* dat_buf) {
}
uint8_t channel;
uint8_t channel_pointer = INSTRUCTION.channel_pointer;
if ((INSTRUCTION.enable_channel_number == 1) || (dat_buf[0] == 0xc1)) {
if ((INSTRUCTION.enable_channel_number == 1)) {
channel = reverse_channel[INSTRUCTION.last_enable_channel];
} else {
uint8_t channel_pointer = (INSTRUCTION.channel_pointer + 1) % INSTRUCTION.last_enable_channel;
//uint8_t channel_pointer = (INSTRUCTION.channel_pointer + 1) % INSTRUCTION.last_enable_channel;
channel = reverse_channel[INSTRUCTION.channel_mux[channel_pointer]];
INSTRUCTION.channel_pointer = channel_pointer;
channel_pointer++;
INSTRUCTION.channel_pointer = channel_pointer % (INSTRUCTION.last_enable_channel+1);
}
uint8_t data_size = headstage_notify_append_data(channel, dat_buf);
if (data_size >= BLE_NOT_BUFF_SIZE) {
@@ -920,6 +926,7 @@ static uint8_t build_umn_ins_config(uint8_t config_type, uint32_t* value) {
if (channel_pointer < INSTRUCTION.enable_channel_number) {
return CONFIG_AMP_MUX;
} else {
INSTRUCTION.channel_pointer = 0;
return CONFIG_AMP_GAIN;
}
}
@@ -114,11 +114,11 @@
#ifndef FEATURE_OAD
// Minimum connection interval (units of 1.25ms, 80=100ms) if automatic
// parameter update request is enabled
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 6
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 80
// Maximum connection interval (units of 1.25ms, 800=1000ms) if automatic
// parameter update request is enabled
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 6
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 80
#else //! FEATURE_OAD
// Minimum connection interval (units of 1.25ms, 8=10ms) if automatic
// parameter update request is enabled
@@ -152,7 +152,7 @@
#define SBP_TASK_PRIORITY 1
#ifndef SBP_TASK_STACK_SIZE
#define SBP_TASK_STACK_SIZE 844
#define SBP_TASK_STACK_SIZE 1024
#endif
// Internal Events for RTOS application
@@ -408,6 +408,10 @@ static void SimpleBLEPeripheral_init(void) {
GATT_RegisterForMsgs(self);
headstage_led_spi_color(COLOR_GREEN);
HCI_LE_ReadMaxDataLenCmd();
HCI_LE_WriteSuggestedDefaultDataLenCmd(251, 2120); // this is used for data length extension
}