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/MESHBEAN/include/battery.h | 63 +++++++++++++++++++ .../Components/BSP/MESHBEAN/include/bspDbg.h | 40 +++++++++++++ .../Components/BSP/MESHBEAN/include/bspLeds.h | 70 ++++++++++++++++++++++ .../BSP/MESHBEAN/include/bspTaskManager.h | 60 +++++++++++++++++++ .../Components/BSP/MESHBEAN/include/lm73.h | 66 ++++++++++++++++++++ .../Components/BSP/MESHBEAN/include/pwrCtrl.h | 47 +++++++++++++++ .../Components/BSP/MESHBEAN/include/tsl2550.h | 64 ++++++++++++++++++++ 7 files changed, 410 insertions(+) create mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/battery.h create mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspDbg.h create mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspLeds.h create mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspTaskManager.h create mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/lm73.h create mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/pwrCtrl.h create mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/tsl2550.h (limited to 'digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include') diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/battery.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/battery.h new file mode 100644 index 00000000..5bdc91fe --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/battery.h @@ -0,0 +1,63 @@ +/**************************************************************************//** +\file battery.h + +\brief Interface to the battery sensor. + +\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/06/07 E. Ivanov - Created +******************************************************************************/ + +#ifndef _BATTERY_H +#define _BATTERY_H + +/****************************************************************************** + Includes section +******************************************************************************/ +// \cond +#include +#include +// \endcond + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** +\brief Opens the component to use. +\return + BC_SUCCESS - the component is ready to been use. \n + BC_FAIL - otherwise. +******************************************************************************/ +result_t openBattery(void); + +/**************************************************************************//** +\brief Closes component. +\return + BC_SUCCESS - always. +******************************************************************************/ +result_t closeBattery(void); + +/**************************************************************************//** +\brief Starts ADC request on battery channel. +\param[in] + callback - callback method. +\param[in] + data - battery data. + Can use (4ul * data * 125ul * 3ul) / (1024ul * 100ul) formula to count \n + battery data in Volts. +\return + BC_FAIL - battery component was not opened. + BC_SUCCESS - other case. +******************************************************************************/ +result_t readBatteryData(BspBatteryCb_t); + +#endif /* _BATTERY_H */ +// eof battery.h + diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspDbg.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspDbg.h new file mode 100644 index 00000000..b3bb6013 --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspDbg.h @@ -0,0 +1,40 @@ +/***************************************************************************//** + \file bspDbg.h + + \brief Assert codes for BSP + + \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: + 10/06/10 D. Loskutnikov - Created + ******************************************************************************/ +/****************************************************************************** + * WARNING: CHANGING THIS FILE MAY AFFECT CORE FUNCTIONALITY OF THE STACK. * + * EXPERT USERS SHOULD PROCEED WITH CAUTION. * + ******************************************************************************/ + +#ifndef _BSPDBG_H +#define _BSPDBG_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Definitions section +******************************************************************************/ +enum +{ + TSL2550_UNEXPECTED_STATE = 0x9000, +}; + +#endif /* _BSPDBG_H */ + +// eof bspDbg.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspLeds.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspLeds.h new file mode 100644 index 00000000..fc088281 --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspLeds.h @@ -0,0 +1,70 @@ +/***************************************************************************//** +\file bspLeds.h + +\brief Declaration of leds defines. + +\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 _BSPLEDS_H +#define _BSPLEDS_H + +/****************************************************************************** + Includes section +******************************************************************************/ +// \cond +#include +#include +// \endcond + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +#define halInitRedLed() GPIO_0_make_out() +#define halUnInitRedLed() GPIO_0_make_in() +#define halReadRedLed() GPIO_0_read() +#define halToggleRedLed() GPIO_0_toggle() + +#define halInitYellowLed() GPIO_1_make_out() +#define halUnInitYellowLed() GPIO_1_make_in() +#define halReadYellowLed() GPIO_1_read() +#define halToggleYellowLed() GPIO_1_toggle() + +#define halInitGreenLed() GPIO_2_make_out() +#define halUnInitGreenLed() GPIO_2_make_in() +#define halReadGreenLed() GPIO_2_read() +#define halToggleGreenLed() GPIO_2_toggle() + +#if BSP_MNZB_EVB_SUPPORT == 1 + #define halOnRedLed() GPIO_0_set() + #define halOffRedLed() GPIO_0_clr() + + #define halOnYellowLed() GPIO_1_set() + #define halOffYellowLed() GPIO_1_clr() + + #define halOnGreenLed() GPIO_2_set() + #define halOffGreenLed() GPIO_2_clr() +#else + /* Atmel MeshBean boards */ + #define halOnRedLed() GPIO_0_clr() + #define halOffRedLed() GPIO_0_set() + + #define halOnYellowLed() GPIO_1_clr() + #define halOffYellowLed() GPIO_1_set() + + #define halOnGreenLed() GPIO_2_clr() + #define halOffGreenLed() GPIO_2_set() +#endif /* BSP_MNZB_EVB_SUPPORT */ + +#endif /*_BSPLEDS_H*/ +// eof bspLeds.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspTaskManager.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspTaskManager.h new file mode 100644 index 00000000..a2198513 --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspTaskManager.h @@ -0,0 +1,60 @@ +/**************************************************************************//** +\file bspTaslManager.h + +\brief Declarations of enums and functions of BSP task manager. + +\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 _BSPTASKHANDLER_H +#define _BSPTASKHANDLER_H + +/****************************************************************************** + Includes section +******************************************************************************/ +// \cond +#include +#include +// \endcond + +/****************************************************************************** + Define(s) section +******************************************************************************/ +enum +{ + BSP_BUTTONS = (uint8_t)1 << 0, + BSP_TEMPERATURE = (uint8_t)1 << 1, + BSP_LIGHT = (uint8_t)1 << 2, + BSP_BATTERY = (uint8_t)1 << 3, +}; + +/****************************************************************************** + External variables section +******************************************************************************/ +extern volatile uint8_t bspTaskFlags; + +/****************************************************************************** + Inline static functions section +******************************************************************************/ +/***************************************************************************//** +\brief posting bsp task for task manager. +\param[in] + flag - task number +*******************************************************************************/ +INLINE void bspPostTask(uint8_t flag) +{ + bspTaskFlags |= flag; + SYS_PostTask(BSP_TASK_ID); +} + +#endif /* _BSPTASKHANDLER_H */ +// eof bspTaskManager.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/lm73.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/lm73.h new file mode 100644 index 00000000..29cf29e2 --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/lm73.h @@ -0,0 +1,66 @@ +/**************************************************************************//** +\file lm73.h + +\brief Declarations of lm73 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 _LM73_SENSOR_H +#define _LM73_SENSOR_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** +\brief Opens the component to use. + +\return + BC_SUCCESS - the component is ready to been use. \n + BC_FAIL - otherwise. +******************************************************************************/ +result_t openLm73(void); + +/**************************************************************************//** +\brief Performs the test if the component have completed request. + +\return + BC_FAIL - the previous request is not completed. + BC_SUCCESS - otherwise. +******************************************************************************/ +result_t closeLm73(void); + +/**************************************************************************//** +\brief Reads data from lm73 sensor. +\param[in] + f - callback method. +\param[in] + result - the result of the requested operation. + true - operation finished successfully, + false - some error has occured. +\param[in] + data - sensor data. +\return + BC_FAIL - the previous request was not completed, + the address of callback is 0, i2c interface is busy, + there is error on i2c interface. + BC_SUCCESS - other case. +******************************************************************************/ +result_t readLm73Data(void (*f)(bool result, int16_t data)); + +#endif /* _LM73_SENSOR_H */ +// eof lm73.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/pwrCtrl.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/pwrCtrl.h new file mode 100644 index 00000000..6a25e942 --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/pwrCtrl.h @@ -0,0 +1,47 @@ +/**************************************************************************//** +\file pwrCtrl.h + +\brief Interface to the power control module. + +\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 _POWERCTRL_H +#define _POWERCTRL_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** +\brief Powers on periphery. + +\param[in] + id - number of periphery +******************************************************************************/ +void bspOnPeriphery(uint8_t id); + +/**************************************************************************//** +\brief Powers off periphery. + +\param[in] + id - number of periphery +******************************************************************************/ +void bspOffPeriphery(uint8_t id); + +#endif /* _POWERCTRL_H */ +// eof pwrCtrl.h + diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/tsl2550.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/tsl2550.h new file mode 100644 index 00000000..de869031 --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/tsl2550.h @@ -0,0 +1,64 @@ +/**************************************************************************//** +\file tsl2550.h + +\brief Declarations of tsl2550 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/06/07 E. Ivanov - Created +*******************************************************************************/ + +#ifndef _TSL2550_SENSOR_H +#define _TSL2550_SENSOR_H + +/****************************************************************************** + Includes section +******************************************************************************/ +// \cond +#include +// \endcond + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** +\brief Opens the component to use. +\return + BC_SUCCESS - the component is ready to been use. \n + BC_FAIL - otherwise. +******************************************************************************/ +result_t openTsl2550(void); + +/**************************************************************************//** +\brief Performs the test if the component have uncompleted request. +\return + BC_FAIL - the previous request is not completed. \n + BC_SUCCES - otherwise. +******************************************************************************/ +result_t closeTsl2550(void); + +/**************************************************************************//** +\brief Reads data from tsl2550 sensor. +\param[in] + result - the result of the requested operation. + true - operation finished successfully, false - some error has + occured. +\param[in] + data - sensor data. +\return + BC_FAIL - the previous request was not completed, \n + the address of callback is 0, i2c interface is busy, \n + there is error on i2c interface. \n + BC_SUCCESS - other case. +******************************************************************************/ +result_t readTsl2550Data(void (*f)(bool result, int16_t data)); + +#endif /* _TSL2550_SENSOR_H */ +// eof tsl2550.h -- cgit v1.2.3