This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

СС2541 KeyFob sending data to Android using button

Other Parts Discussed in Thread: CC2541, CC2650

Hello, my name is Ruslan! Could someone tell to me, how send data from KeyFob to Android or Btool, using button in Keyfob? Which function should i use? I need for the KeyFob send value of battery level with the push button, without request from Master.

  • Hi Ruslan,

    In the KeyFob project we have included a battery service that, so most of this functionality is already in place.
    In KeyFobApp_ProcessEvent() take a look at this section:

      if ( events & KFD_BATTERY_CHECK_EVT )
      {
        // Restart timer
        if ( BATTERY_CHECK_PERIOD )
        {
          osal_start_timerEx( keyfobapp_TaskID, KFD_BATTERY_CHECK_EVT, BATTERY_CHECK_PERIOD );
        }
    
        // perform battery level check
        Batt_MeasLevel( );
    
        return (events ^ KFD_BATTERY_CHECK_EVT);
      }

    The only difference here is that this is done on a fixed interval set by a timer, and the notification is only sent when the battery status has changed,
    have a look at Batt_MeasLevel().

    For the handling of the keys, you can start by looking at keyfobapp_HandleKeys().

    Regards,
    Johan

     

     

  • Hi, Johan! Excuse me, but which function should i use for transmitting data over BLE module from peripherial to central?
  • Voltage and temperature read of a built-in CC2541 sensor or an external sensor?
  • Hi,

    I can recommend you to take a look at this tutorial, this is however for the CC2650 HW and SW, bu the main concepts in how to
    to create a custom service to enable to send sensor data applies to the CC2541 as well:

    Regards,
    Johan