From a54ad9edce697133a024aff096e50f7e4f389d5b Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Sun, 18 Mar 2012 12:22:02 +0100 Subject: digital/beacon: import Zigbit stack (bitcloud) & avr sources --- .../Components/BSP/include/sensors.h | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/sensors.h (limited to 'digital/beacon/src/Bitcloud_stack/Components/BSP/include/sensors.h') diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/sensors.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/sensors.h new file mode 100644 index 00000000..740c6a05 --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/sensors.h @@ -0,0 +1,137 @@ +/**************************************************************************//** + \file sensors.h + + \brief The header file describes the sensors interface. + + \author + Atmel Corporation: http://www.atmel.com \n + Support email: avr@atmel.com + + Copyright (c) 2008-2011, Atmel Corporation. All rights reserved. + Licensed under Atmel's Limited License Agreement (BitCloudTM). + + \internal + History: + 29/05/07 E. Ivanov - Created +*******************************************************************************/ + +#ifndef _SENSORS_H +#define _SENSORS_H + +/****************************************************************************** + Includes section +******************************************************************************/ +// \cond +#include +// \endcond + +/****************************************************************************** + Define(s) section +******************************************************************************/ +// \cond +#define SENSOR_LIGHT 1 +#define SENSOR_TEMPERATURE 2 +#define SENSOR_BATTERY 3 +#define SENSOR_LED 4 +// \endcond + +typedef void (*BspTemperatureCb_t)(bool result, int16_t data); +typedef void (*BspBatteryCb_t)(int16_t data); + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/***************************************************************************//** +\brief Opens temperature sensor. +\return + BC_FAIL - sensor has been already open. \n + BC_SUCCESS - otherwise. +*******************************************************************************/ +result_t BSP_OpenTemperatureSensor(void); + +/***************************************************************************//** +\brief Closes the temperature sensor. +\return + BC_FAIL - if a hardware error has occured or + there is uncompleted ReadData request. \n + BC_SUCCESS - otherwise. +*******************************************************************************/ +result_t BSP_CloseTemperatureSensor(void); + +/**************************************************************************//** +\brief Reads data from the temperature sensor. +\param[in] + f - callback. + result - the result of the requested operation. + true - operation finished successfully, false - some error has + occured. + data - sensor data. +\return + BC_FAIL - previous request was not completed. \n + BC_SUCCESS - otherwise. +******************************************************************************/ +result_t BSP_ReadTemperatureData(BspTemperatureCb_t f); + +/***************************************************************************//** +\brief Opens the light sensor. +\return + BC_FAIL - sensor has been already open. \n + BC_SUCCESS - otherwise. +*******************************************************************************/ +result_t BSP_OpenLightSensor(void); + +/***************************************************************************//** +\brief Closes the light sensor. +\return + BC_FAIL - if a hardware error has occured or + there is uncompleted ReadData request. \n + BC_SUCCESS - otherwise. +*******************************************************************************/ +result_t BSP_CloseLightSensor(void); + +/**************************************************************************//** +\brief Reads data from the light sensor. +\param[in] + f - callback. + result - the result of the requested operation. + true - operation finished successfully, false - some error has + occured. + data - sensor data. +\return + BC_FAIL - previous request was not completed. \n + BC_SUCCESS - otherwise. +******************************************************************************/ +result_t BSP_ReadLightData(void (*f)(bool result, int16_t data)); + +/***************************************************************************//** +\brief Opens the battery sensor. +\return + BC_FAIL - sensor has been already open. \n + BC_SUCCESS - otherwise. +*******************************************************************************/ +result_t BSP_OpenBatterySensor(void); + +/***************************************************************************//** +\brief Closes the battery sensor. +\return + BC_FAIL - sensor was not opened. \n + BC_SUCCESS - otherwise. +*******************************************************************************/ +result_t BSP_CloseBatterySensor(void); + +/**************************************************************************//** +\brief Reads data from battery sensor. +\param[in] + callback - callback function. + data - sensor data. + Can use (4ul * data * 125ul * 3ul) / (1024ul * 100ul) formula to count \n + battery data in Volts (for avr). +\return + BC_FAIL - previous request was not completed, or sensor was not opened. \n + BC_SUCCESS - otherwise. +******************************************************************************/ +result_t BSP_ReadBatteryData(BspBatteryCb_t cb); + +#endif/* _SENSORS_H */ +// eof sensors.h + -- cgit v1.2.3