From 2d1c75fe42eba543352d58505e60fa2f6f59d1be Mon Sep 17 00:00:00 2001 From: Benny Liu Date: Fri, 31 Jan 2020 14:48:43 +0800 Subject: [PATCH] don't care --- .../simple_peripheral/ccs/app/.cproject | 110 +++++++++--------- .../simple_peripheral_cc2650em_app.launch | 5 +- .../simple_peripheral/ccs/stack/.ccsproject | 2 +- .../simple_peripheral/ccs/stack/.cproject | 90 +++++++------- .../ccs/stack/targetConfigs/CC2650F128.ccxml | 29 +++-- .../cc26xx/app/headstage/EliteADC.h | 8 +- .../cc26xx/app/simple_peripheral.c | 24 +++- 7 files changed, 143 insertions(+), 125 deletions(-) diff --git a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.cproject b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.cproject index 167712872..c4225e716 100755 --- a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.cproject +++ b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.cproject @@ -18,8 +18,8 @@ - - diff --git a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.launches/simple_peripheral_cc2650em_app.launch b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.launches/simple_peripheral_cc2650em_app.launch index 3112caf05..02510b16e 100755 --- a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.launches/simple_peripheral_cc2650em_app.launch +++ b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/app/.launches/simple_peripheral_cc2650em_app.launch @@ -1,11 +1,14 @@ + + + @@ -20,5 +23,5 @@ - + diff --git a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.ccsproject b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.ccsproject index 604334c0e..2d741946d 100755 --- a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.ccsproject +++ b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.ccsproject @@ -9,6 +9,6 @@ - + diff --git a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.cproject b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.cproject index 12fa8e14f..366072bf7 100755 --- a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.cproject +++ b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.cproject @@ -15,8 +15,8 @@ - - diff --git a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/targetConfigs/CC2650F128.ccxml b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/targetConfigs/CC2650F128.ccxml index 2d53fca62..5bd6d5a52 100755 --- a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/targetConfigs/CC2650F128.ccxml +++ b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/targetConfigs/CC2650F128.ccxml @@ -1,20 +1,19 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteADC.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteADC.h index 176031b9f..9856acd62 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteADC.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteADC.h @@ -170,14 +170,14 @@ static void ReadBatVolt(uint8_t *buf){ CPUdelay(10); ADC_read(buf); - uint16_t bat_volt; - + uint16_t bat_volt = 0; bat_volt = (uint16_t) (buf[0] << 8) | (uint16_t) (buf[1]); - CPUdelay(10); + // Battery voltage < 3V, turn off Elite. - if(bat_volt < 8200 && bat_volt > 200){ + if(bat_volt < 8700 && bat_volt > 200){ PIN_setOutputValue(pin_handle, enable_5v, 0); } + } // theoretical boundary <20, 10~500, >100 (uA) 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 fb1892c30..3681e796c 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 @@ -557,6 +557,8 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) { uint16_t counter6994 = 0; bool EliteOn = 0; + uint16_t counter_bat = 0; + // init DAC, set output ~= 0 V DAC_outputV(Usercode_Correction_to_DAC(25000)); elite_gptimer_start(); @@ -646,15 +648,29 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) { InitPeriodicEvent = false; } + if(counter_bat < CLOCK_ONE_SECOND*5){ + counter_bat++; + } else if (counter_bat == CLOCK_ONE_SECOND*5){ + +// static uint8_t bat_buf[SPI_ADC_SIZE] = {0}; +// for(int i=0; i<=SPI_ADC_SIZE; i++){ +// bat_buf[i] = spi_ADC_rxbuf[i]; +// } + // Turn off Elite if battery voltage < 3V + ReadBatVolt(spi_ADC_rxbuf); + + counter_bat = 0; +// for(int i=0; i<=SPI_ADC_SIZE; i++){ +// spi_ADC_rxbuf[i] = 0; +// spi_ADC_txbuf[i] = 0; +// } + } + // Perform periodic application task SimpleBLEPeripheral_performPeriodicTask(WorkModeData); - // Turn off Elite if battery voltage < 3V - ReadBatVolt(spi_ADC_rxbuf); - key = PIN_getInputValue(switch_on); EliteKeyPress(key); // onPress=> key = 0; 1.lighten LED 2.long press shut down 2650 - } }