Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 657b1b2b0e | |||
| aa410bec37 | |||
| 3ac4620c7d | |||
| 5283d905b7 | |||
| f1b30c3ba7 | |||
| 37d16a41b7 | |||
| 4d5704d99e | |||
| 95f667e3b0 | |||
| 1d33c05ca3 | |||
| 5b4e14ec73 | |||
| fb5cbe212e | |||
| f675ff0b66 | |||
| 83ad8302c1 |
@@ -36,10 +36,10 @@ NEULIVE_PARAMETER = {
|
||||
'SB': 2, # STIMULATION BEHAVIOR
|
||||
'TF': 1, # STIMULATION FREQUENCY
|
||||
'CA': 1, # AMP CHANNEL A ENABLE
|
||||
'CB': 0, # AMP CHANNEL B ENABLE
|
||||
'CC': 0, # AMP CHANNEL C ENABLE
|
||||
'CD': 0, # AMP CHANNEL D ENABLE
|
||||
'CHA': 0, # AMP CHANNEL A
|
||||
'CB': 1, # AMP CHANNEL B ENABLE
|
||||
'CC': 1, # AMP CHANNEL C ENABLE
|
||||
'CD': 1, # AMP CHANNEL D ENABLE
|
||||
'CHA': 9, # AMP CHANNEL A
|
||||
'CHB': 1, # AMP CHANNEL B
|
||||
'CHC': 2, # AMP CHANNEL C
|
||||
'CHD': 3, # AMP CHANNEL D
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.45713043" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="BOARD_DISPLAY_EXCLUDE_UART"/>
|
||||
<listOptionValue builtIn="false" value="HEADSTAGE_UNI_2_0"/>
|
||||
<listOptionValue builtIn="false" value="HEADSTAGE_NOTIFY_USE_ATT"/>
|
||||
<listOptionValue builtIn="false" value="POWER_SAVING"/>
|
||||
<listOptionValue builtIn="false" value="BOOSTXL_CC2650MA"/>
|
||||
<listOptionValue builtIn="false" value="HEADSTAGE_MA_USE_SPI2"/>
|
||||
|
||||
+1
-1
@@ -62,9 +62,9 @@
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.986125825" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="CC26XX"/>
|
||||
<listOptionValue builtIn="false" value="POWER_SAVING"/>
|
||||
<listOptionValue builtIn="false" value="GATT_NO_CLIENT"/>
|
||||
<listOptionValue builtIn="false" value="HEADSTAGE_NOTIFY_USE_ATT"/>
|
||||
<listOptionValue builtIn="false" value="POWER_SAVING"/>
|
||||
<listOptionValue builtIn="false" value="CC26XXWARE"/>
|
||||
<listOptionValue builtIn="false" value="DATA="/>
|
||||
<listOptionValue builtIn="false" value="EXT_HAL_ASSERT"/>
|
||||
|
||||
+1
-2
@@ -316,8 +316,7 @@ typedef struct {
|
||||
==== device implement implement header ====
|
||||
=========================================*/
|
||||
|
||||
#include "headstage_neu.h"
|
||||
|
||||
#include "headstage_uni.h"
|
||||
/*======================
|
||||
==== main function ====
|
||||
======================*/
|
||||
|
||||
+6
-22
@@ -236,7 +236,7 @@
|
||||
/** target SYSTEM clock frequency is 1Mhz */
|
||||
#define UMC_SYS_CLK 1000000
|
||||
/** poly-R switching clock frequency */
|
||||
#define UMC_POLY_R_CLK 1000
|
||||
#define UMC_POLY_R_CLK 100
|
||||
|
||||
|
||||
/// Neulive instruction macro
|
||||
@@ -440,7 +440,7 @@ struct HEADSTAGE_PARAMETER_TABLE {
|
||||
/** MODE */
|
||||
uint8_t mode;
|
||||
|
||||
uint8_t channel_table[REC_CHANNEL_COUNT];
|
||||
bool channel_table[REC_CHANNEL_COUNT];
|
||||
uint8_t channel_mux[REC_CHANNEL_COUNT];
|
||||
uint8_t last_enable_channel;
|
||||
uint8_t enable_channel_number;
|
||||
@@ -520,7 +520,6 @@ static void rearrange_channel_mux_table() {
|
||||
|
||||
INSTRUCTION.last_enable_channel = last_enable_channel;
|
||||
INSTRUCTION.enable_channel_number = enable_channel_number;
|
||||
|
||||
if (enable_channel_number == 0) {
|
||||
// no channel enable
|
||||
memset(INSTRUCTION.channel_mux, 0, REC_CHANNEL_COUNT);
|
||||
@@ -541,11 +540,12 @@ static void rearrange_channel_mux_table() {
|
||||
while (channel_mux_index >= 0) {
|
||||
int8_t i = next_enable_channel - 1;
|
||||
|
||||
for (; i >= 0; i--) {
|
||||
while (i >= 0) {
|
||||
if (INSTRUCTION.channel_table[i]) {
|
||||
next_enable_channel = i;
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
|
||||
if (i < 0) {
|
||||
@@ -765,7 +765,6 @@ static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instructi
|
||||
INSTRUCTION.sti_channel_nmos = 0; // sti nch = ch2 means sti turn off
|
||||
INSTRUCTION.sti_channel_pmos = 1; // sti pch = ch1 means sti turn off
|
||||
INSTRUCTION.amp_low_band_freq = 0; // the maximum
|
||||
|
||||
// this for-loop is used for setting the amplifier channel
|
||||
// for (unsigned int i = 0; i < REC_CHANNEL_COUNT; i++) {
|
||||
// INSTRUCTION.channel_table[i] = (4 <= i && i <= 8);
|
||||
@@ -928,10 +927,10 @@ static void headstage_uni_umc_data_append_notify_buffer(uint8_t* dat_buf) {
|
||||
channel = reverse_channel[INSTRUCTION.last_enable_channel];
|
||||
} else {
|
||||
uint8_t channel_pointer = (INSTRUCTION.channel_pointer + 1) % INSTRUCTION.last_enable_channel;
|
||||
INSTRUCTION.channel_pointer = channel_pointer;
|
||||
channel = reverse_channel[INSTRUCTION.channel_mux[channel_pointer]];
|
||||
INSTRUCTION.channel_pointer = channel_pointer;
|
||||
}
|
||||
// uint8_t data_size = headstage_notify_append_data(channel, spi_rxbuf);
|
||||
uint8_t data_size = headstage_notify_append_data(channel, spi_rxbuf);
|
||||
if (data_size >= BLE_NOT_BUFF_SIZE) {
|
||||
headstage_notify_send();
|
||||
headstage_notify_flip_buffer();
|
||||
@@ -944,14 +943,12 @@ static void headstage_uni_umc_data_append_notify_buffer(uint8_t* dat_buf) {
|
||||
/*=====================
|
||||
==== instruction ====
|
||||
=====================*/
|
||||
|
||||
static uint8_t build_umn_ins_config(uint8_t config_type, uint32_t* value) {
|
||||
switch (config_type) {
|
||||
case CONFIG_AMP_MUX: {
|
||||
uint8_t channel_pointer = INSTRUCTION.channel_pointer + 1;
|
||||
*value = build_configure_instruction(CONFIG_AMP_MUX, INSTRUCTION.channel_mux[INSTRUCTION.channel_pointer] + 1);
|
||||
INSTRUCTION.channel_pointer = channel_pointer;
|
||||
|
||||
if (channel_pointer < INSTRUCTION.enable_channel_number) {
|
||||
return CONFIG_AMP_MUX;
|
||||
} else {
|
||||
@@ -1072,8 +1069,6 @@ static void headstage_umc_state_transfer_ask() {
|
||||
*
|
||||
*/
|
||||
static void headstage_umc_state_transfer_lsk() {
|
||||
headstage_debug_buffer[0] = headstage_state;
|
||||
headstage_set_debug_information();
|
||||
switch (headstage_state) {
|
||||
case UMC_STATE_IDLE:
|
||||
headstage_state = UMC_STATE_HANDSHAKE;
|
||||
@@ -1095,14 +1090,10 @@ static void headstage_umc_state_transfer_lsk() {
|
||||
if (umc_pass_check()) {
|
||||
tx_put_u32(0, build_configure_instruction(UMC_CALIB_DONE, UMC_MODE_LSK_OUT));
|
||||
|
||||
headstage_cpu_delay_ms(1);
|
||||
|
||||
headstage_state = UMC_STATE_INITIAL;
|
||||
|
||||
headstage_spi_ask_transaction(4);
|
||||
} else {
|
||||
headstage_cpu_delay_ms(1);
|
||||
|
||||
headstage_spi_ask_transaction(4);
|
||||
}
|
||||
break;
|
||||
@@ -1111,11 +1102,8 @@ static void headstage_umc_state_transfer_lsk() {
|
||||
if (umc_pass_check()) {
|
||||
headstage_state = UMC_STATE_CONFIGURE;
|
||||
|
||||
headstage_cpu_delay_ms(1);
|
||||
|
||||
headstage_spi_ask_transaction(4);
|
||||
} else {
|
||||
headstage_cpu_delay_ms(1);
|
||||
|
||||
headstage_spi_ask_transaction(4);
|
||||
}
|
||||
@@ -1139,13 +1127,9 @@ static void headstage_umc_state_transfer_lsk() {
|
||||
headstage_state = UMC_STATE_CONFIGURE;
|
||||
}
|
||||
|
||||
headstage_cpu_delay_ms(1);
|
||||
|
||||
headstage_spi_ask_transaction(4);
|
||||
}
|
||||
} else {
|
||||
headstage_cpu_delay_ms(1);
|
||||
|
||||
headstage_spi_ask_transaction(4);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@
|
||||
#define Board_SPI0_MISO PIN_UNASSIGNED
|
||||
#define Board_SPI0_MOSI PIN_LSK_MOSI
|
||||
#define Board_SPI0_CLK PIN_LSK_CLK
|
||||
#define Board_SPI0_CS PIN_LSK_CS
|
||||
#define Board_SPI0_CSN PIN_LSK_CS
|
||||
|
||||
/*
|
||||
* SPI1 interface work with LED
|
||||
@@ -57,7 +57,7 @@
|
||||
#define Board_SPI1_MISO PIN_UNASSIGNED
|
||||
#define Board_SPI1_MOSI PIN_ASK_MOSI
|
||||
#define Board_SPI1_CLK PIN_UNASSIGNED
|
||||
#define Board_SPI1_CS PIN_ASK_CS
|
||||
#define Board_SPI1_CSN PIN_ASK_CS
|
||||
|
||||
/* Power Management Board */
|
||||
#define Board_SRDY Board_BP_Pin_J2_19
|
||||
|
||||
+29
-36
@@ -12,53 +12,53 @@
|
||||
"REC_CHANNEL_COUNT": 12,
|
||||
"STI_CHANNEL_COUNT": 4,
|
||||
"ADC_SAMPLE_RATE_LIST": [
|
||||
2000,
|
||||
1000,
|
||||
1900,
|
||||
3800,
|
||||
7600,
|
||||
15200,
|
||||
30400
|
||||
15200
|
||||
],
|
||||
"STI_FREQ_LIST": [
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
22,
|
||||
24,
|
||||
26,
|
||||
28,
|
||||
30,
|
||||
32,
|
||||
34,
|
||||
36,
|
||||
38,
|
||||
40,
|
||||
100,
|
||||
200,
|
||||
300,
|
||||
400,
|
||||
500,
|
||||
600,
|
||||
700,
|
||||
800,
|
||||
1000,
|
||||
1200,
|
||||
1400,
|
||||
1600,
|
||||
1800,
|
||||
2000
|
||||
900,
|
||||
1000
|
||||
],
|
||||
"STI_PULSE_WIDTH": [
|
||||
80,
|
||||
180,
|
||||
280,
|
||||
380,
|
||||
480,
|
||||
580,
|
||||
680,
|
||||
780,
|
||||
880,
|
||||
980
|
||||
400,
|
||||
900,
|
||||
1400,
|
||||
1900,
|
||||
2400,
|
||||
2900,
|
||||
3400,
|
||||
3900,
|
||||
4400,
|
||||
4900
|
||||
]
|
||||
},
|
||||
"parameters": {
|
||||
@@ -84,9 +84,6 @@
|
||||
"description": "amp gain",
|
||||
"record_meta": true,
|
||||
"value": [
|
||||
3,
|
||||
14,
|
||||
27,
|
||||
60,
|
||||
280,
|
||||
540
|
||||
@@ -187,10 +184,6 @@
|
||||
},
|
||||
"instruction": {
|
||||
"start": [
|
||||
{
|
||||
"expression": "len(CHANNEL) > 0",
|
||||
"raise": "no recording channel"
|
||||
},
|
||||
"data_format",
|
||||
"_notify(True)",
|
||||
"start_recording",
|
||||
|
||||
-3
@@ -55,9 +55,6 @@ static uint16_t amp_gain_table[] = {
|
||||
0b100011, // 3
|
||||
0b101100, // 14
|
||||
0b101001, // 27
|
||||
0b000011, // 60
|
||||
0b001100, // 280
|
||||
0b001001, // 540
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+10
-16
@@ -115,11 +115,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
|
||||
@@ -153,7 +153,7 @@
|
||||
#define SBP_TASK_PRIORITY 1
|
||||
|
||||
#ifndef SBP_TASK_STACK_SIZE
|
||||
#define SBP_TASK_STACK_SIZE 1024
|
||||
#define SBP_TASK_STACK_SIZE 844
|
||||
#endif
|
||||
|
||||
// Internal Events for RTOS application
|
||||
@@ -221,7 +221,6 @@ static void SimpleBLEPeripheral_sendAttRsp(void);
|
||||
static void SimpleBLEPeripheral_freeAttRsp(uint8_t status);
|
||||
static void SimpleBLEPeripheral_stateChangeCB(gaprole_States_t newState);
|
||||
static void SimpleBLEPeripheral_enqueueMsg(uint8_t event, uint8_t state);
|
||||
static void headstage_data_length_extension();
|
||||
|
||||
#ifndef FEATURE_OAD_ONCHIP
|
||||
static void SimpleBLEPeripheral_charValueChangeCB(uint8_t paramID);
|
||||
@@ -409,11 +408,7 @@ static void SimpleBLEPeripheral_init(void) {
|
||||
GATT_RegisterForMsgs(self);
|
||||
|
||||
HCI_LE_ReadMaxDataLenCmd();
|
||||
|
||||
HCI_LE_WriteSuggestedDefaultDataLenCmd(251, 2120); // this is used for data length extension
|
||||
|
||||
uint8_t prepare_write_req = 6;
|
||||
GATTServApp_SetParameter(GATT_PARAM_NUM_PREPARE_WRITES, 1, &prepare_write_req);
|
||||
}
|
||||
|
||||
#ifndef DEVICE_NAME
|
||||
@@ -556,6 +551,9 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
// ICall_signal() function is called onto the semaphore.
|
||||
ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER);
|
||||
// headstage_watchdog_clear();
|
||||
if (EVENT_MASK > 0) {
|
||||
headstage_event_handle();
|
||||
}
|
||||
if (errno == ICALL_ERRNO_SUCCESS) {
|
||||
ICall_EntityID dest;
|
||||
ICall_ServiceEnum src;
|
||||
@@ -596,9 +594,6 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (EVENT_MASK > 0) {
|
||||
headstage_event_handle();
|
||||
}
|
||||
|
||||
#ifdef FEATURE_OAD
|
||||
while (!Queue_empty(oad_queue_handle)) {
|
||||
@@ -825,14 +820,13 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
uint8_t numActive = 0;
|
||||
numActive = linkDB_NumActive();
|
||||
|
||||
headstage_led_color(COLOR_CYAN);
|
||||
|
||||
uint16_t cxnHandle;
|
||||
uint16_t requestedPDUSize = 251;
|
||||
uint16_t requestTxTime = 2120;
|
||||
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &cxnHandle);
|
||||
|
||||
if (SUCCESS != HCI_LE_SetDataLenCmd(cxnHandle, requestedPDUSize, requestTxTime)) {
|
||||
if (SUCCESS == HCI_LE_SetDataLenCmd(cxnHandle, requestedPDUSize, requestTxTime)) {
|
||||
headstage_led_spi_color(COLOR_CYAN);
|
||||
}
|
||||
// Use numActive to determine the connection handle of the last
|
||||
// connection
|
||||
@@ -854,12 +848,12 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
// Device just timed out from a connection but is not yet advertising, is in waiting period before advertising again
|
||||
// disconnected
|
||||
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
|
||||
headstage_led_color(COLOR_RED);
|
||||
headstage_led_spi_color(COLOR_RED); /** for neulive1.3 call headstage_led_spi_color ; for neulive2.0 call headstage_led_color */
|
||||
CONNECT_HANDLE = 0xFFFF;
|
||||
flag_notify(EVT_DISCONNECTED);
|
||||
break;
|
||||
case GAPROLE_ERROR: // Error occurred - invalid state
|
||||
headstage_led_color(COLOR_RED);
|
||||
headstage_led_spi_color(COLOR_RED);
|
||||
break;
|
||||
case GAPROLE_INIT: // Waiting to be started
|
||||
case GAPROLE_ADVERTISING: // Currently Advertising
|
||||
|
||||
Reference in New Issue
Block a user