There are some side-effects you should take into account:
Declare your variables that are changed in the handlers as "volatile"
There could fire an interrupt during execution of a handler. Depending on the given priority the behaving could be different. Better encapsulate with CyEnterCriticalSection() and CyExitCriticalSection():.
Do not forget to remove the interrupt cause before exiting a handler even if the interrupt is not wanted!
A Timer_WritePeriod() will not start the timer. The period should be fixed (Design or initialization).
A different approach would be to use a count of the incoming characters. At timer TC look for != 0 and reset count.
Why not use the tx_en output of the UART block as the input to a counter/capture component?
We are talking about receiving bytes, not about sending. So the tx_en will not work here.
You can consider using the RX_int or the RX_CLK to reset the timer, just make sure the timing/reset pulse width meets the spec.
My mistake. I misread the original question.
I can't think of an easy way to do this automatically since the hardware would have to understand what the end of packet looked like in order to trigger the capture. I think your software solution is the most straightforward way to do it, but as Bob said, mind your variables (and declare any global variable that an interrupt handler can change as "volatile") and you should have a working solution.
Yes, I use Volatile variables that get modified in interrupts.
The Timer gets started with Timer_Start(), I am wanting to refresh the timer each time a UART byte is received (start the count again) to prevent it timeoing out unless no more characters are arriving. I have done this for quie some time using Mircochip controllers and found it worked well but not yet familiar with the PSOC timers to implement it straight off.
It would be great if the UART function had a timeout function you could set for no activity.
I could use an XON/XOFF type arrangement but the system is receiving data that does not have these dleimiters to mark the start and end of packet.
Providing the UART with a timeout will take a timer component and the needed underlying hardware, which is not wanted in all designs. You may of courde create a macro that contains all your needed components and use it in designs where that configuration is appropieat.
Restarting a timer in software best runs as a Timer_Stop(); Timer_Start();