/*********************************************************************
 * @fn      accelChangeCB
 *
 * @brief   Callback from Acceleromter Service indicating a value change
 *
 * @param   paramID - parameter ID of the value that was changed.
 *
 * @return  none
 */
static void accelChangeCB( uint8 paramID )
{
    uint8 newValue;
    switch (paramID)
    {
        case ACCELEROMETER_CONF:
            Accel_GetParameter( ACCELEROMETER_CONF, &newValue );
            if ( newValue == ST_CFG_SENSOR_DISABLE)
            {
                // Put sensor to sleep
                if (accConfig != ST_CFG_SENSOR_DISABLE)
                {
                    accConfig = ST_CFG_SENSOR_DISABLE;
                    osal_set_event( sensorTag_TaskID, ST_ACCELEROMETER_SENSOR_EVT);
                }
            }
            else
            {
                if (accConfig == ST_CFG_SENSOR_DISABLE)
                {
                    osal_set_event( sensorTag_TaskID, ST_ACCELEROMETER_SENSOR_EVT);
                }
            }
            accConfig=newValue;
            HalAccSetRange(accConfig);
            break;
        case ACCELEROMETER_PERI:
            Accel_GetParameter( ACCELEROMETER_PERI, &newValue );
            //sensorAccPeriod = newValue*ACCELEROMETER_TIME_UNIT;
            break;
        default:
            // Should not get here
            break;
    }
}
Beispiel #2
0
/*********************************************************************
 * @fn      accelChangeCB
 *
 * @brief   Callback from Acceleromter Service indicating a value change
 *
 * @param   paramID - parameter ID of the value that was changed.
 *
 * @return  none
 */
static void accelChangeCB( uint8 paramID )
{
  uint8 newValue;

  switch (paramID)
  {
    case SENSOR_CONF:
      Accel_GetParameter( SENSOR_CONF, &newValue );
      if ( newValue == ST_CFG_SENSOR_DISABLE)
      {
        // Put sensor to sleep
        if (accConfig != ST_CFG_SENSOR_DISABLE)
        {
          accConfig = ST_CFG_SENSOR_DISABLE;
          osal_set_event( sensorTag_TaskID, ST_ACCELEROMETER_SENSOR_EVT);
        }
      }
      else
      {
        if (accConfig == ST_CFG_SENSOR_DISABLE)
        {
          // Start scheduling only on change disabled -> enabled
          osal_set_event( sensorTag_TaskID, ST_ACCELEROMETER_SENSOR_EVT);
        }
        // Scheduled already, so just change range
        accConfig = newValue;
        HalAccSetRange(accConfig);
      }
      break;

    case SENSOR_PERI:
      Accel_GetParameter( SENSOR_PERI, &newValue );
      sensorAccPeriod = newValue*SENSOR_PERIOD_RESOLUTION;
      break;

    default:
      // Should not get here
      break;
  }
}