Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 49bca54

Browse files
author
Mahendra Tailor
committed
Updated the LowPowerVspUartBridge application
v1.40 (17 Aug 2018) - Bug Fix: When sending very long strings, only a portion is sent then it stops and then the next blocks only came after sending some characters to trigger the next block. Fixed by adding the event EVVSPTXEMEPTY to keep the pump primed. - Enhancement : When the uart is closed, the state of the RTS line is specified via the UART_RTS_STATE_ON_CLOSE in the custom file and that is now set for 1 so that when uart is closed the peer's CTS will deassert and so it will know it cannot send any data
1 parent 9744009 commit 49bca54

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

Applications/LowPowerVspUartBridge/$autorun$.low.power.vsp.uart.bridge.sb

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,18 @@
123123
// Version History
124124
//******************************************************************************
125125
//
126-
#define APP_VERSION "v1.30"
126+
#define APP_VERSION "v1.40"
127+
//
128+
//v1.40 (17 Aug 2018)
129+
// - Bug Fix: When sending very long strings, only a portion is sent then it
130+
// stops and then the next blocks only came after sending some
131+
// characters to trigger the next block. Fixed by adding the event
132+
// EVVSPTXEMEPTY to keep the pump primed.
133+
// - Enhancement :
134+
// When the uart is closed, the state of the RTS line is specified
135+
// via the UART_RTS_STATE_ON_CLOSE in the custom file and that
136+
// is now set for 1 so that when uart is closed the peer's CTS
137+
// will deassert and so it will know it cannot send any data
127138
//
128139
//v1.30 (3 Jan 2018)
129140
// - Bug Fix: Using UART_CTS to re-open uart now works (After closing uart_cts
@@ -287,7 +298,7 @@ function UartCloseConditional()
287298
//closed, so configure the TX and RTS as outputs and adjust outputs
288299
rc=gpiosetfunc(UART_SIONUM_TX,2,1) //TX - set high on default
289300
#cmpif 0x00000003 : AssertRC(rc, 3620)
290-
rc=gpiosetfunc(UART_SIONUM_RTS,2,0) //RTS - set low to leave it assertd
301+
rc=gpiosetfunc(UART_SIONUM_RTS,2,UART_RTS_STATE_ON_CLOSE) //Adjust RTS state on closure
291302
#cmpif 0x00000003 : AssertRC(rc, 3640)
292303
rc=GpioSetFunc(UART_SIONUM_RX,1,2) //RX - Pull high input & irq on hi2lo transition
293304
#cmpif 0x00000003 : AssertRC(rc, 3660)
@@ -548,6 +559,28 @@ function HndlrVspRx()
548559
TimerStart(STATE_TIMER,idleTimeoutMs,0)
549560
endfunc 1
550561

562+
//------------------------------------------------------------------------------
563+
// Vsp tx empty
564+
//------------------------------------------------------------------------------
565+
function HndlrVspTxEmpty()
566+
select curState
567+
case STATE_CONN_UART_CLOSE
568+
UartReOpen()
569+
NewState(STATE_CONN_UART_OPEN)
570+
//Pass data between UART and VSP service
571+
BleVspUartBridge()
572+
573+
case STATE_CONN_UART_OPEN
574+
//Pass data between UART and VSP service
575+
BleVspUartBridge()
576+
577+
case else
578+
endselect
579+
580+
//Start the uart inactivity timer
581+
TimerStart(STATE_TIMER,idleTimeoutMs,0)
582+
endfunc 1
583+
551584
//------------------------------------------------------------------------------
552585
//BLE message has arrived
553586
//------------------------------------------------------------------------------
@@ -647,6 +680,7 @@ OnEvent EVUARTRX Call HndlrUartRx
647680
OnEvent EVUARTTXEMPTY Call HndlrUartTxEmpty
648681
onevent EVDETECTCHAN0 call HndlrDetectPinRx
649682
onEvent EVVSPRX call HndlrVspRx
683+
onEvent EVVSPTXEMPTY call HndlrVspTxEmpty
650684

651685
//------------------------------------------------------------------------------
652686
// startup

Applications/LowPowerVspUartBridge/custom.low.power.vsp.uart.bridge.sb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
// So comment and uncomment the appropriate 2 lines above
163163
//=========================================================================
164164

165-
165+
#define UART_RTS_STATE_ON_CLOSE 1 //0=ASSERTED, 1=DEASSERTED
166166

167167
//******************************************************************************
168168
// Debugging related (conditionally compile based on "#set $cmpif" line above)

0 commit comments

Comments
 (0)