I use bt_clock_based_periodic_timer_Enable() function to implement various Timers.
I manage to implement IR LED on-off functions .
I wonder my ir code produces different timing in IR_LED on`.
My ir code is as below.(Repeating between holding IR_LED on 200ms and IR LED off 200ms)
I call bt_clock_based_periodic_timer_Enable(application_timer_expired_callback, NULL, 400000/625);
The registered callback function repeats.
int application_timer_expired_callback(void* context)
// 400 ms timer callback, do something.
//Todo: do you actions here every 1 second
//Send IR Code in 120 second.
if(ir_tx_ms < 120000)
irtx_sendData(send_buffer, 8, irtxClockSet);
// Context was not allocated and so does not need to be freed. So return no action.
The below picture says IR timing in the oscilloscope measurement.
The red rectangles show IR wave forms. I wonder why my code produces different IR wave forms.
I just repeat the same buffer value in my source code.
Thanks in advance.
1. The BT clock only gets multiple of 1.25 milliseconds,
2. The bt_clock_based_periodic_timer_enable is not serialized, so application timer as far as callback is going to be called in interupted context
3. If you enable ble trace in this function the connection might eventually drop
4. You cannot trace in this function - It has to be in app thread context which means you have to rewrite this function.
5. You need to post event to the application thread.
6. If you look at the running speed cadence, below, which does event seralization, you can trace as much as you like.
7. If you want timing, check on hw_timer.h it is the right thing to do.
8. Since you only get multiple of 1.25 milliseconds, bt blcock based periodic timer is not serialized.
9. If you are performing "long running stuff" your connection can be droppped.
10. If you want more accurate timing use hw_timer.h and the link is here http://community.broadcom.com/thread/4768
Hope this helps