/********************************************************************* * @fn readBarData * * @brief Read barometer data * * @param none * * @return none */ static void readBarData( void ) { uint8 bData[BAROMETER_DATA_LEN]; if (HalBarReadMeasurement(bData)) { Barometer_SetParameter( SENSOR_DATA, BAROMETER_DATA_LEN, bData); } }
/********************************************************************* * @fn readBarCalibration * * @brief Read barometer calibration * * @param none * * @return none */ static void readBarCalibration( void ) { uint8* cData = osal_mem_alloc(BAROMETER_CALI_LEN); if (cData != NULL ) { HalBarReadCalibration(cData); Barometer_SetParameter( SENSOR_CALB, BAROMETER_CALI_LEN, cData); osal_mem_free(cData); } }
/********************************************************************* * @fn resetCharacteristicValue * * @brief Initialize a characteristic value to zero * * @param servID - service ID (UUID) * * @param paramID - parameter ID of the value is to be cleared * * @param vakue - value to initialise with * * @param paramLen - length of the parameter * * @return none */ static void resetCharacteristicValue(uint16 servUuid, uint8 paramID, uint8 value, uint8 paramLen) { uint8* pData = osal_mem_alloc(paramLen); if (pData == NULL) { return; } osal_memset(pData,value,paramLen); switch(servUuid) { case IRTEMPERATURE_SERV_UUID: IRTemp_SetParameter( paramID, paramLen, pData); break; case ACCELEROMETER_SERV_UUID: Accel_SetParameter( paramID, paramLen, pData); break; case MAGNETOMETER_SERV_UUID: Magnetometer_SetParameter( paramID, paramLen, pData); break; case HUMIDITY_SERV_UUID: Humidity_SetParameter( paramID, paramLen, pData); break; case BAROMETER_SERV_UUID: Barometer_SetParameter( paramID, paramLen, pData); break; case GYROSCOPE_SERV_UUID: Gyro_SetParameter( paramID, paramLen, pData); break; // VB case BED_SERV_UUID: Bed_SetParameter( paramID, paramLen, pData); break; default: // Should not get here break; } osal_mem_free(pData); }