Other Parts Discussed in Thread: CC2540
Hello,
I have couple modules with CC2541:
I have uploaded through debugger SimpleBLEPeripheral example from BLE stack (BLE-CC254x-1.4.2.2).
Now I'm able to see it via phone with android and in SmartRF Studio.
So, I suppose everything with settings/wiring is fine.
How can I add my own function to this project?
For example, sending some bytes throuhg UART.
I have connected USB-UART dongle ( ) to P03 and P02 pins and want to see some packets throught terminal at first.
(In further I would like also to see how to use I2C with this module, but let's postpone it for later)
As I understand (correct me please if I'm wrong) in SimpleBLEPeripheral_Main.c I have nothing to do,
since function
/* Start OSAL */ osal_start_system();
calls
osal_run_system();
in forever loop. And in this function only pocessing tasks and events. So, I need to work with simpleBLEPeripheral.c I suppose?
As I understand, I need to create my own task?
I checked another examples and figured out that I need to use
osal_start_timerEx()
to set time with interrupt.
But how can I add my own function in all system?
I tried add this
void custom_func_test() { uint8 testbuf [5]={7,6,5,4,3}; osal_start_timerEx( 1, 2, 100); SimpleBLEPeripheral_ProcessEvent(11, 1); HalUARTWrite(1, testbuf, 5); }
but I have no clue from where I need to call it. (tried to put in MAIN function before OSALsystem run in simpleBLEperipheral_main.c , but debugger dint not even get there)