From ef6cf83620a5d28a69cc3589a2e20105cfcd620f Mon Sep 17 00:00:00 2001 From: Roy Date: Tue, 12 Apr 2022 17:45:37 +0800 Subject: [PATCH] edit BOOSTXL_CC2650_ELITE_EIS_1_1.c ok --- .../BOOSTXL_CC2650MA_ELITE_EIS_1_1.c | 97 +++--- .../BOOSTXL_CC2650MA_ELITE_EIS_1_1.h | 48 ++- .../cc26xx/app/headstage/AD5940.h | 4 +- .../cc26xx/app/headstage/EliteKeyDetect.h | 8 +- .../cc26xx/app/headstage/EliteReset.h | 4 +- .../cc26xx/app/headstage/EliteSPI.h | 26 +- .../cc26xx/app/headstage/Elite_PIN.h | 108 +------ .../cc26xx/app/headstage/Elite_batt.h | 2 +- .../cc26xx/app/headstage/headstage_tni.h | 305 ------------------ .../cc26xx/app/headstage/impedance_meter.h | 6 +- .../cc26xx/app/simple_peripheral.c | 30 +- 11 files changed, 139 insertions(+), 499 deletions(-) delete mode 100644 simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_tni.h diff --git a/simplelink/ble_sdk_2_02_02_25/src/boards/BOOSTXL_CC2650MA_ELITE_EIS_1_1/BOOSTXL_CC2650MA_ELITE_EIS_1_1.c b/simplelink/ble_sdk_2_02_02_25/src/boards/BOOSTXL_CC2650MA_ELITE_EIS_1_1/BOOSTXL_CC2650MA_ELITE_EIS_1_1.c index eb90540..40d0922 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/boards/BOOSTXL_CC2650MA_ELITE_EIS_1_1/BOOSTXL_CC2650MA_ELITE_EIS_1_1.c +++ b/simplelink/ble_sdk_2_02_02_25/src/boards/BOOSTXL_CC2650MA_ELITE_EIS_1_1/BOOSTXL_CC2650MA_ELITE_EIS_1_1.c @@ -78,8 +78,17 @@ const PIN_Config BoardGpioInitTable[] = { Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX */ Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX */ - Board_SRDY | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* SRDY */ - Board_MRDY | PIN_INPUT_EN | PIN_PULLDOWN, /* MRDY */ + Board_SRDY | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* SRDY */ + Board_MRDY | PIN_INPUT_EN | PIN_PULLDOWN, /* MRDY */ + PIN_TERMINATE +}; + +/* EIS pin config */ +const PIN_Config EIS_1_1_BoardGpioInitTable[] = { + Board_5V_enable | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Board_5V_enable -> DIO9 */ + Board_AD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Board_AD_CS -> DIO10 */ + Board_AD_RST | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Board_AD_RST -> DIO13 */ + Board_SHUT_DOWN | PIN_INPUT_EN | PIN_PULLDOWN, /* Board_SHUT_DOWN -> DIO14 */ PIN_TERMINATE }; @@ -198,44 +207,58 @@ const UDMACC26XX_Config UDMACC26XX_config[] = { #pragma DATA_SECTION(spiCC26XXDMAHWAttrs, ".const:spiCC26XXDMAHWAttrs") #endif - /* Include drivers */ - #include +/* Include drivers */ +#include - /* SPI objects */ - SPICC26XXDMA_Object spiCC26XXDMAObjects[BOOSTXL_CC2650MA_SPICOUNT]; +/* SPI objects */ +SPICC26XXDMA_Object spiCC26XXDMAObjects[BOOSTXL_CC2650MA_SPICOUNT]; - /* SPI configuration structure, describing which pins are to be used */ - const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[BOOSTXL_CC2650MA_UDMACOUNT] = { - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0, - .rxChannelBitMask = 1< 20){ -// PIN_setOutputValue(pin_handle, enable_5v, 0); +// PIN_setOutputValue(pin_handle, Board_5V_enable, 0); // return false; // }else{ - PIN_setOutputValue(pin_handle, enable_5v, 1); // enable 5V + PIN_setOutputValue(pin_handle, Board_5V_enable, 1); // enable 5V Elite_SPI_init(); // TurnOn10V(); ModeLED(BT_WAIT); @@ -28,7 +28,7 @@ static bool TurnOnElite(uint8_t key) { } } else { TurnOnCounter = 0; - PIN_setOutputValue(pin_handle, enable_5v, 0); // disable 5V + PIN_setOutputValue(pin_handle, Board_5V_enable, 0); // disable 5V return false; } } @@ -48,7 +48,7 @@ static void EliteKeyPress(uint8_t key) { // press 3~4 sec, shutdown 2650 else if (ShutDownCounter > (CLOCK_ONE_SECOND*3) ) { LED_color(DARKLED, 0xFF, 0xFF, 0x00); - PIN_setOutputValue(pin_handle, enable_5v, 0); // disable 5V + PIN_setOutputValue(pin_handle, Board_5V_enable, 0); // disable 5V } ShutDownCounter ++; } else { diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteReset.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteReset.h index 8cf5ef6..299e646 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteReset.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteReset.h @@ -39,7 +39,7 @@ static void reset() { spi_ADC_rxbuf[i] = 0; } - PIN_setOutputValue(pin_handle, AD_CS, 1); // AD_CS HIGH + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); // AD_CS HIGH ModeLED(NO_EVENT); CPUdelay(1600); } @@ -77,7 +77,7 @@ static void Eliteinterrupt() { spi_ADC_rxbuf[i] = 0; } - PIN_setOutputValue(pin_handle, AD_CS, 1); // AD_CS HIGH + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); // AD_CS HIGH ModeLED(NO_EVENT); CPUdelay(8000); } diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteSPI.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteSPI.h index 9e730ac..dce585c 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteSPI.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteSPI.h @@ -68,7 +68,7 @@ static void LED_SPI(uint8_t length, uint16_t *spi_txbuf, uint16_t *spi_rxbuf) { } static void ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) { - PIN_setOutputValue(pin_handle, AD_CS, 0); // CS_ADC + PIN_setOutputValue(pin_handle, Board_AD_CS, 0); // CS_ADC ADC_DAC_transaction.count = length; ADC_DAC_transaction.txBuf = spi_txbuf; @@ -76,7 +76,7 @@ static void ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) { SPI_transfer(spiHandle1, &ADC_DAC_transaction); - PIN_setOutputValue(pin_handle, AD_CS, 1); // CS_ADC + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); // CS_ADC } static void DAC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) { @@ -116,7 +116,7 @@ static void CAL_ADC_SPI(uint8_t length, uint8_t *spi_txbuf, uint8_t *spi_rxbuf) SPI_transfer(spiHandle1, &ADC_DAC_transaction); - PIN_setOutputValue(pin_handle, AD_CS, 1); // CS_ADC + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); // CS_ADC } static void CAL_LED_SPI(uint8_t length, uint16_t *spi_txbuf, uint16_t *spi_rxbuf) { @@ -174,7 +174,7 @@ static void CAL_LED_SPI(uint8_t length, uint16_t *spi_txbuf, uint16_t *spi_rxbuf #define DFTIMAG 0x207C static void select_REG(uint16_t addr){ - PIN_setOutputValue(pin_handle, AD_CS, 0); + PIN_setOutputValue(pin_handle, Board_AD_CS, 0); // CPUdelay(16000); spi_DACtxbuf[0] = SPICMD_SETADDR; @@ -186,11 +186,11 @@ static void select_REG(uint16_t addr){ ADC_DAC_transaction.rxBuf = spi_rxbuf; SPI_transfer(spiHandle1, &ADC_DAC_transaction); // CPUdelay(16000); - PIN_setOutputValue(pin_handle, AD_CS, 1); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); } static void w16_REG(uint16_t data){ - PIN_setOutputValue(pin_handle, AD_CS, 0); + PIN_setOutputValue(pin_handle, Board_AD_CS, 0); spi_DACtxbuf[0] = SPICMD_WRITEREG; spi_DACtxbuf[1] = (uint8_t)((data & 0xFF00) >> 8); spi_DACtxbuf[2] = (uint8_t)(data & 0x00FF); @@ -200,13 +200,13 @@ static void w16_REG(uint16_t data){ ADC_DAC_transaction.rxBuf = spi_rxbuf; SPI_transfer(spiHandle1, &ADC_DAC_transaction); - PIN_setOutputValue(pin_handle, AD_CS, 1); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); } static int16_t r16_REG(){ int16_t ret; - PIN_setOutputValue(pin_handle, AD_CS, 0); + PIN_setOutputValue(pin_handle, Board_AD_CS, 0); spi_DACtxbuf[0] = SPICMD_READREG; spi_DACtxbuf[1] = 0x00; spi_DACtxbuf[2] = 0x00; @@ -220,13 +220,13 @@ static int16_t r16_REG(){ ret = (int16_t)spi_rxbuf[2] << 8 | \ (int16_t)spi_rxbuf[3]; - PIN_setOutputValue(pin_handle, AD_CS, 1); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); return ret; } static void w32_REG(uint32_t data){ - PIN_setOutputValue(pin_handle, AD_CS, 0); + PIN_setOutputValue(pin_handle, Board_AD_CS, 0); spi_DACtxbuf[0] = SPICMD_WRITEREG; spi_DACtxbuf[1] = (uint8_t)((data & 0xFF000000) >> 24); spi_DACtxbuf[2] = (uint8_t)((data & 0x00FF0000) >> 16); @@ -238,13 +238,13 @@ static void w32_REG(uint32_t data){ ADC_DAC_transaction.rxBuf = spi_rxbuf; SPI_transfer(spiHandle1, &ADC_DAC_transaction); - PIN_setOutputValue(pin_handle, AD_CS, 1); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); } static int32_t r32_REG(){ int32_t ret; - PIN_setOutputValue(pin_handle, AD_CS, 0); + PIN_setOutputValue(pin_handle, Board_AD_CS, 0); spi_DACtxbuf[0] = SPICMD_READREG; spi_DACtxbuf[1] = 0x00; spi_DACtxbuf[2] = 0x00; @@ -262,7 +262,7 @@ static int32_t r32_REG(){ (int32_t)spi_rxbuf[4] << 8 | \ (int32_t)spi_rxbuf[5]; - PIN_setOutputValue(pin_handle, AD_CS, 1); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); return ret; } diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_PIN.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_PIN.h index 09afac1..5c18e9a 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_PIN.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_PIN.h @@ -8,63 +8,18 @@ #define ELITE_PIN_EIS #ifdef ELITE_PIN_EIS -/* SPI Board */ -#define Board_SPI0_MISO PIN_UNASSIGNED -#define Board_SPI0_MOSI IOID_4 -#define Board_SPI0_CLK IOID_3 -#define Board_SPI0_CS PIN_UNASSIGNED -#define Board_SPI1_MISO IOID_1 -#define Board_SPI1_MOSI IOID_6 -#define Board_SPI1_CLK IOID_5 -#define Board_SPI1_CS PIN_UNASSIGNED -#define AD_CS IOID_10 - -#define switch_on IOID_14 -#define enable_5v IOID_9 -#define AD_reset IOID_13 -#define enable_10v PIN_UNASSIGNED -#define HIGH_Z_MODE PIN_UNASSIGNED -#define shutdown_6994 PIN_UNASSIGNED - -#define Turnon_I_LARGE PIN_UNASSIGNED -#define Turnon_I_MID PIN_UNASSIGNED -#define Turnon_I_SMALL PIN_UNASSIGNED - -#define Turnon_V_MID PIN_UNASSIGNED -#define Turnon_V_SMALL PIN_UNASSIGNED - -#define Turon_VOUT_SMALL PIN_UNASSIGNED PIN_Handle pin_handle; static PIN_State ZM_rst; -const PIN_Config BLE_IO[] = { - enable_5v | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,// 5V_enable - AD_reset | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, - switch_on | PIN_INPUT_EN | PIN_PULLDOWN, - AD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, - PIN_TERMINATE -}; - static void remove_elite_pin() { PIN_close(pin_handle); - pin_handle = PIN_open(&ZM_rst, BLE_IO); + pin_handle = PIN_open(&ZM_rst, EIS_1_1_BoardGpioInitTable); } #endif -#define Board_SPI1 BOOSTXL_CC2650MA_SPI1 -/*! - * @def BOOSTXL_CC2650MA_SPIName - * @brief Enum of SPI names on the CC2650 Booster Pack - */ -typedef enum BOOSTXL_CC2650MA_SPIName { - BOOSTXL_CC2650MA_SPI0 = 0, - BOOSTXL_CC2650MA_SPI1 = 1, - - BOOSTXL_CC2650MA_SPICOUNT -} BOOSTXL_CC2650MA_SPIName; @@ -103,70 +58,9 @@ typedef enum BOOSTXL_CC2650MA_SPIName { -/* - * ========================== SPI DMA begin =================================== - */ -/* Place into subsections to allow the TI linker to remove items properly */ -#if defined(__TI_COMPILER_VERSION__) -#pragma DATA_SECTION(SPI_config, ".const:SPI_config") -#pragma DATA_SECTION(spiCC26XXDMAHWAttrs, ".const:spiCC26XXDMAHWAttrs") -#endif -/* Include drivers */ -#include -/* SPI objects */ -SPICC26XXDMA_Object spiCC26XXDMAObjects[BOOSTXL_CC2650MA_SPICOUNT]; -/* SPI configuration structure, describing which pins are to be used */ -const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[BOOSTXL_CC2650MA_SPICOUNT] = { - { - .baseAddr = SSI0_BASE, - .intNum = INT_SSI0_COMB, - .intPriority = ~0, - .swiPriority = 0, - .powerMngrId = PowerCC26XX_PERIPH_SSI0, - .defaultTxBufValue = 0, - .rxChannelBitMask = 1< 20){ - PIN_setOutputValue(pin_handle, enable_5v, 0); + PIN_setOutputValue(pin_handle, Board_5V_enable, 0); } } diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_tni.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_tni.h deleted file mode 100644 index ab36e44..0000000 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_tni.h +++ /dev/null @@ -1,305 +0,0 @@ -// -//#ifndef HEADSTAGE_H -//#error "headstage.h not include" -//#endif -// -//#ifdef HEADSTAGE_H_H -//#error "headstage_*.h has be included" -//#endif -// -//#ifndef HEADSTAGE_TNI_H -//#define HEADSTAGE_H_H -//#define HEADSTAGE_TNI_H -// -//// product information -//#define DEVICE_NAME "Elite-v0.1" -//#define MAJOR_PRODUCT_NUMBER 0 -//#define MINOR_PRODUCT_NUMBER 1 -//#define MAJOR_VERSION_NUMBER 0 -//#define MINOR_VERSION_NUMBER 1 -// -//// header -//#include -//#include "board.h" -// -///*============ -// ==== SPI ==== -// ===========*/ -// -///* application use SPI parameters and buffers */ -// -//#define SPI_BUFFER_SIZE 16 -// -//static uint8_t spi_txbuf[SPI_BUFFER_SIZE] = {0}; -//static uint8_t spi_rxbuf[SPI_BUFFER_SIZE] = {0}; -// -///*============================= -// ==== headstage variable ==== -// ============================*/ -// -//PIN_Handle pin_handle; -//static PIN_State DBS_rst; -// -//// DBS reset pin -// -//const PIN_Config BLE_IO[] = { -// // -// IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, -// IOID_2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, -// IOID_3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, -// IOID_13 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, -// PIN_TERMINATE // -//}; -// -///** -// * ADC clock switch signal. -// */ -//static bool adc_clock_signal = FALSE; -// -///*======================================= -// ==== headstage function declaration ==== -// ======================================*/ -// -//static void headstage_tni_update_instruction_callback(uint8_t ins_type, uint8_t ins_op, uint8_t ins_len, uint8_t *ins); -// -///*============================= -// ==== ramp data generating ==== -// ============================*/ -// -//static uint16_t ramp_data_counter = 0; -// -//static void create_ramp(uint8_t *buff) { -// buff[0] = 0b10110000 | (0b00001111 & (uint8_t)(ramp_data_counter >> 6)); -// buff[1] = (uint8_t)(ramp_data_counter << 2); -// ramp_data_counter += 1; -//} -// -///*======================================= -// ==== headstage function implemented ==== -// ======================================*/ -// -///** -// * change channel value to little endian -// */ -//static uint8 encode_channel(uint8 channel) { -// return 0x0F & (((channel & 0b1000) >> 3) | // -// ((channel & 0b0100) >> 1) | // -// ((channel & 0b0010) << 1) | // -// ((channel & 0b0001) << 3)); -//} -// -//static void headstage_init() { -// set_update_instruction_callback(headstage_tni_update_instruction_callback); -// -// // initialize the DBS reset pin -// pin_handle = PIN_open(&DBS_rst, BLE_IO); -// PIN_setOutputValue(pin_handle, IOID_9, 1); -// PIN_setOutputValue(pin_handle, IOID_2, 0); -// PIN_setOutputValue(pin_handle, IOID_3, 0); -//} -// -///** -// * change the recording clock bit in the instruction buffer. -// */ -//static void update_ins_rec_clock(uint8_t *buf, bool adc_clock_signal) { -// buf[3] = (buf[3] & 0b11110000) | ((adc_clock_signal) ? 0b1000 : 0); -//} -// -///** -// * change the recording channel bit in the instruction buffer. -// */ -//static void update_ins_rec_channel(uint8_t *buf, uint8 channel) { -// buf[1] = (buf[1] & 0b00001111) | (encode_channel(channel) << 4); -//} -// -///** -// * change the stimulation enable bit in the instruction buffer. -// */ -//static void update_ins_sti_enable(uint8_t *buf, bool enable) { -// buf[1] = (buf[1] & 0b11111101) | ((enable) ? 0b10 : 0); -//} -// -///** -// * change the stimulating channel bit in the instruction buffer. -// */ -//static void update_ins_sti_channel(uint8_t *buf, uint8 sti_chp, uint8 sti_chn) { -// buf[2] = (buf[2] & 0b11110000) | encode_channel(sti_chp); -// buf[3] = (buf[3] & 0b00001111) | (encode_channel(sti_chn) << 4); -//} -// -//static void update_ins_buffer() { -// uint8 header = 0b10100000; -// uint8 amp_gain = (instru.amp_gain & 0b11) << 3; -// uint8 amp_lbf = instru.amp_low_band_freq & 0b111; -// uint8 channel = 0; // should be call update_ins_channel to modify this value -// uint8 chopper = (instru.chopper) ? 0b00001000 : 0; -// uint8 fast_settle = (instru.fast_settle) ? 0b00000100 : 0; -// uint8 sti_enable = (instru.work_mode != STI_MODE_DISABLE) ? 0b00000010 : 0; -// uint8 sti_volt_l = (instru.sti_volt & 0b11111) >> 4; -// uint8 sti_volt_h = (instru.sti_volt & 0b01111) << 4; -// uint8 sti_chp = instru.sti_channel_pmos & 0b1111; -// uint8 sti_chn = (instru.sti_channel_nmos & 0b1111) << 4; -// uint8 clk_signal = 0; // should be call update_ins_clock to modify this value -// -// spi_txbuf[0] = header | amp_gain | amp_lbf; -// spi_txbuf[1] = channel | chopper | fast_settle | sti_enable | sti_volt_l; -// spi_txbuf[2] = sti_volt_h | sti_chp; -// spi_txbuf[3] = sti_chn | clk_signal; -//} -// -//static bool update_ins_rec_buffer() { -// adc_clock_signal = (adc_clock_signal) ? FALSE : TRUE; // switch adc_clock -// update_ins_rec_clock(spi_txbuf, adc_clock_signal); -// -// if (adc_clock_signal) { -// // change to next channel -// -// if (next_active_channel()) { -// update_ins_rec_channel(spi_txbuf, channel_pointer); -// } else { -// // no channel active -// return false; -// } -// } -// -// return true; -//} -// -///** -// * Change the instruction content for SPI buffer, which is depended on the -// * work_mode. Expend the remind instruction according to the base instruction -// * which allocated at the beginning 4 bytes of the SPI buffer. -// * -// * ========= =========== -// * work_mode ins pattern -// * ========= =========== -// * POS, NEG 4 F D 0 -// * P2N, N2P 4 4' F D -// * AWF not impl -// * ========= =========== -// * -// * pattern *4* -// * stimulation instruction. -// * -// * pattern *F* -// * set pmos channel to 0xF, release the remain voltage in the capacitance. -// * -// * pattern *D* -// * disable stimulation -// * -// * pattern *0* -// * nop. -// * -// * @param: buf: pointer of the SPI buffer. -// */ -//static void update_ins_sti_buffer() { -// switch (instru.work_mode) { -// case STI_MODE_POS: -// case STI_MODE_NEG: -// // copy [4:7] -// spi_txbuf[4] = spi_txbuf[0]; -// spi_txbuf[5] = spi_txbuf[1]; -// spi_txbuf[6] = spi_txbuf[2]; -// spi_txbuf[7] = spi_txbuf[3]; -// // copy [8:B] -// spi_txbuf[8] = spi_txbuf[0]; -// spi_txbuf[9] = spi_txbuf[1]; -// spi_txbuf[10] = spi_txbuf[2]; -// spi_txbuf[11] = spi_txbuf[3]; -// // reset [C:F] -// spi_txbuf[12] = 0; -// spi_txbuf[13] = 0; -// spi_txbuf[14] = 0; -// spi_txbuf[15] = 0; -// // change content -// update_ins_sti_enable(spi_txbuf, TRUE); -// // ins buf [4:7] -// update_ins_sti_enable(spi_txbuf + 4, TRUE); -// update_ins_sti_channel(spi_txbuf + 4, 0xF, instru.sti_channel_pmos); -// // ins buf [8:B] -// update_ins_sti_enable(spi_txbuf + 8, FALSE); -// break; -// case STI_MODE_P2N: -// case STI_MODE_N2P: -// // copy [4:7] -// spi_txbuf[4] = spi_txbuf[0]; -// spi_txbuf[5] = spi_txbuf[1]; -// spi_txbuf[6] = spi_txbuf[2]; -// spi_txbuf[7] = spi_txbuf[3]; -// // copy [8:B] -// spi_txbuf[8] = spi_txbuf[0]; -// spi_txbuf[9] = spi_txbuf[1]; -// spi_txbuf[10] = spi_txbuf[2]; -// spi_txbuf[11] = spi_txbuf[3]; -// // copy [C:F] -// spi_txbuf[12] = spi_txbuf[0]; -// spi_txbuf[13] = spi_txbuf[1]; -// spi_txbuf[14] = spi_txbuf[2]; -// spi_txbuf[15] = spi_txbuf[3]; -// // change content -// update_ins_sti_enable(spi_txbuf + 0, TRUE); -// update_ins_sti_channel(spi_txbuf + 0, instru.sti_channel_pmos, instru.sti_channel_nmos); -// // ins buf [4:7] -// update_ins_sti_enable(spi_txbuf + 4, TRUE); -// update_ins_sti_channel(spi_txbuf + 4, instru.sti_channel_nmos, instru.sti_channel_pmos); -// // ins buf [8:B] -// update_ins_sti_enable(spi_txbuf + 8, TRUE); -// update_ins_sti_channel(spi_txbuf + 8, 0xF, instru.sti_channel_nmos); -// // ins buf [C:F] -// update_ins_sti_enable(spi_txbuf + 12, FALSE); -// break; -// case STI_MODE_AWF: -// // XXX define the voltage change -// break; -// default: -// // do nothing -// break; -// } -//} -// -//static void headstage_tni_update_instruction_callback(uint8_t ins_type, uint8_t ins_op, uint8_t ins_len, uint8_t *ins) { -// switch (ins_type) { -// case INS_TYPE_VIS: { -// // reset -// case VIS_RST: -// // reset. reset all variable -// adc_clock_signal = FALSE; -// memset(spi_txbuf, 0, SPI_BUFFER_SIZE); -// break; -// -// // interrupt -// case VIS_INT: -// // stop. reset channel table -// ramp_data_counter = 0; -// memset(spi_txbuf, 0, SPI_BUFFER_SIZE); -// break; -// } -// case INS_TYPE_RIS: -// default: -// break; -// } -//} -// -//static uint8_t *spi_transact_rec_instruction() { -// if (IS_REC_MODE(instru.work_mode)) { -// PIN_setOutputValue(pin_handle, IOID_13, 1); // DBS_P2S turn on -// headstage_spi_transaction(SPI_BUFFER_SIZE, spi_txbuf, spi_rxbuf); -// PIN_setOutputValue(pin_handle, IOID_13, 0); // DBS_P2S turn off -// -// } else if (IS_ARM_MODE(instru.work_mode) && !adc_clock_signal) { -// create_ramp(spi_rxbuf); -// } -// -// if (adc_clock_signal) { -// return NULL; -// } else { -// return spi_rxbuf; -// } -//} -// -//static uint8_t *spi_transact_sti_instruction() { -// headstage_spi_transaction(16, spi_txbuf, NULL); -// return NULL; -//} -// -//#endif diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h index 2b35ab0..075e61b 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h @@ -45,8 +45,8 @@ static void ZM_init() { set_update_instruction_callback(ZM_update_instruction_callback); // initialize - pin_handle = PIN_open(&ZM_rst, BLE_IO); - PIN_setOutputValue(pin_handle, AD_CS, 1); // AD_CS HIGH + pin_handle = PIN_open(&ZM_rst, EIS_1_1_BoardGpioInitTable); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); // AD_CS HIGH InitEliteInstruction(); @@ -56,7 +56,7 @@ static void ZM_init() { elite_gptimer_start(); // PIN_registerIntCb(pin_handle, switch_on_callback); - // PIN_setInterrupt(pin_handle, switch_on | PIN_IRQ_POSEDGE); + // PIN_setInterrupt(pin_handle, Board_SHUT_DOWN | PIN_IRQ_POSEDGE); } static void ZM_update_instruction_callback(uint8_t ins_type, uint8_t chip_ID, uint8_t *ins) {} diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/simple_peripheral.c b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/simple_peripheral.c index ba240fa..2f89261 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/simple_peripheral.c +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/simple_peripheral.c @@ -750,7 +750,7 @@ static void Elite_led_color(uint16_t color){ #define DFTIMAG 0x207C static void select_REG(uint16_t addr){ - PIN_setOutputValue(pin_handle, AD_CS, 0); + PIN_setOutputValue(pin_handle, Board_AD_CS, 0); // CPUdelay(16000); spi_DACtxbuf[0] = SPICMD_SETADDR; @@ -762,11 +762,11 @@ static void select_REG(uint16_t addr){ ADC_DAC_transaction.rxBuf = spi_rxbuf; SPI_transfer(spiHandle1, &ADC_DAC_transaction); // CPUdelay(16000); - PIN_setOutputValue(pin_handle, AD_CS, 1); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); } static void w16_REG(uint16_t data){ - PIN_setOutputValue(pin_handle, AD_CS, 0); + PIN_setOutputValue(pin_handle, Board_AD_CS, 0); spi_DACtxbuf[0] = SPICMD_WRITEREG; spi_DACtxbuf[1] = (uint8_t)((data & 0xFF00) >> 8); spi_DACtxbuf[2] = (uint8_t)(data & 0x00FF); @@ -776,13 +776,13 @@ static void w16_REG(uint16_t data){ ADC_DAC_transaction.rxBuf = spi_rxbuf; SPI_transfer(spiHandle1, &ADC_DAC_transaction); - PIN_setOutputValue(pin_handle, AD_CS, 1); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); } //static int16_t r16_REG(){ // int16_t ret; // -// PIN_setOutputValue(pin_handle, AD_CS, 0); +// PIN_setOutputValue(pin_handle, Board_AD_CS, 0); // spi_DACtxbuf[0] = SPICMD_READREG; // spi_DACtxbuf[1] = 0x00; // spi_DACtxbuf[2] = 0x00; @@ -796,13 +796,13 @@ static void w16_REG(uint16_t data){ // ret = (int16_t)spi_rxbuf[2] << 8 | \ // (int16_t)spi_rxbuf[3]; // -// PIN_setOutputValue(pin_handle, AD_CS, 1); +// PIN_setOutputValue(pin_handle, Board_AD_CS, 1); // // return ret; //} //static void w32_REG(uint32_t data){ -// PIN_setOutputValue(pin_handle, AD_CS, 0); +// PIN_setOutputValue(pin_handle, Board_AD_CS, 0); // spi_DACtxbuf[0] = SPICMD_WRITEREG; // spi_DACtxbuf[1] = (uint8_t)((data & 0xFF000000) >> 24); // spi_DACtxbuf[2] = (uint8_t)((data & 0x00FF0000) >> 16); @@ -814,13 +814,13 @@ static void w16_REG(uint16_t data){ // ADC_DAC_transaction.rxBuf = spi_rxbuf; // SPI_transfer(spiHandle1, &ADC_DAC_transaction); // -// PIN_setOutputValue(pin_handle, AD_CS, 1); +// PIN_setOutputValue(pin_handle, Board_AD_CS, 1); //} //static int32_t r32_REG(){ // int32_t ret; // -// PIN_setOutputValue(pin_handle, AD_CS, 0); +// PIN_setOutputValue(pin_handle, Board_AD_CS, 0); // spi_DACtxbuf[0] = SPICMD_READREG; // spi_DACtxbuf[1] = 0x00; // spi_DACtxbuf[2] = 0x00; @@ -838,7 +838,7 @@ static void w16_REG(uint16_t data){ // (int32_t)spi_rxbuf[4] << 8 | \ // (int32_t)spi_rxbuf[5]; // -// PIN_setOutputValue(pin_handle, AD_CS, 1); +// PIN_setOutputValue(pin_handle, Board_AD_CS, 1); // // return ret; //} @@ -979,9 +979,9 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) // ZM_init(); // initialize - pin_handle = PIN_open(&ZM_rst, BLE_IO); - PIN_setOutputValue(pin_handle, AD_CS, 1); // AD_CS HIGH - PIN_setOutputValue(pin_handle, enable_5v, 1); // enable 5V + pin_handle = PIN_open(&ZM_rst, EIS_1_1_BoardGpioInitTable); + PIN_setOutputValue(pin_handle, Board_AD_CS, 1); // AD_CS HIGH + PIN_setOutputValue(pin_handle, Board_5V_enable, 1); // enable 5V Elite_SPI_init(); Elite_led_color(COLOR_WHITE); AD5940_init(); @@ -993,7 +993,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) // elite_gptimer_start(); // PIN_registerIntCb(pin_handle, switch_on_callback); -// PIN_setInterrupt(pin_handle, switch_on | PIN_IRQ_POSEDGE); +// PIN_setInterrupt(pin_handle, Board_SHUT_DOWN | PIN_IRQ_POSEDGE); // Application main loops // GPT.GptimerCounter0 = GPT.GptimerCounter; @@ -1068,7 +1068,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) // if(events & SBP_PERIODIC_EVT){ // events &= ~SBP_PERIODIC_EVT; // if (!PeriodicEvent) { // if there is no periodic event -// key = PIN_getInputValue(switch_on); +// key = PIN_getInputValue(Board_SHUT_DOWN); // if (EliteOn) { // if (counter6994 < CLOCK_ONE_SECOND*5) { // counter6994 enable a IC after 35 counts // counter6994++;