Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d45420579a | |||
| 1ac4b0b640 | |||
| eb4b14af59 | |||
| 325f34b867 | |||
| 46cd82a2d6 | |||
| 15bcefc9d1 | |||
| 58dcd3f128 | |||
| 7aa40392d0 | |||
| 1d32330d27 | |||
| 7c783ef0bf | |||
| 6b59a997c2 | |||
| 774811d83b | |||
| 9b55ab972c | |||
| f6828c9ad1 | |||
| 5d00281bbe | |||
| e60ba49220 | |||
| 5f0c413e56 | |||
| 524e62bcc7 | |||
| 2d2946753b | |||
| 2c5ad43d22 | |||
| ee9b117da0 | |||
| 7e42d35d00 | |||
| c715aba1b8 | |||
| 29e0d7b4f5 | |||
| d91eaed4fb | |||
| 6983f193ce | |||
| 5640b54ae9 | |||
| 9948179728 | |||
| 874a2cb05a | |||
| 777709171f | |||
| 885caace80 | |||
| 40cb4d7a1e | |||
| 680b0a0599 | |||
| c60469f5b4 | |||
| 6bc775b694 | |||
| 547877b30d | |||
| 0af1434882 | |||
| b1477d96f5 | |||
| 119d8e385c | |||
| 23adda2e53 | |||
| c3cdf4c8ad | |||
| 20a9324c58 | |||
| f5808d6731 | |||
| a16a487bf2 | |||
| 2704879aa4 | |||
| 693b2e457d |
@@ -79,7 +79,7 @@ const PIN_Config BoardGpioInitTable[] = {
|
||||
Board_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
Board_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
|
||||
Board_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
|
||||
Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
|
||||
Board_UART_RX | PIN_INPUT_EN | PIN_PULLUP, /* UART RX via debugger back channel */
|
||||
Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
|
||||
Board_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
|
||||
Board_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
|
||||
|
||||
@@ -80,8 +80,8 @@ extern const PIN_Config BoardGpioInitTable[];
|
||||
#define Board_BTN2 IOID_14
|
||||
|
||||
/* UART Board */
|
||||
#define Board_UART_RX IOID_2 /* RXD */
|
||||
#define Board_UART_TX IOID_3 /* TXD */
|
||||
#define Board_UART_RX IOID_25 /* RXD */
|
||||
#define Board_UART_TX IOID_26 /* TXD */
|
||||
#define Board_UART_CTS IOID_19 /* CTS */
|
||||
#define Board_UART_RTS IOID_18 /* RTS */
|
||||
|
||||
|
||||
+9
-2
@@ -193,6 +193,11 @@ extern ICall_Semaphore semaphore;
|
||||
#define INS_TYPE_VIS 0xC0
|
||||
#define INS_TYPE_CIS 0x70
|
||||
|
||||
// RIS operator
|
||||
#define RIS_SEND_UART 0x01
|
||||
#define RIS_PREPARE_SEND 0x02
|
||||
|
||||
|
||||
// VIS operator
|
||||
#define VIS_ASK 0x30
|
||||
#define VIS_INT 0x60
|
||||
@@ -384,8 +389,6 @@ static void headstage_update_instruction(uint8_t *instruction) {
|
||||
uint8_t ins_oper = instruction[1] & 0xF0;
|
||||
uint8_t ins_len = instruction[1] & 0x0F;
|
||||
|
||||
|
||||
|
||||
switch (ins_type) {
|
||||
case INS_TYPE_RIS: {
|
||||
headstage_update_ris_instruction(ins_len, instruction + 2);
|
||||
@@ -406,6 +409,10 @@ static void headstage_update_instruction(uint8_t *instruction) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -97,9 +97,9 @@ static void headstage_@REPLACE@_event() {
|
||||
==== function implement ====
|
||||
==========================*/
|
||||
|
||||
static void headstage_init() {
|
||||
// TODO
|
||||
}
|
||||
//static void headstage_init() {
|
||||
// // TODO
|
||||
//}
|
||||
|
||||
static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t *instruction) {
|
||||
// TODO
|
||||
|
||||
+18
-1002
File diff suppressed because it is too large
Load Diff
+18
-18
@@ -199,24 +199,24 @@ static void headstage_sti_event() {
|
||||
==== function implement ====
|
||||
==========================*/
|
||||
|
||||
static void headstage_init() {
|
||||
headstage_pin_open();
|
||||
|
||||
// init global stable value
|
||||
Types_FreqHz cpu_freq;
|
||||
BIOS_getCpuFreq(&cpu_freq);
|
||||
cpu_frequency = cpu_freq.lo;
|
||||
|
||||
headstage_gptimer_open();
|
||||
|
||||
headstage_pwm_open();
|
||||
|
||||
headstage_pin_output(PIN_POL0, 0);
|
||||
headstage_pin_output(PIN_POL1, 0);
|
||||
headstage_pin_output(PIN_PON0, 0);
|
||||
headstage_pin_output(PIN_PON1, 0);
|
||||
headstage_pin_output(PIN_TPS, 1);
|
||||
}
|
||||
//static void headstage_init() {
|
||||
// headstage_pin_open();
|
||||
//
|
||||
// // init global stable value
|
||||
// Types_FreqHz cpu_freq;
|
||||
// BIOS_getCpuFreq(&cpu_freq);
|
||||
// cpu_frequency = cpu_freq.lo;
|
||||
//
|
||||
// headstage_gptimer_open();
|
||||
//
|
||||
// headstage_pwm_open();
|
||||
//
|
||||
// headstage_pin_output(PIN_POL0, 0);
|
||||
// headstage_pin_output(PIN_POL1, 0);
|
||||
// headstage_pin_output(PIN_PON0, 0);
|
||||
// headstage_pin_output(PIN_PON1, 0);
|
||||
// headstage_pin_output(PIN_TPS, 1);
|
||||
//}
|
||||
|
||||
static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t *instruction) {
|
||||
uint8_t ins_oper = instruction[0] & 0xE0;
|
||||
|
||||
+6
-6
@@ -36,12 +36,12 @@
|
||||
|
||||
static void headstage_test_periodic();
|
||||
|
||||
static void headstage_init() {
|
||||
headstage_pin_open();
|
||||
headstage_spi_open();
|
||||
headstage_gptimer_open();
|
||||
headstage_gptimer_set_frequency(1000);
|
||||
}
|
||||
//static void headstage_init() {
|
||||
// headstage_pin_open();
|
||||
// headstage_spi_open();
|
||||
// headstage_gptimer_open();
|
||||
// headstage_gptimer_set_frequency(1000);
|
||||
//}
|
||||
|
||||
static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instruction) {
|
||||
}
|
||||
|
||||
+8
-8
@@ -196,14 +196,14 @@ static void headstage_tni_event() {
|
||||
==== function implement ====
|
||||
==========================*/
|
||||
|
||||
static void headstage_init() {
|
||||
headstage_pin_open();
|
||||
headstage_spi_open();
|
||||
headstage_gptimer_open();
|
||||
|
||||
headstage_pin_output(PIN_S2P_RST, 0);
|
||||
headstage_pin_output(PIN_P2S_RST, 0);
|
||||
}
|
||||
//static void headstage_init() {
|
||||
// headstage_pin_open();
|
||||
// headstage_spi_open();
|
||||
// headstage_gptimer_open();
|
||||
//
|
||||
// headstage_pin_output(PIN_S2P_RST, 0);
|
||||
// headstage_pin_output(PIN_P2S_RST, 0);
|
||||
//}
|
||||
|
||||
static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t *instruction) {
|
||||
uint8_t header = instruction[0] & 0xE0;
|
||||
|
||||
+10
-10
@@ -693,16 +693,16 @@ static void headstage_reset() {
|
||||
/*=========================================
|
||||
==== initialize parameter and device. ====
|
||||
========================================*/
|
||||
static void headstage_init() {
|
||||
headstage_pin_open();
|
||||
headstage_spi_open();
|
||||
headstage_pwm_open();
|
||||
headstage_led_spi_color(COLOR_GREEN);
|
||||
headstage_pin_output(PIN_RESET, 1); // initialize DBS chip
|
||||
headstage_pin_output(PIN_STI_SEL, 1); // chip select is ok
|
||||
headstage_pin_output(PIN_VGRP, 1);
|
||||
headstage_pin_output(PIN_FASTSET, 0);
|
||||
}
|
||||
//static void headstage_init() {
|
||||
// headstage_pin_open();
|
||||
// headstage_spi_open();
|
||||
// headstage_pwm_open();
|
||||
// headstage_led_spi_color(COLOR_GREEN);
|
||||
// headstage_pin_output(PIN_RESET, 1); // initialize DBS chip
|
||||
// headstage_pin_output(PIN_STI_SEL, 1); // chip select is ok
|
||||
// headstage_pin_output(PIN_VGRP, 1);
|
||||
// headstage_pin_output(PIN_FASTSET, 0);
|
||||
//}
|
||||
|
||||
static void headstage_update_ris_instruction(uint8_t ins_len, uint8_t* instruction) {
|
||||
switch ((instruction[0] & 0xE0)) {
|
||||
|
||||
+4
-4
@@ -4,14 +4,14 @@
|
||||
|
||||
#define VERSION_DATE_YEAR 20
|
||||
#define VERSION_DATE_MONTH 5
|
||||
#define VERSION_DATE_DAY 6
|
||||
#define VERSION_DATE_DAY 20
|
||||
#define VERSION_DATE_HOUR 17
|
||||
#define VERSION_DATE_MINUTE 17
|
||||
#define VERSION_DATE_MINUTE 27
|
||||
|
||||
// this is NOT the version hash !!
|
||||
// it's the last version hash
|
||||
#define VERSION_HASH fcc89f3e1cbef6348808c6a076ee86909b02eeda
|
||||
#define VERSION_GIT_BRANCH Neulive2.0_developement
|
||||
#define VERSION_HASH eb4b14af59afe8af309a843a93f87cacc8c68072
|
||||
#define VERSION_GIT_BRANCH central_pseudo_controller
|
||||
|
||||
static void get_board_name(char *board_name_ch, uint8 *board_name_int, uint8 name_size){
|
||||
uint8 name_offset = 18;
|
||||
|
||||
+17
-17
@@ -221,23 +221,23 @@ static void headstage_dac_send(uint8_t command, uint8_t p1, uint8_t p2) {
|
||||
==== function implement ====
|
||||
==========================*/
|
||||
|
||||
static void headstage_init() {
|
||||
headstage_pin_open();
|
||||
headstage_led_open();
|
||||
headstage_spi_open();
|
||||
|
||||
PIN_registerIntCb(headstage_pins_handle, &headstage_zm_pin_callback);
|
||||
PIN_setInterrupt(headstage_pins_handle, PIN_SWITCH_ON | PIN_IRQ_NEGEDGE);
|
||||
|
||||
headstage_pin_output(PIN_SHUTDOWN_6994, 1);
|
||||
headstage_pin_output(PIN_ENABLE_V05, 1);
|
||||
headstage_pin_output(PIN_ENABLE_V10, 1);
|
||||
|
||||
headstage_pin_output(PIN_ADC_CS, 1);
|
||||
headstage_pin_output(PIN_DAC_CS, 1);
|
||||
|
||||
INSTRUCTION.mode = MODE_POWER_ON;
|
||||
}
|
||||
//static void headstage_init() {
|
||||
// headstage_pin_open();
|
||||
// headstage_led_open();
|
||||
// headstage_spi_open();
|
||||
//
|
||||
// PIN_registerIntCb(headstage_pins_handle, &headstage_zm_pin_callback);
|
||||
// PIN_setInterrupt(headstage_pins_handle, PIN_SWITCH_ON | PIN_IRQ_NEGEDGE);
|
||||
//
|
||||
// headstage_pin_output(PIN_SHUTDOWN_6994, 1);
|
||||
// headstage_pin_output(PIN_ENABLE_V05, 1);
|
||||
// headstage_pin_output(PIN_ENABLE_V10, 1);
|
||||
//
|
||||
// headstage_pin_output(PIN_ADC_CS, 1);
|
||||
// headstage_pin_output(PIN_DAC_CS, 1);
|
||||
//
|
||||
// INSTRUCTION.mode = MODE_POWER_ON;
|
||||
//}
|
||||
|
||||
static void headstage_zm_turn(uint8_t on_off) {
|
||||
if (on_off) {
|
||||
|
||||
+21
-20
@@ -6,19 +6,10 @@
|
||||
#if defined(CC2650_LAUNCHXL)
|
||||
|
||||
// clang-format off
|
||||
#define PIN_RESET IOID_0 // SPI1 to receive LSK
|
||||
#define PIN_EN_ADC_SPI_CLK IOID_1 // SPI1 clock
|
||||
#define PIN_DC_DC IOID_2 // STI select need
|
||||
#define PIN_BATT_HALF IOID_3 //
|
||||
#define PIN_AMP_VCK IOID_4 //
|
||||
#define PIN_LED_SDI IOID_7 //
|
||||
#define PIN_LED_CLK IOID_8 //
|
||||
#define PIN_STI_CLK IOID_9 //
|
||||
#define PIN_SPI_MISO IOID_10 //
|
||||
#define PIN_SPI_MOSI IOID_11 //
|
||||
#define PIN_SPI_CS IOID_12 //
|
||||
#define PIN_SPI_CLK IOID_13 //
|
||||
#define PIN_SYS_CLK IOID_14 //
|
||||
#define Board_RLED IOID_6
|
||||
#define Board_GLED IOID_7
|
||||
#define Board_WAKE_CENTRAL IOID_8
|
||||
|
||||
// clang-format on
|
||||
|
||||
#elif defined(BOOSTXL_CC2650MA)
|
||||
@@ -73,13 +64,23 @@
|
||||
#define Board_PWMPIN6 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN7 PIN_UNASSIGNED
|
||||
|
||||
static PIN_Config headstage_pin_configuration[] = { //
|
||||
PIN_RESET | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_EN_ADC_SPI_CLK | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_DC_DC | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_BATT_HALF | PIN_INPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_STI_CLK | PIN_INPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
static PIN_Config pesudo_pi_pin_configuration[] = { //
|
||||
Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
Board_WAKE_CENTRAL | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
//
|
||||
PIN_TERMINATE};
|
||||
PIN_TERMINATE
|
||||
};
|
||||
|
||||
|
||||
static PIN_State pesudo_pi_pins_state;
|
||||
static PIN_Handle pesudo_pi_pins_handle;
|
||||
|
||||
#define headstage_pin_open() \
|
||||
do { \
|
||||
pesudo_pi_pins_handle = PIN_open(&pesudo_pi_pins_state, pesudo_pi_pin_configuration); \
|
||||
} while (0)
|
||||
|
||||
#define headstage_pin_output(pin, value) PIN_setOutputValue(pesudo_pi_pins_handle, PIN_ID(pin), (value))
|
||||
|
||||
#endif // HEADSTAGE_PIN_UNI_H
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
|
||||
#ifndef PESUDO_PI_UART_H
|
||||
#define PESUDO_PI_UART_H
|
||||
|
||||
/*
|
||||
* http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/
|
||||
* 2_20_00_06/exports/tirtos_full_2_20_00_06/products/tidrivers_cc13xx_cc26xx_2_20_00_08/
|
||||
* docs/doxygen/html/_u_a_r_t_c_c26_x_x_8h.html
|
||||
*/
|
||||
|
||||
#include <ti/drivers/UART.h>
|
||||
#include <ti/drivers/uart/UARTCC26XX.h>
|
||||
|
||||
#include <ti/sysbios/knl/Clock.h>
|
||||
#include "../neu/headstage_pin.h"
|
||||
|
||||
// Clock object used to timeout connection
|
||||
static Clock_Struct SendUARTClock;
|
||||
|
||||
// Scan duration in ms
|
||||
#define SEND_UART_DURATION 1000
|
||||
|
||||
#define UART_TX_BUF_SIZE 10
|
||||
#define UART_RX_BUF_SIZE 10
|
||||
|
||||
static UART_Handle handle;
|
||||
static UART_Params params;
|
||||
|
||||
static uint8_t UART_txBuf[UART_TX_BUF_SIZE];
|
||||
static uint8_t UART_rxBuf[UART_RX_BUF_SIZE];
|
||||
|
||||
static void _send_uart(UArg arg0);
|
||||
|
||||
static void pesudo_pi_uart_init(){
|
||||
|
||||
uint32_t timeoutUs = 5000; // 5ms timeout, default timeout is no timeout (BIOS_WAIT_FOREVER)
|
||||
|
||||
// Init UART and specify non-default parameters
|
||||
UART_Params_init(¶ms);
|
||||
params.baudRate = 9600;
|
||||
params.writeDataMode = UART_DATA_BINARY;
|
||||
// params.readTimeout = timeoutUs / Clock_tickPeriod; // Default tick period is 10us
|
||||
params.readTimeout = ti_sysbios_BIOS_WAIT_FOREVER;
|
||||
|
||||
// Open the UART and do the read
|
||||
handle = UART_open(Board_UART, ¶ms);
|
||||
// int rxBytes = UART_read(handle, rxBuf, 100);
|
||||
|
||||
Util_constructClock(&SendUARTClock, _send_uart,
|
||||
SEND_UART_DURATION, 0, false, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
static void send_uart(uint8_t *txbuf, uint8_t size) {
|
||||
headstage_pin_output(Board_WAKE_CENTRAL, Board_LED_ON);
|
||||
headstage_pin_output(Board_RLED, Board_LED_ON);
|
||||
for(int i=0 ; i<size && i<UART_TX_BUF_SIZE ; i++){
|
||||
UART_txBuf[i] = txbuf[i];
|
||||
}
|
||||
|
||||
// Util_startClock(&SendUARTClock);
|
||||
CPUdelay(16000000);
|
||||
|
||||
UART_write(handle, UART_txBuf, UART_TX_BUF_SIZE);
|
||||
headstage_pin_output(Board_RLED, Board_LED_OFF);
|
||||
headstage_pin_output(Board_WAKE_CENTRAL, Board_LED_OFF);
|
||||
}
|
||||
|
||||
static void _send_uart(UArg arg0){
|
||||
UART_write(handle, UART_txBuf, UART_TX_BUF_SIZE);
|
||||
headstage_pin_output(Board_RLED, Board_LED_OFF);
|
||||
headstage_pin_output(Board_WAKE_CENTRAL, Board_LED_OFF);
|
||||
}
|
||||
|
||||
#endif
|
||||
+3
-8
@@ -608,9 +608,9 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
}
|
||||
}
|
||||
|
||||
if (EVENT_MASK > 0) {
|
||||
headstage_event_handle();
|
||||
}
|
||||
// if (EVENT_MASK > 0) {
|
||||
// headstage_event_handle();
|
||||
// }
|
||||
|
||||
// if (events & SBP_PERIODIC_EVT) {
|
||||
// events &= ~SBP_PERIODIC_EVT;
|
||||
@@ -853,7 +853,6 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
|
||||
if (SUCCESS == HCI_LE_SetDataLenCmd(cxnHandle, requestedPDUSize, requestTxTime)) {
|
||||
ConnectState = true;
|
||||
headstage_led_color(COLOR_CYAN);
|
||||
}
|
||||
// Use numActive to determine the connection handle of the last
|
||||
// connection
|
||||
@@ -870,10 +869,8 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
|
||||
ConnectState = false;
|
||||
if(ErrorRestart){
|
||||
headstage_led_color(COLOR_RED);
|
||||
}
|
||||
else{
|
||||
headstage_led_color(COLOR_GREEN);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -884,10 +881,8 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
|
||||
ErrorRestart = true;
|
||||
CONNECT_HANDLE = 0xFFFF;
|
||||
flag_notify(EVT_DISCONNECTED);
|
||||
headstage_led_color(COLOR_RED);
|
||||
break;
|
||||
case GAPROLE_ERROR: // Error occurred - invalid state
|
||||
headstage_led_color(COLOR_RED);
|
||||
break;
|
||||
case GAPROLE_INIT: // Waiting to be started
|
||||
case GAPROLE_ADVERTISING: // Currently Advertising
|
||||
|
||||
Reference in New Issue
Block a user