iBeacons on the TI CC2541

 In 8051, Bluetooth Low Energy, iBeacon

Setting a Timer

The easiest way I found to set a timer is to call

uint8 osal_start_timerEx( uint8 taskID, uint16 event_id, uint32 timeout_value )

This call is used for setting the timeout value for turning the advertising back on in the code.  We are going to modify it so that we can turn the advertising off.  I don’t know the framework good enough to start adding tasks.  Instead we are going to modify GAPRole_ProcessEvent( uint8 task_id, uint16 events ) to take a new message that tells it to turn off the radio.  In my case I called it STOP_ADVERTISING_EVT.  This needs to run the following commands:

  if ( events & START_ADVERTISING_EVT )
  {
      ...
  }
  else if  (events & STOP_ADVERTISING_EVT)
  {
    VOID GAP_EndDiscoverable(gapRole_TaskID);
    gapRole_AdvEnabled = FALSE;
    return ( events ^ STOP_ADVERTISING_EVT );
  }

Wrap Up

This should help you as you work on making the example project match what you are actually doing.  Don’t expect this to be a one day project.  There’s a lot (remove the static typing from this variable, include this header, etc.). I left out in the name of brevity here.  Hopefully I’ll get another post out to go along with this.  Until next time.

Showing 5 comments
  • Gokhan
    Reply

    Can you put batter level data from battery service in advertisement data?

    etc: battery level:%88 So is it possible to put that data in advertisement also?

  • Dan
    Reply

    Could you upload the firmware source somewhere? The tutorial page originally linked to has disappeared. If you also have a backup copy of the tutorial page, that would be great also.

  • Glenn
    Reply

    Hi Chad, do you have a copy of the radius networks CC2541 iBeacon project for the CC2541DK-MINI dev kit? Your links doesn’t work any more (they’ve moved the project/taken it down).

    Many thanks

pingbacks / trackbacks

Leave a Reply to Dan Cancel reply

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Start typing and press Enter to search