Other Parts Discussed in Thread: CC2541, CC2540, CC2541S
Hi, I am starting to put something together in IAR based on the SimpleBLEPeripheral project. I have the CC2541 Mini Kit which comes with the CC2540 USB dongle.
I want to do some range testing to see the difference between the CC2540 & CC2541 (I believe the CC2541 has lower power) and looking through the code in IAR I see that a define is used to determine which power to use:
#if defined( CC2541) || defined( CC2541S )
#define LL_EXT_MAX_TX_POWER LL_EXT_TX_POWER_0_DBM
#else // CC2540
#define LL_EXT_MAX_TX_POWER LL_EXT_TX_POWER_4_DBM
#endif // CC2541 || CC2541S
However I can't find where this is defined in the CC2541 project. I've search and looked at every instance of CC2541 and i've looked in the Preprocessor Defined Symbols list. Can anyone tell me where/if this should be defined so I can compile for CC2540 & CC2541.
2) If I add the line 'HalLedSet (HAL_LED_2, HAL_LED_MODE_FLASH);' to peripheralStateNotificationCB method under case GAPROLE_ADVERTISING then the LED flashes when I start advertising and continues to flash when advertising is stopped by pressing the button, which is what I expect. However if I use HAL_LED_MODE_ON the LED blinks much faster and when advertising ends by pressing the button the LED stops. There is no code that I can find that is setting the LED to OFF apart from whats in the initialization routines. This has me somewhat confused. Are the initialization routines running again when advertising is stopped? But why wouldn't flashing led stop also?
3) Also in the peripheralStateNotificationCB method, it seems that GAPROLE_WAITING case is called both when a connected device is disconnected and also when advertising is stopped. Is there no case to determine between the 2? I would like to know when advertising has stopped even if a device is connected.
I hope someone can help and some or all of these questions.
Thanks