From 22abd06132445a55a1a0266897920f26634825c1 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 26 Dec 2012 17:38:10 +0100 Subject: digital/beacon: remove obsolete bitcloud stack --- .../src/Bitcloud_stack/Components/BSP/BoardConfig | 106 ----- .../Bitcloud_stack/Components/BSP/BoardConfig.h | 89 ---- .../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 --- .../Components/BSP/MESHBEAN/src/battery.c | 168 -------- .../Components/BSP/MESHBEAN/src/bspTaskManager.c | 121 ------ .../Components/BSP/MESHBEAN/src/buttons.c | 239 ----------- .../Components/BSP/MESHBEAN/src/fakeBSP.c | 359 ---------------- .../Components/BSP/MESHBEAN/src/leds.c | 139 ------- .../Components/BSP/MESHBEAN/src/lm73.c | 184 --------- .../Components/BSP/MESHBEAN/src/pwrCtrl.c | 91 ---- .../Components/BSP/MESHBEAN/src/sensors.c | 196 --------- .../Components/BSP/MESHBEAN/src/sliders.c | 59 --- .../Components/BSP/MESHBEAN/src/tsl2550.c | 457 --------------------- .../src/Bitcloud_stack/Components/BSP/Makefile | 221 ---------- .../Components/BSP/RCB/include/bspLeds.h | 68 --- .../Components/BSP/RCB/include/bspTaskManager.h | 60 --- .../Components/BSP/RCB/src/bspTaskManager.c | 86 ---- .../Components/BSP/RCB/src/buttons.c | 187 --------- .../Components/BSP/RCB/src/fakeBSP.c | 356 ---------------- .../Bitcloud_stack/Components/BSP/RCB/src/leds.c | 124 ------ .../Components/BSP/include/buttons.h | 96 ----- .../Components/BSP/include/hexSwitch.h | 45 -- .../Components/BSP/include/joystick.h | 74 ---- .../Bitcloud_stack/Components/BSP/include/lcd.h | 140 ------- .../Bitcloud_stack/Components/BSP/include/leds.h | 83 ---- .../Components/BSP/include/rs232Controller.h | 89 ---- .../Components/BSP/include/rs485Controller.h | 33 -- .../Components/BSP/include/sensors.h | 137 ------ .../Components/BSP/include/sliders.h | 43 -- .../Components/BSP/include/usbController.h | 42 -- 36 files changed, 4502 deletions(-) delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/BoardConfig delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/BoardConfig.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/battery.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspDbg.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspLeds.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspTaskManager.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/lm73.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/pwrCtrl.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/tsl2550.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/battery.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/bspTaskManager.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/buttons.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/fakeBSP.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/leds.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/lm73.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/pwrCtrl.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/sensors.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/sliders.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/tsl2550.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/Makefile delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/include/bspLeds.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/include/bspTaskManager.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/bspTaskManager.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/buttons.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/fakeBSP.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/leds.c delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/buttons.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/hexSwitch.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/joystick.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/lcd.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/leds.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/rs232Controller.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/rs485Controller.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/sensors.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/sliders.h delete mode 100644 digital/beacon/src/Bitcloud_stack/Components/BSP/include/usbController.h (limited to 'digital/beacon/src/Bitcloud_stack/Components/BSP') diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/BoardConfig b/digital/beacon/src/Bitcloud_stack/Components/BSP/BoardConfig deleted file mode 100644 index c1d952b9..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/BoardConfig +++ /dev/null @@ -1,106 +0,0 @@ -ifeq ($(BOARD), BOARD_MESHBEAN) - BSP_LIB = BSPMeshBean - BOARDCFLAGS = -D_BUTTONS_ - BOARDCFLAGS += -D_TEMPERATURE_SENSOR_ - BOARDCFLAGS += -D_LIGHT_SENSOR_ - BOARDCFLAGS += -D_BATTERY_SENSOR_ - BOARDCFLAGS += -D_LEDS_ - BOARDCFLAGS += -D_SLIDERS_ - BOARDCFLAGS += -DBSP_MNZB_EVB_SUPPORT=1 -endif - -ifeq ($(BOARD), BOARD_RAVEN) - BSP_LIB = BSPRaven - BOARDCFLAGS = -D_LCD_ - BOARDCFLAGS += -D_TEMPERATURE_SENSOR_ - BOARDCFLAGS += -D_BATTERY_SENSOR_ -endif - -ifeq ($(BOARD), BOARD_USB_DONGLE) - BSP_LIB = BSPAtmlUsbDongle - BOARDCFLAGS = -D_LEDS_ -endif - -ifeq ($(BOARD), BOARD_STK600) - BSP_LIB = BSPStk600 - BOARDCFLAGS = -D_BUTTONS_ - BOARDCFLAGS += -D_LEDS_ -endif - -ifeq ($(BOARD), BOARD_STK500) - BSP_LIB = BSPStk500 - BOARDCFLAGS = -D_BUTTONS_ - BOARDCFLAGS += -D_LEDS_ -endif - -ifeq ($(BOARD), BOARD_MESHBEAN_TURBO) - BSP_LIB = BSPMeshBeanTurbo - BOARDCFLAGS = -D_LEDS_ - BOARDCFLAGS += -D_SLIDERS_ - BOARDCFLAGS += -D_BUTTONS_ -endif - -ifeq ($(BOARD), BOARD_MESHBEAN_LAN) - BSP_LIB = BSPMeshBeanLan - BOARDCFLAGS = -D_LEDS_ - BOARDCFLAGS += -D_BUTTONS_ -endif - -ifeq ($(BOARD), BOARD_SAM7X_EK) - BSP_LIB = BSPSam7xEk - BOARDCFLAGS = -D_LEDS_ - BOARDCFLAGS += -D_JOYSTICK_ -endif - -ifeq ($(BOARD), BOARD_SAM3S_EK) - BSP_LIB = BSPSam3sEk - BOARDCFLAGS = -D_LEDS_ -endif - -ifeq ($(BOARD), BOARD_CUSTOM_3) - BSP_LIB = BSPCustom3 - BOARDCFLAGS = -D_LEDS_ -endif - -ifeq ($(BOARD), BOARD_CUSTOM_1) - BSP_LIB = BSPCustom1 - BOARDCFLAGS = -D_LEDS_ - BOARDCFLAGS += -D_BUTTONS_ - BOARDCFLAGS += -D_RS485CONTROL_ -endif - -ifeq ($(BOARD), BOARD_CUSTOM_2) - BSP_LIB = BSPCustom2 - BOARDCFLAGS = -D_LEDS_ - BOARDCFLAGS += -D_BUTTONS_ - BOARDCFLAGS += -D_RS485CONTROL_ - BOARDCFLAGS += -D_USBCONTROL_ -endif - -ifeq ($(BOARD), BOARD_RCB) - BSP_LIB = BSPRcb - BOARDCFLAGS = -D_LEDS_ -endif - -ifeq ($(BOARD), BOARD_AVR32_EVK1105) - BSP_LIB = BSPAvr32Evk1105 - BOARDCFLAGS = -D_LEDS_ - BOARDCFLAGS += -D_BUTTONS_ -endif - -ifeq ($(BOARD), BOARD_XPLAIN) - BSP_LIB = BSPXplain - BOARDCFLAGS = -D_LEDS_ - BOARDCFLAGS += -D_BUTTONS_ -endif - -ifeq ($(BOARD), BOARD_REB_CBB) - BSP_LIB = BSPRebCbb - BOARDCFLAGS = -D_LEDS_ - BOARDCFLAGS += -D_BUTTONS_ -endif - -ifeq ($(BOARD), BOARD_SIMULATOR) - BSP_LIB = BSPsim - BOARDCFLAGS = -D_LEDS_ -endif diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/BoardConfig.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/BoardConfig.h deleted file mode 100644 index 41c464d2..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/BoardConfig.h +++ /dev/null @@ -1,89 +0,0 @@ -/***************************************************************************//** -\file BoardConfig.h - -\brief Definition of board-specific periphery for each platform. - -\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). -*******************************************************************************/ -#ifdef BOARD_MESHBEAN - #define _BUTTONS_ - #define _TEMPERATURE_SENSOR_ - #define _LIGHT_SENSOR_ - #define _LEDS_ - #define _SLIDERS_ -#endif -#ifdef BOARD_RAVEN - #define _LCD_ - #define _TEMPERATURE_SENSOR_ - #define _BATTERY_SENSOR_ -#endif -#ifdef BOARD_USB_DONGLE - #define _LEDS_ -#endif -#ifdef BOARD_STK600 - #define _BUTTONS_ - #define _LEDS_ -#endif -#ifdef BOARD_STK500 - #define _BUTTONS_ - #define _LEDS_ -#endif -#ifdef BOARD_MESHBEAN_TURBO - #define _LEDS_ - #define _SLIDERS_ - #define _BUTTONS_ -#endif -#ifdef BOARD_MESHBEAN_LAN - #define _LEDS_ - #define _BUTTONS_ -#endif -#ifdef BOARD_SAM7X_EK - #define _LEDS_ - #define _JOYSTICK_ -#endif -#ifdef BOARD_SAM3S_EK - #define _LEDS_ -#endif -#ifdef BOARD_SAM3S_PIRRD - #define _LEDS_ -#endif -#ifdef BOARD_RF231USBRD - #define _LEDS_ -#endif -#ifdef BOARD_CUSTOM_3 - #define _LEDS_ -#endif -#ifdef BOARD_CUSTOM_1 - #define _LEDS_ - #define _BUTTONS_ - #define _RS485CONTROL_ -#endif -#ifdef BOARD_CUSTOM_2 - #define _LEDS_ - #define _BUTTONS_ - #define _RS485CONTROL_ - #define _USBCONTROL_ -#endif -#ifdef BOARD_RCB - #define _LEDS_ -#endif -#ifdef BOARD_AVR32_EVK1105 - #define _LEDS_ - #define _BUTTONS_ -#endif -#ifdef BOARD_XPLAIN - #define _LEDS_ - #define _BUTTONS_ -#endif -#ifdef BOARD_REB_CBB - #define _LEDS_ - #define _BUTTONS_ -#endif -#ifdef BOARD_SIMULATOR - #define _LEDS_ -#endif 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 deleted file mode 100644 index 5bdc91fe..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/battery.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************//** -\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 deleted file mode 100644 index b3bb6013..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspDbg.h +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************//** - \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 deleted file mode 100644 index fc088281..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspLeds.h +++ /dev/null @@ -1,70 +0,0 @@ -/***************************************************************************//** -\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 deleted file mode 100644 index a2198513..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/bspTaskManager.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************//** -\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 deleted file mode 100644 index 29cf29e2..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/lm73.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************//** -\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 deleted file mode 100644 index 6a25e942..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/pwrCtrl.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************//** -\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 deleted file mode 100644 index de869031..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/include/tsl2550.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************//** -\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 diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/battery.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/battery.c deleted file mode 100644 index 63facdb3..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/battery.c +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************//** -\file battery.c - -\brief This module is used for measurment battery voltage. - -\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 -******************************************************************************/ -#if APP_DISABLE_BSP != 1 - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include -#include - -#if BSP_MNZB_EVB_SUPPORT == 1 - -/****************************************************************************** - Define(s) section -******************************************************************************/ -#define BATTERY_AMOUNT_DISPERSION 2 -#define MAX_AMOUNT_COUNTER 20 - -/****************************************************************************** - Types section -******************************************************************************/ -// battery states -typedef enum -{ - IDLE, // idle - BUSY, // opened and ready to be used - DATA // performs request -} batteryStates_t; - -// battery descriptor -typedef struct -{ - uint8_t batteryData; - BspBatteryCb_t batteryCallback; // callback -} BatteryControl_t; - -/****************************************************************************** - Global variables section -******************************************************************************/ -// Monitors current state -static batteryStates_t batteryState = IDLE; -static BatteryControl_t batteryControl; -static HAL_AdcParams_t adcParam; -static uint8_t batExpectation; -static uint8_t batAmountCnt; - -/****************************************************************************** - Implementations section -******************************************************************************/ -/**************************************************************************//** -\brief Callback about ADC request was completed. -\param[in] - data - result of ADC. -******************************************************************************/ -void batteryCallback(void) -{ - batAmountCnt++; - if ((batteryControl.batteryData > (batExpectation + BATTERY_AMOUNT_DISPERSION)) || - (batteryControl.batteryData < (batExpectation - BATTERY_AMOUNT_DISPERSION))) - { - batExpectation = batteryControl.batteryData; - batAmountCnt = 0; - } - - if (MAX_AMOUNT_COUNTER == batAmountCnt) - { - batAmountCnt = 0; - batExpectation = 0; - bspPostTask(BSP_BATTERY); - return; - } - - batteryState = BUSY; - readBatteryData(batteryControl.batteryCallback); -} - -/**************************************************************************//** -\brief Opens the component to use. -\return - BC_SUCCESS - the component is ready to been use. \n - BC_FAIL - otherwise. -******************************************************************************/ -result_t openBattery(void) -{ - if (IDLE == batteryState) - { - adcParam.bufferPointer = &(batteryControl.batteryData); - adcParam.callback = batteryCallback; - adcParam.resolution = RESOLUTION_8_BIT; - adcParam.sampleRate = ADC_4800SPS; - adcParam.selectionsAmount = 1; - adcParam.voltageReference = AREF; - batteryState = BUSY; - HAL_OpenAdc(&adcParam); - return BC_SUCCESS; - } - return BC_FAIL; -} - -/**************************************************************************//** -\brief Closes component. -\return - BC_SUCCESS - always. -******************************************************************************/ -result_t closeBattery(void) -{ - if (IDLE == batteryState) - return BC_FAIL; - batteryState = IDLE; - HAL_CloseAdc(); - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Starts ADC request on battery channel. -\param[in] - data - sensor data. -\return - BC_FAIL - battery component was not opened. \n - BC_SUCCESS - other case. -******************************************************************************/ -result_t readBatteryData(BspBatteryCb_t cb) -{ - if (BUSY != batteryState) - return BC_FAIL; - batteryState = DATA; - batteryControl.batteryCallback = cb; - HAL_ReadAdc(HAL_ADC_CHANNEL0); - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP battery handler. -******************************************************************************/ -void bspBatteryHandler(void) -{ - int16_t value; - - // 1250 - 1.25 V reference voltage expressed in mV (1250 mV) - // 3 - battery voltage is divided by 3 on the MeshBean board - // 256 - steps for 8 bit ADC - // Resulting value is a true battery voltage expressed in mV - value = (batteryControl.batteryData * 1250ul * 3ul) / 256ul; - - batteryState = BUSY; - batteryControl.batteryCallback(value); -} -#endif /* BSP_MNZB_EVB_SUPPORT */ - -#endif // APP_DISABLE_BSP != 1 - -// eof battery.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/bspTaskManager.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/bspTaskManager.c deleted file mode 100644 index d63f62da..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/bspTaskManager.c +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************//** -\file bspTaskManager.c - -\brief Implemenattion 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 -******************************************************************************/ -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include - -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief BSP button handler. -******************************************************************************/ -void bspButtonsHandler(void); - -/**************************************************************************//** -\brief BSP lm73 handler. -******************************************************************************/ -void bspLM73Handler(void); -void bspTemperatureSensorHandler(void); - -/**************************************************************************//** -\brief BSP tsl2550 handler. -******************************************************************************/ -void bspTsl2550Handler(void); -void bspLightSensorHandler(void); - -/**************************************************************************//** -\brief BSP battery handler. -******************************************************************************/ -void bspBatteryHandler(void); -void bspEmptyBatteryHandler(void); - -/****************************************************************************** - Global variables section -******************************************************************************/ -volatile uint8_t bspTaskFlags = 0; - -/****************************************************************************** - Implementations section -******************************************************************************/ -/**************************************************************************//** -\brief BSP task handler. -******************************************************************************/ -#if APP_DISABLE_BSP != 1 - -void BSP_TaskHandler(void) -{ - if (bspTaskFlags & BSP_BUTTONS) - { - bspTaskFlags &= (~BSP_BUTTONS); - bspButtonsHandler(); - } - if (bspTaskFlags & BSP_TEMPERATURE) - { - bspTaskFlags &= (~BSP_TEMPERATURE); - bspLM73Handler(); - } - if (bspTaskFlags & BSP_LIGHT) - { - bspTaskFlags &= (~BSP_LIGHT); - bspTsl2550Handler(); - } - if (bspTaskFlags & BSP_BATTERY) - { - bspTaskFlags &= (~BSP_BATTERY); -#if BSP_MNZB_EVB_SUPPORT == 1 - bspBatteryHandler(); -#else - bspEmptyBatteryHandler(); -#endif // BSP_MNZB_EVB_SUPPORT == 1 - } - if (bspTaskFlags) - { - SYS_PostTask(BSP_TASK_ID); - } -} - -#else // APP_DISABLE_BSP != 1 - -void BSP_TaskHandler(void) -{ - if (bspTaskFlags & BSP_TEMPERATURE) - { - bspTaskFlags &= (~BSP_TEMPERATURE); - bspTemperatureSensorHandler(); - } - if (bspTaskFlags & BSP_LIGHT) - { - bspTaskFlags &= (~BSP_LIGHT); - bspLightSensorHandler(); - } - if (bspTaskFlags & BSP_BATTERY) - { - bspTaskFlags &= (~BSP_BATTERY); - bspEmptyBatteryHandler(); - } - if (bspTaskFlags) - { - SYS_PostTask(BSP_TASK_ID); - } -} - -#endif // APP_DISABLE_BSP != 1 - -// eof bspTaskManager.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/buttons.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/buttons.c deleted file mode 100644 index 8867a82b..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/buttons.c +++ /dev/null @@ -1,239 +0,0 @@ -/**************************************************************************//** -\file buttons.c - -\brief Implementation of buttons 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: - 30/05/08 A. Khromykh - Created -*******************************************************************************/ -#if APP_DISABLE_BSP != 1 - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include -#include -#include -#include - -/****************************************************************************** - Define(s) section -******************************************************************************/ -#define BSP_readKEY0() GPIO_IRQ_6_read() -#define BSP_readKEY1() GPIO_IRQ_7_read() -#define PRESSED 1 -#define RELEASED 0 -#define BSP_BUTTONS_IDLE 0 -#define BSP_BUTTONS_BUSY 1 - -/****************************************************************************** - Types section -******************************************************************************/ -typedef struct -{ - uint8_t currentState0 : 1; - uint8_t currentState1 : 1; - uint8_t wasPressed0 : 1; - uint8_t wasPressed1 : 1; - uint8_t waitReleased0 : 1; - uint8_t waitReleased1 : 1; -} BSP_buttonsAction_t; - -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief HAL's event handlers about KEY 0 has changed state. -******************************************************************************/ -void bspKey0InterruptHandler(void); - -/**************************************************************************//** -\brief HAL's event handlers about KEY 1 has changed state. -******************************************************************************/ -void bspKey1InterruptHandler(void); - -/****************************************************************************** - Global variables section -******************************************************************************/ -static uint8_t state = BSP_BUTTONS_IDLE; -static volatile BSP_buttonsAction_t buttonsAction; -static BSP_ButtonsEventFunc_t bspButtonPressHandle; // callback -static BSP_ButtonsEventFunc_t bspButtonReleaseHandle; // callback - -/****************************************************************************** - Implementations section -******************************************************************************/ -/**************************************************************************//** -\brief Initializes buttons module. -******************************************************************************/ -static void bspInitButtons(void) -{ - HAL_RegisterIrq(IRQ_6, IRQ_LOW_LEVEL, bspKey0InterruptHandler); - HAL_RegisterIrq(IRQ_7, IRQ_LOW_LEVEL, bspKey1InterruptHandler); - - if (BSP_readKEY0()) - buttonsAction.currentState0 = RELEASED; - else - buttonsAction.currentState0 = PRESSED; - - if (BSP_readKEY1()) - buttonsAction.currentState1 = RELEASED; - else - buttonsAction.currentState1 = PRESSED; - - HAL_EnableIrq(IRQ_6); - HAL_EnableIrq(IRQ_7); -} - -/**************************************************************************//** -\brief Registers handlers for button events. - -\param[in] - pressed - the handler to process pressing the button -\param[in] - released - the handler to process releasing the button -\param[in] - bn - button number. -\return - BC_FAIL - buttons module is busy, \n - BC_SUCCESS in other case. -******************************************************************************/ -result_t BSP_OpenButtons(void (*pressed)(uint8_t bn), void (*released)(uint8_t bn)) -{ - if (state != BSP_BUTTONS_IDLE) - return BC_FAIL; - state = BSP_BUTTONS_BUSY; - bspButtonPressHandle = pressed; - bspButtonReleaseHandle = released; - bspInitButtons(); - return BC_SUCCESS; -}; - -/**************************************************************************//** -\brief Cancel buttons handlers. -\return - BC_FAIL - buttons module was not opened, \n - BC_SUCCESS in other case. -******************************************************************************/ -result_t BSP_CloseButtons(void) -{ - if (state != BSP_BUTTONS_BUSY) - return BC_FAIL; - HAL_UnregisterIrq(IRQ_6); - HAL_UnregisterIrq(IRQ_7); - bspButtonPressHandle = NULL; - bspButtonReleaseHandle = NULL; - state = BSP_BUTTONS_IDLE; - return BC_SUCCESS; -}; - -/**************************************************************************//** -\brief Reads state of buttons. - -\return - Current buttons state in a binary way. \n - Bit 0 defines state of the button 1, \n - bit 1 defines state of the button 2. -******************************************************************************/ -uint8_t BSP_ReadButtonsState(void) -{ - uint8_t state = 0; - - if (buttonsAction.currentState0) - state = 0x01; - - if (buttonsAction.currentState1) - state |= 0x02; - - return state; -} - -/**************************************************************************//** -\brief HAL's event about KEY has changed state. -******************************************************************************/ -void bspKey0InterruptHandler(void) -{ - HAL_DisableIrq(IRQ_6); - buttonsAction.currentState0 = PRESSED; - buttonsAction.wasPressed0 = 1; - bspPostTask(BSP_BUTTONS); -} - -/**************************************************************************//** -\brief HAL's event about KEY has changed state. -******************************************************************************/ -void bspKey1InterruptHandler(void) -{ - HAL_DisableIrq(IRQ_7); - buttonsAction.currentState1 = PRESSED; - buttonsAction.wasPressed1 = 1; - bspPostTask(BSP_BUTTONS); -} - -/**************************************************************************//** -\brief BSP's event about KEY has changed state. -******************************************************************************/ -void bspButtonsHandler(void) -{ - if (buttonsAction.wasPressed0) - { - buttonsAction.wasPressed0 = 0; - buttonsAction.waitReleased0 = 1; - if (NULL != bspButtonPressHandle) - bspButtonPressHandle(BSP_KEY0); - } - - if (buttonsAction.waitReleased0) - { - if (BSP_readKEY0()) - { - buttonsAction.waitReleased0 = 0; - buttonsAction.currentState0 = RELEASED; - if (NULL != bspButtonReleaseHandle) - bspButtonReleaseHandle(BSP_KEY0); - HAL_EnableIrq(IRQ_6); - } - else - { - bspPostTask(BSP_BUTTONS); - } - } - - if (buttonsAction.wasPressed1) - { - buttonsAction.wasPressed1 = 0; - buttonsAction.waitReleased1 = 1; - if (NULL != bspButtonPressHandle) - bspButtonPressHandle(BSP_KEY1); - } - - if (buttonsAction.waitReleased1) - { - if (BSP_readKEY1()) - { - buttonsAction.waitReleased1 = 0; - buttonsAction.currentState1 = RELEASED; - if (NULL != bspButtonReleaseHandle) - bspButtonReleaseHandle(BSP_KEY1); - HAL_EnableIrq(IRQ_7); - } - else - { - bspPostTask(BSP_BUTTONS); - } - } -} - -#endif // APP_DISABLE_BSP != 1 - -// end of buttons.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/fakeBSP.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/fakeBSP.c deleted file mode 100644 index 77aa9c51..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/fakeBSP.c +++ /dev/null @@ -1,359 +0,0 @@ -/***************************************************************************//** -\file fakeBSP.c - -\brief Implementation of fake board-specific periphery. - -\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: - 28/04/11 A. Malkin - Created -*******************************************************************************/ - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include - -/****************************************************************************** - Global variables section -******************************************************************************/ -#if (APP_DISABLE_BSP == 1) || (BSP_MNZB_EVB_SUPPORT != 1) -void(* readBatteryDataCallback)(int16_t data); -#endif //(APP_DISABLE_BSP == 1) || (BSP_MNZB_EVB_SUPPORT != 1) -#if APP_DISABLE_BSP == 1 -void(* readTemperatureDataCallback)(bool error, int16_t data); -void(* readLightDataCallback)(bool error, int16_t data); - -/****************************************************************************** - Implementations section -******************************************************************************/ -/****************************************************************************** - Buttons -******************************************************************************/ -/**************************************************************************//** -\brief Registers handlers for button events. - -\param[in] - pressed - the handler to process pressing the button -\param[in] - released - the handler to process releasing the button -\param[in] - bn - button number. - -\return - BC_SUCCESS - always. -******************************************************************************/ -result_t BSP_OpenButtons(void (*pressed)(uint8_t bn), void (*released)(uint8_t bn)) -{ - (void)pressed; - (void)released; - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Cancel buttons handlers. - -\return - BC_SUCCESS - always. -******************************************************************************/ -result_t BSP_CloseButtons(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Reads state of buttons. - -\return - Current buttons state in a binary way. \n - Bit 0 defines state of the button 1, \n - bit 1 defines state of the button 2. -******************************************************************************/ -uint8_t BSP_ReadButtonsState(void) -{ - return 0; -} - -/****************************************************************************** - Sensors -******************************************************************************/ -/***************************************************************************//** -\brief Opens temperature sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_OpenTemperatureSensor(void) -{ - return BC_SUCCESS; -} - -/***************************************************************************//** -\brief Closes the temperature sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_CloseTemperatureSensor(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Reads data from the temperature 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_SUCCESS - always. -******************************************************************************/ -result_t BSP_ReadTemperatureData(void (*f)(bool result, int16_t data)) -{ - readTemperatureDataCallback = f; - - bspPostTask(BSP_TEMPERATURE); - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP task handler for temperature sensor. -******************************************************************************/ -void bspTemperatureSensorHandler(void) -{ - readTemperatureDataCallback(true, 0); -} - -/***************************************************************************//** -\brief Opens the light sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_OpenLightSensor(void) -{ - return BC_SUCCESS; -} - -/***************************************************************************//** -\brief Closes the light sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_CloseLightSensor(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Reads data from the light 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_SUCCESS - always. -******************************************************************************/ -result_t BSP_ReadLightData(void (*f)(bool result, int16_t data)) -{ - readLightDataCallback = f; - - bspPostTask(BSP_LIGHT); - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP task handler for light sensor. -******************************************************************************/ -void bspLightSensorHandler(void) -{ - readLightDataCallback(true, 0); -} - -/****************************************************************************** - Leds -******************************************************************************/ -/**************************************************************************//** -\brief Opens leds module to use. - -\return - operation state -******************************************************************************/ -result_t BSP_OpenLeds(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Closes leds module. - -\return - operation state -******************************************************************************/ -result_t BSP_CloseLeds(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Turns on the LED. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_OnLed(uint8_t id) -{ - (void)id; -} - -/**************************************************************************//** -\brief Turns off the LED. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_OffLed(uint8_t id) -{ - (void)id; -} - -/**************************************************************************//** -\brief Changes the LED state to opposite. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_ToggleLed(uint8_t id) -{ - (void)id; -} - -/****************************************************************************** - Sliders -******************************************************************************/ -/**************************************************************************//** -\brief Reads the sliders. - -\return - state of 3 on-board DIP-switches.User can uses SLIDER0, SLIDER1, SLIDER2 - defines to test state. Value 1 indicates that slider is on. -******************************************************************************/ -uint8_t BSP_ReadSliders(void) -{ - return 0; -} - -#endif // APP_DISABLE_BSP == 1 - -/****************************************************************************** - Joystick -******************************************************************************/ -/****************************************************************************** -\brief Registers handler for joystick events. - -\param[in] - state - joystick state. - -\return - BC_FAIL - joystick module is busy, - BC_SUCCESS in other cases. -******************************************************************************/ -result_t BSP_OpenJoystick(void (*generalHandler)(BSP_JoystickState_t state)) -{ - (void)generalHandler; - - return BC_SUCCESS; -} - -/****************************************************************************** -\brief Cancel joystick handlers. - -\return - BC_FAIL - joystick module was not opened, - BC_SUCCESS in other cases. -******************************************************************************/ -result_t BSP_CloseJoystick(void) -{ - return BC_SUCCESS; -} - -/****************************************************************************** -\brief Reads state of joystick. - -\return - Current joystick state. -******************************************************************************/ -BSP_JoystickState_t BSP_ReadJoystickState(void) -{ - return 0; -} - -#if (APP_DISABLE_BSP == 1) || (BSP_MNZB_EVB_SUPPORT != 1) -/***************************************************************************//** -\brief Opens the battery sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_OpenBatterySensor(void) -{ - return BC_SUCCESS; -} - -/***************************************************************************//** -\brief Closes the battery sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_CloseBatterySensor(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Reads data from battery sensor. - -\param[in] - data - sensor data. - -\return - BC_SUCCESS - always. -******************************************************************************/ -result_t BSP_ReadBatteryData(void (*f)(int16_t data)) -{ - readBatteryDataCallback = f; - - bspPostTask(BSP_BATTERY); - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP task handler for battery sensor. -******************************************************************************/ -void bspEmptyBatteryHandler(void) -{ - readBatteryDataCallback(0); -} -#endif //(APP_DISABLE_BSP == 1) || (BSP_MNZB_EVB_SUPPORT != 1) - -// eof fakeBSP.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/leds.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/leds.c deleted file mode 100644 index d03e7154..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/leds.c +++ /dev/null @@ -1,139 +0,0 @@ -/***************************************************************************//** -\file leds.c - -\brief The module to access to the leds. - -\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 -*******************************************************************************/ -#if APP_DISABLE_BSP != 1 - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include - -/****************************************************************************** - Implementations section -******************************************************************************/ -/**************************************************************************//** -\brief Inits LEDs control module. -******************************************************************************/ -static void initLeds(void) -{ - halInitRedLed(); - halInitYellowLed(); - halInitGreenLed(); -} - -/**************************************************************************//** -\brief Opens leds module to use. - -\return - operation state -******************************************************************************/ -result_t BSP_OpenLeds(void) -{ - initLeds(); -#if BSP_MNZB_EVB_SUPPORT == 1 - bspOnPeriphery(SENSOR_LED); -#endif /* BSP_MNZB_EVB_SUPPORT */ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Closes leds module. - -\return - operation state -******************************************************************************/ -result_t BSP_CloseLeds(void) -{ -#if BSP_MNZB_EVB_SUPPORT == 1 - bspOffPeriphery(SENSOR_LED); -#endif /* BSP_MNZB_EVB_SUPPORT */ - halUnInitRedLed(); - halUnInitYellowLed(); - halUnInitGreenLed(); - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Turns on the LED. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_OnLed(uint8_t id) -{ - switch (id) - { - case LED_RED: - halOnRedLed(); - break; - case LED_GREEN: - halOnGreenLed(); - break; - case LED_YELLOW: - halOnYellowLed(); - break; - } -} - -/**************************************************************************//** -\brief Turns off the LED. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_OffLed(uint8_t id) -{ - switch (id) - { - case LED_RED: - halOffRedLed(); - break; - case LED_GREEN: - halOffGreenLed(); - break; - case LED_YELLOW: - halOffYellowLed(); - break; - } -} - -/**************************************************************************//** -\brief Changes the LED state to opposite. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_ToggleLed(uint8_t id) -{ - switch (id) - { - case LED_RED: - halToggleRedLed(); - break; - case LED_GREEN: - halToggleGreenLed(); - break; - case LED_YELLOW: - halToggleYellowLed(); - break; - } -} - -#endif // APP_DISABLE_BSP != 1 - -// eof leds.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/lm73.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/lm73.c deleted file mode 100644 index bc31454f..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/lm73.c +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************//** -\file lm73.c - -\brief This module provides access to lm73 the sensor. \n - Continues conversion released only. - -\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 -******************************************************************************/ -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include - -/****************************************************************************** - Define(s) section -******************************************************************************/ -// device address on i2c bus -#define LM73_DEVICE_ADDRESS (0x92 >> 1) - -// device registers internal address -#define LM73_DATA_REGISTER 0x00 -#define LM73_CONFIGURATION_REGISTER 0x01 -#define LM73_UPPER_LIMIT_REGISTER 0x02 -#define LM73_LOWER_LIMIT_REGISTER 0x03 -#define LM73_CONTROL_STATUS_REGISTER 0x04 -#define LM73_IDENTIFICATION_REGISTER 0x07 - -/****************************************************************************** - Types section -******************************************************************************/ -// states -typedef enum -{ - IDLE, // idle - DATA // performs request -} Lm73States_t; - -typedef struct -{ - int32_t lm73Data; // Contains the result of sampling - bool lm73Result; // Result of operation. true - there are no errors, false - in other case. - void(* lm73Callback)(bool error, int16_t data); // callback -} Lm73Control_t; - -/****************************************************************************** - Global variables section -******************************************************************************/ -Lm73States_t lm73State = IDLE; // Monitors current state -Lm73Control_t lm73Control; - -/****************************************************************************** - Implementations 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) -{ - if (IDLE == lm73State) - return BC_SUCCESS; - - return BC_FAIL; -} - -/**************************************************************************//** -\brief Performs the test if the component have completed request. - -\return - BC_FAIL - the previous request is not completed. \n - BC_SUCCESS - otherwise. -******************************************************************************/ -result_t closeLm73(void) -{ - if (IDLE == lm73State) - return BC_SUCCESS; - - return BC_FAIL; -} - -/**************************************************************************//** -\brief The notice on that the packet has been read. - -\param[in] - result - the result of operation -******************************************************************************/ -void lm73I2cPacketReadDone(bool result) -{ - int16_t i; - - lm73Control.lm73Result = result; // stores the result of operation - if (false == lm73Control.lm73Result) - { // there were some errors on the i2c interface - lm73Control.lm73Data = 0; - bspPostTask(BSP_TEMPERATURE); - return; - } - - if (DATA == lm73State) - { - i = (uint8_t)lm73Control.lm73Data; - i <<= 8; - i |= ((lm73Control.lm73Data >> 8) & 0x00FF); - lm73Control.lm73Data = (i >> 7); - bspPostTask(BSP_TEMPERATURE); - } -} - -/**************************************************************************//** -\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. \n - BC_SUCCESS - other case. -******************************************************************************/ -result_t readLm73Data(void (*f)(bool result, int16_t data)) -{ - HAL_i2cMode_t i2cMode; - HAL_I2cParams_t i2cParam; - - if (IDLE != lm73State) - return BC_FAIL; - - if (!f) - return BC_FAIL; - - i2cMode.clockrate = I2C_CLOCK_RATE_62; - if (-1 == HAL_OpenI2cPacket(&i2cMode)) - return BC_FAIL; - lm73State = DATA; - lm73Control.lm73Callback = f; - - i2cParam.data = (uint8_t*)(&lm73Control.lm73Data); - i2cParam.f = lm73I2cPacketReadDone; - i2cParam.id = LM73_DEVICE_ADDRESS; - i2cParam.length = 2; - i2cParam.lengthAddr = HAL_NO_INTERNAL_ADDRESS; - - if (-1 == HAL_ReadI2cPacket(&i2cParam)) - { - lm73State = IDLE; - HAL_CloseI2cPacket(); - return BC_FAIL; - } - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP task handler. -******************************************************************************/ -void bspLM73Handler(void) -{ - HAL_CloseI2cPacket(); // free - lm73State = IDLE; - lm73Control.lm73Callback(lm73Control.lm73Result, lm73Control.lm73Data); -} - -// eof lm73.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/pwrCtrl.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/pwrCtrl.c deleted file mode 100644 index 305b80a2..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/pwrCtrl.c +++ /dev/null @@ -1,91 +0,0 @@ -/***************************************************************************//** -\file pwrCtrl.c - -\brief The module to control the power on periphery. - -\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 -*******************************************************************************/ -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include - -#if BSP_MNZB_EVB_SUPPORT == 1 -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief Checks if amplifier is used. -\return true - is used, \n - false - is not used. -******************************************************************************/ -bool HAL_IsAmplifierUsed(void); - -/****************************************************************************** - Global variables section -******************************************************************************/ -uint8_t bspPowerControl = 0; - -/****************************************************************************** - Implementations section -******************************************************************************/ -/**************************************************************************//** -\brief Powers on periphery. - -\param[in] - id - periphery id. -******************************************************************************/ -void bspOnPeriphery(uint8_t id) -{ - if (!bspPowerControl) - { - GPIO_8_make_out(); - - if (HAL_IsAmplifierUsed()) - GPIO_8_clr(); - else - GPIO_8_set(); - - GPIO_7_make_out(); - GPIO_7_set(); - } - bspPowerControl |= (1 << id); -} - - -/**************************************************************************//** -\brief Powers off periphery. - -\param[in] - id - periphery id. -******************************************************************************/ -void bspOffPeriphery(uint8_t id) -{ - bspPowerControl &= ~(1 << id); - if (bspPowerControl) - return; - - GPIO_8_make_out(); - - if (HAL_IsAmplifierUsed()) - GPIO_8_set(); - else - GPIO_8_clr(); - - GPIO_7_make_out(); - GPIO_7_clr(); -} - -#endif /* BSP_MNZB_EVB_SUPPORT */ -// eof pwrCtrl.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/sensors.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/sensors.c deleted file mode 100644 index 7e0eae1c..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/sensors.c +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************//** -\file sensors.h - -\brief Implementation of 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: - 12/05/08 A. Khromykh - Created -*******************************************************************************/ -#if APP_DISABLE_BSP != 1 - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include -#include -#include - -/****************************************************************************** - Implementations section -******************************************************************************/ -/***************************************************************************//** -\brief Opens temperature sensor. - -\return - BC_FAIL - sensor has been already open. \n - BC_SUCCESS - otherwise. -*******************************************************************************/ -result_t BSP_OpenTemperatureSensor(void) -{ - result_t result; - - if (BC_SUCCESS == (result = openLm73())) - { -#if BSP_MNZB_EVB_SUPPORT == 1 - bspOnPeriphery(SENSOR_TEMPERATURE); -#endif /* BSP_MNZB_EVB_SUPPORT */ - } - return result; -} - -/***************************************************************************//** -\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) -{ - result_t result; - - if (BC_SUCCESS == (result = closeLm73())) - { -#if BSP_MNZB_EVB_SUPPORT == 1 - bspOffPeriphery(SENSOR_TEMPERATURE); -#endif /* BSP_MNZB_EVB_SUPPORT */ - } - return result; -} - -/**************************************************************************//** -\brief Reads data from the temperature 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 - previous request was not completed. \n - BC_SUCCESS - otherwise. -******************************************************************************/ -result_t BSP_ReadTemperatureData(void (*f)(bool result, int16_t data)) -{ - return readLm73Data(f); -} - -/***************************************************************************//** -\brief Opens the light sensor. -\return - BC_FAIL - sensor has been already open. \n - BC_SUCCESS - otherwise. -*******************************************************************************/ -result_t BSP_OpenLightSensor(void) -{ - result_t result; - - if (BC_SUCCESS == (result = openTsl2550())) - { -#if BSP_MNZB_EVB_SUPPORT == 1 - bspOnPeriphery(SENSOR_LIGHT); -#endif /* BSP_MNZB_EVB_SUPPORT */ - } - return result; -} - -/***************************************************************************//** -\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) -{ - result_t result; - - if (BC_SUCCESS == (result = closeTsl2550())) - { -#if BSP_MNZB_EVB_SUPPORT == 1 - bspOffPeriphery(SENSOR_LIGHT); -#endif /* BSP_MNZB_EVB_SUPPORT */ - } - return result; -} - -/**************************************************************************//** -\brief Reads data from the light 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 - previous request was not completed. \n - BC_SUCCESS - otherwise. -******************************************************************************/ -result_t BSP_ReadLightData(void (*f)(bool result, int16_t data)) -{ - return readTsl2550Data(f); -} - -#if BSP_MNZB_EVB_SUPPORT == 1 -/***************************************************************************//** -\brief Opens the battery sensor. -\return - BC_FAIL - sensor has been already open. \n - BC_SUCCESS - otherwise. -*******************************************************************************/ -result_t BSP_OpenBatterySensor(void) -{ - result_t result; - - if (BC_SUCCESS == (result = openBattery())) - { - bspOnPeriphery(SENSOR_BATTERY); - } - return result; -} - -/***************************************************************************//** -\brief Closes the battery sensor. -\return - BC_FAIL - sensor was not opened. \n - BC_SUCCESS - otherwise. -*******************************************************************************/ -result_t BSP_CloseBatterySensor(void) -{ - result_t result; - - if (BC_SUCCESS == (result = closeBattery())) - { - bspOffPeriphery(SENSOR_BATTERY); - } - return result; -} - -/**************************************************************************//** -\brief Reads data from battery sensor. -\param[in] - data - sensor data. -\return - BC_FAIL - previous request was not completed, or sensor was not opened. \n - BC_SUCCESS - otherwise. -******************************************************************************/ -result_t BSP_ReadBatteryData(BspBatteryCb_t cb) -{ - return readBatteryData(cb); -} -#endif /* BSP_MNZB_EVB_SUPPORT */ - -#endif // APP_DISABLE_BSP != 1 - -//end of sensors.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/sliders.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/sliders.c deleted file mode 100644 index db417cdb..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/sliders.c +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************//** -\file sliders.h - -\brief Implementation of the sliders. - -\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 -******************************************************************************/ -#if APP_DISABLE_BSP != 1 - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include - -/****************************************************************************** - Implementations section -******************************************************************************/ -/**************************************************************************//** -\brief Reads the sliders. - -\return - state of 3 on­board DIP­switches.User can uses SLIDER0, SLIDER1, SLIDER2 - defines to test state. Value 1 indicates that slider is on. -******************************************************************************/ -uint8_t BSP_ReadSliders(void) -{ - uint8_t result; - - GPIO_3_make_in(); GPIO_3_make_pullup(); - GPIO_4_make_in(); GPIO_4_make_pullup(); - GPIO_5_make_in(); GPIO_5_make_pullup(); - /* NOP was added for correct work on 8 MHz frequency. - clck i\o is not equal clck cpu. - CPU must wait for I\O system 1 clock for synchronization. */ - NOP; - result = GPIO_3_read() * SLIDER0; - result |= GPIO_4_read() * SLIDER1; - result |= GPIO_5_read() * SLIDER2; - GPIO_3_make_in(); - GPIO_4_make_in(); - GPIO_5_make_in(); - - return (~result) & 0x07; -} - -#endif // APP_DISABLE_BSP != 1 - -// end of sliders.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/tsl2550.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/tsl2550.c deleted file mode 100644 index 9011c6fd..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/tsl2550.c +++ /dev/null @@ -1,457 +0,0 @@ -/**************************************************************************//** -\file tsl2550.c - -\brief Implementation of access to tsl2550 the sensor, light 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 -******************************************************************************/ -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include -#include -#include - -/****************************************************************************** - Definitions section -******************************************************************************/ -// device address on i2c bus -#define TSL_DEVICE_ADDRESS 0x39 - -// device registers internal address -#define TSL_READ_CHANNEL0_COMMAND 0x43 -#define TSL_READ_CHANNEL1_COMMAND 0x83 -#define TSL_POWERDOWN_COMMAND 0x00 -#define TSL_POWERUP_COMMAND 0x03 -#define TSL_EXTENDED_RANGE_COMMAND 0x1D -#define TSL_STANDARD_RANGE_COMMAND 0x18 - -// standard mode max -#define TSL_MAX_LUX_VALUE 1846 - -// Conversion time (400ms typ by datasheet). Choose a little more to be on a safe side. -#define TSL_CONVERSION_TIME 500 - -/****************************************************************************** - Types section -******************************************************************************/ -// states -typedef enum -{ - OFF, - IDLE, - POWERUP, - POWERUP_ERR, - DATA, - DATA_ERR, -} Tsl2550States_t; - -typedef struct -{ - Tsl2550States_t state; - uint8_t ch0; - uint8_t ch1; - void(* callback)(bool result, int16_t data); // data callback pointer -} Tsl2550Control_t; - -/****************************************************************************** - Constants section -******************************************************************************/ -PROGMEM_DECLARE(const uint8_t tsl2550Ratio[129]) = -{ -100,100,100,100,100,100,100,100, -100,100,100,100,100,100, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 98, 98, 98, 98, 98, - 98, 98, 97, 97, 97, 97, 97, 96, - 96, 96, 96, 95, 95, 95, 94, 94, - 93, 93, 93, 92, 92, 91, 91, 90, - 89, 89, 88, 87, 87, 86, 85, 84, - 83, 82, 81, 80, 79, 78, 77, 75, - 74, 73, 71, 69, 68, 66, 64, 62, - 60, 58, 56, 54, 52, 49, 47, 44, - 42, 41, 40, 40, 39, 39, 38, 38, - 37, 37, 37, 36, 36, 36, 35, 35, - 35, 35, 34, 34, 34, 34, 33, 33, - 33, 33, 32, 32, 32, 32, 32, 31, - 31, 31, 31, 31, 30, 30, 30, 30, - 30 -}; - -PROGMEM_DECLARE(const uint16_t tsl2550Count[128]) = -{ - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 18, 20, 22, 24, 26, 28, 30, - 32, 34, 36, 38, 40, 42, 44, 46, - 49, 53, 57, 61, 65, 69, 73, 77, - 81, 85, 89, 93, 97, 101, 105, 109, - 115, 123, 131, 139, 147, 155, 163, 171, - 179, 187, 195, 203, 211, 219, 227, 235, - 247, 263, 279, 295, 311, 327, 343, 359, - 375, 391, 407, 423, 439, 455, 471, 487, - 511, 543, 575, 607, 639, 671, 703, 735, - 767, 799, 831, 863, 895, 927, 959, 991, -1039,1103,1167,1231,1295,1359,1423,1487, -1551,1615,1679,1743,1807,1871,1935,1999, -2095,2223,2351,2479,2607,2735,2863,2991, -3119,3247,3375,3503,3631,3759,3887,4015 -}; - -/****************************************************************************** - Static function prototypes section -******************************************************************************/ -static bool tsl2550StartReading(void); -static void tsl2550StartFirstReading(void); -static void tsl2550I2cPacketReadDoneCh1(bool result); -static void tsl2550I2cPacketWriteDoneCh1(bool result); -static void tsl2550I2cPacketReadDoneCh0(bool result); -static void tsl2550I2cPacketWriteDoneCh0(bool result); -static void tsl2550I2cPowerupDone(bool result); -static bool tsl2550StartPowerup(void); - -/****************************************************************************** - Implementations section -******************************************************************************/ - -static Tsl2550Control_t tsl2550Control = {.state = OFF}; - -/**************************************************************************//** -\brief Opens the component to use. - -\return - BC_SUCCESS - the component is ready to be used. \n - BC_FAIL - otherwise. -******************************************************************************/ -result_t openTsl2550(void) -{ - if (IDLE == tsl2550Control.state || OFF == tsl2550Control.state) - return BC_SUCCESS; - - return BC_FAIL; -} - -/**************************************************************************//** -\brief Performs the test if the component have completed request. - -\return - BC_FAIL - the previous request is not completed. \n - BC_SUCCES - otherwise. -******************************************************************************/ -result_t closeTsl2550(void) -{ - if (IDLE == tsl2550Control.state || OFF == tsl2550Control.state) - return BC_SUCCESS; - - return BC_FAIL; -} - -/**************************************************************************//** -\brief Reads data from tsl2550 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. \n - BC_SUCCESS - in other case. -******************************************************************************/ -result_t readTsl2550Data(void (*f)(bool result, int16_t data)) -{ - HAL_i2cMode_t i2cMode = {.clockrate = I2C_CLOCK_RATE_62}; - - if (NULL == f) - return BC_FAIL; - - if (OFF == tsl2550Control.state) // Sensor is in powerdown mode, powerup it before reading - { - if (-1 == HAL_OpenI2cPacket(&i2cMode)) - return BC_FAIL; - - if (false == tsl2550StartPowerup()) - { - HAL_CloseI2cPacket(); - return BC_FAIL; - } - tsl2550Control.state = POWERUP; - } - else if (IDLE == tsl2550Control.state) - { - if (-1 == HAL_OpenI2cPacket(&i2cMode)) - return BC_FAIL; - - if (false == tsl2550StartReading()) - { - HAL_CloseI2cPacket(); - return BC_FAIL; - } - tsl2550Control.state = DATA; - } - else - { - return BC_FAIL; - } - - tsl2550Control.callback = f; - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP tsl2550 handler. -******************************************************************************/ -void bspTsl2550Handler(void) -{ - uint8_t result = false; - uint16_t lux = 0; - - HAL_CloseI2cPacket(); // free - - switch (tsl2550Control.state) - { - case POWERUP_ERR: - tsl2550Control.state = OFF; - break; - - case DATA_ERR: - tsl2550Control.state = IDLE; - break; - - case DATA: - { - uint32_t count0 = 0, count1 = 0; - uint8_t ratio = 128; // default scaling factor - uint8_t R; - - tsl2550Control.state = IDLE; - - if (tsl2550Control.ch0 & tsl2550Control.ch1 & 0x80) - { - memcpy_P(&count0, &tsl2550Count[tsl2550Control.ch0 & 0x7F], sizeof(uint16_t)); - memcpy_P(&count1, &tsl2550Count[tsl2550Control.ch1 & 0x7F], sizeof(uint16_t)); - - if (!count0 || (count0 <= count1)) // count1 cannot be greater than count0 - break; - - ratio = ((uint32_t)(count1 * 128ul) / count0); - // calculate lux - // the "256" is a scaling factor - memcpy_P(&R, &tsl2550Ratio[ratio], sizeof(uint8_t)); - lux = ((count0 - count1) * R) / 256; - // range check lux - if (lux > TSL_MAX_LUX_VALUE) - lux = TSL_MAX_LUX_VALUE; - - result = true; - } - } - break; - - default: - ASSERT(false, TSL2550_UNEXPECTED_STATE); - tsl2550Control.state = IDLE; - break; - } - - tsl2550Control.callback(result, lux); -} - -/**************************************************************************//** -\brief Callback that reading from tsl2550 was completed. - -\param[in] - result - contains result of operation. - if result is false there was problem on i2c interface. -******************************************************************************/ -static void tsl2550I2cPacketReadDoneCh1(bool result) -{ - if (false == result) - tsl2550Control.state = DATA_ERR; - - bspPostTask(BSP_LIGHT); -} - -/**************************************************************************//** -\brief Callback that writing command to tsl2550 was completed. - -\param[in] - result - contains result of operation. - if result is false there was problem on i2c interface. -******************************************************************************/ -static void tsl2550I2cPacketWriteDoneCh1(bool result) -{ - HAL_I2cParams_t i2cParam = - { - .data = &tsl2550Control.ch1, - .f = tsl2550I2cPacketReadDoneCh1, - .id = TSL_DEVICE_ADDRESS, - .length = 1, - .lengthAddr = HAL_NO_INTERNAL_ADDRESS, - }; - - if ((false == result) || (-1 == HAL_ReadI2cPacket(&i2cParam))) - { - tsl2550Control.state = DATA_ERR; - bspPostTask(BSP_LIGHT); - } -} - -/**************************************************************************//** -\brief Callback that reading from tsl2550 was completed. - -\param[in] - result - contains result of operation. - if result is false there was problem on i2c interface. -******************************************************************************/ -static void tsl2550I2cPacketReadDoneCh0(bool result) -{ - HAL_I2cParams_t i2cParam = - { - .data = &tsl2550Control.ch1, - .f = tsl2550I2cPacketWriteDoneCh1, - .id = TSL_DEVICE_ADDRESS, - .length = 1, - .lengthAddr = HAL_NO_INTERNAL_ADDRESS, - }; - - tsl2550Control.ch1 = TSL_READ_CHANNEL1_COMMAND; - - if ((false == result) || (-1 == HAL_WriteI2cPacket(&i2cParam))) - { - tsl2550Control.state = DATA_ERR; - bspPostTask(BSP_LIGHT); - } -} - -/**************************************************************************//** -\brief Callback that writing command to tsl2550 was completed. - -\param[in] - result - contains result of operation. - if result is false there was problem on i2c interface. -******************************************************************************/ -static void tsl2550I2cPacketWriteDoneCh0(bool result) -{ - HAL_I2cParams_t i2cParam = - { - .data = &tsl2550Control.ch0, - .f = tsl2550I2cPacketReadDoneCh0, - .id = TSL_DEVICE_ADDRESS, - .length = 1, - .lengthAddr = HAL_NO_INTERNAL_ADDRESS, - }; - - if ((false == result) || (-1 == HAL_ReadI2cPacket(&i2cParam))) - { - tsl2550Control.state = DATA_ERR; - bspPostTask(BSP_LIGHT); - } -} - -/**************************************************************************//** -\brief Start tsl2550 read sequence. - -\return - false - i2c packet wasn't sent - true - in other case. -******************************************************************************/ -static bool tsl2550StartReading(void) -{ - HAL_I2cParams_t i2cParam = - { - .data = &tsl2550Control.ch0, - .f = tsl2550I2cPacketWriteDoneCh0, - .id = TSL_DEVICE_ADDRESS, - .length = 1, - .lengthAddr = HAL_NO_INTERNAL_ADDRESS, - }; - - tsl2550Control.ch0 = TSL_READ_CHANNEL0_COMMAND; - - return (-1 != HAL_WriteI2cPacket(&i2cParam)) ? true : false; -} - -/**************************************************************************//** -\brief Callback on completion of tsl2550's delay after powerup. -******************************************************************************/ -static void tsl2550StartFirstReading(void) -{ - if (false == tsl2550StartReading()) - { - tsl2550Control.state = DATA_ERR; - bspPostTask(BSP_LIGHT); - return; - } - - tsl2550Control.state = DATA; -} - -/**************************************************************************//** -\brief Callback on completion of tsl2550 powerup. - -\param[in] - result - contains result of operation. - if result is false there was problem on i2c interface. -******************************************************************************/ -static void tsl2550I2cPowerupDone(bool result) -{ - static HAL_AppTimer_t tsl2550PowerupTimer = - { - .interval = TSL_CONVERSION_TIME * 2, // Wait for conversions on two channels one-after-one - .mode = TIMER_ONE_SHOT_MODE, - .callback = tsl2550StartFirstReading, - }; - - if (false == result) - { - tsl2550Control.state = POWERUP_ERR; - bspPostTask(BSP_LIGHT); - return; - } - - HAL_StartAppTimer(&tsl2550PowerupTimer); -} - -/**************************************************************************//** -\brief Start tsl2550 powerup sequence. - -\return - false - i2c packet wasn't sent - true - in other case. -******************************************************************************/ -static bool tsl2550StartPowerup(void) -{ - HAL_I2cParams_t i2cParam = - { - .data = &tsl2550Control.ch0, - .f = tsl2550I2cPowerupDone, - .id = TSL_DEVICE_ADDRESS, - .length = 1, - .lengthAddr = HAL_NO_INTERNAL_ADDRESS, - }; - - tsl2550Control.ch0 = TSL_POWERUP_COMMAND; - - return (-1 != HAL_WriteI2cPacket(&i2cParam)) ? true : false; -} - -// eof tsl2550.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/Makefile b/digital/beacon/src/Bitcloud_stack/Components/BSP/Makefile deleted file mode 100644 index 0b972813..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/Makefile +++ /dev/null @@ -1,221 +0,0 @@ -COMPONENTS_PATH = .. -include $(MAKERULES) -include ./BoardConfig - -###### LIB ########## -ifeq ($(BOARD), BOARD_MESHBEAN) - BUILDDIR = ./MESHBEAN -else ifeq ($(BOARD), BOARD_RAVEN) - BUILDDIR = ./RAVEN -else ifeq ($(BOARD), BOARD_STK500) - BUILDDIR = ./ATML_STK500 -else ifeq ($(BOARD), BOARD_STK600) - BUILDDIR = ./ATML_STK600 -else ifeq ($(BOARD), BOARD_USB_DONGLE) - BUILDDIR = ./ATML_USB_DONGLE -else ifeq ($(BOARD), BOARD_MESHBEAN_LAN) - BUILDDIR = ./MESHBEAN_LAN -else ifeq ($(BOARD), BOARD_MESHBEAN_TURBO) - BUILDDIR = ./MESHBEAN_TURBO -else ifeq ($(BOARD), BOARD_SAM7X_EK) - BUILDDIR = ./ATML_SAM7X_EK -else ifeq ($(BOARD), BOARD_SAM3S_EK) - BUILDDIR = ./ATML_SAM3S_EK -else ifeq ($(BOARD), BOARD_SAM3S_EK) - BUILDDIR = ./RF231USBRD -else ifeq ($(BOARD), BOARD_CUSTOM_1) - BUILDDIR = ./CUSTOM_1 -else ifeq ($(BOARD), BOARD_CUSTOM_2) - BUILDDIR = ./CUSTOM_2 -else ifeq ($(BOARD), BOARD_CUSTOM_3) - BUILDDIR = ./CUSTOM_3 -else ifeq ($(BOARD), BOARD_RCB) - BUILDDIR = ./RCB -else ifeq ($(BOARD), BOARD_AVR32_EVK1105) - BUILDDIR = ./AVR32_EVK1105 -else ifeq ($(BOARD), BOARD_XPLAIN) - BUILDDIR = ./XPLAIN -else ifeq ($(BOARD), BOARD_REB_CBB) - BUILDDIR = ./REB_CBB -else ifeq ($(BOARD), BOARD_SIMULATOR) - BUILDDIR = ./SIMULATOR -else - $(error unknown BOARD) -endif - -# Compiler flags extending with "debug info" compiler flag. -CFLAGS += $(CFLAGS_DBG) - -# Hardware flags. -CFLAGS += $(CFLAGS_HW) - -LIBDIR = ./lib -LISTDIR = ./list -LDFLAGS = -L$(LIBDIR) -PROG = BSP.elf -LIBS = $(LIBDIR)/lib$(BSP_LIB).a - -##### PATHS FLAGS OF INCLUDES ######### -CFLAGS += -I$(BUILDDIR)/include -CFLAGS += -I$(BUILDDIR)/../include -CFLAGS += -I$(HAL_PATH)/include -CFLAGS += -I$(HAL_HWD_COMMON_PATH)/include -CFLAGS += -I$(SE_PATH)/include - -BSPFLAGS=$(CFLAGS) -ifeq ($(BOARD), BOARD_SAM7X_EK) - BSPFLAGS=$(patsubst %$(ARM_MODE_THUMBS_CFLAGS),,$(CFLAGS)) $(ARM_MODE_ARM_CFLAGS) - BSPFLAGS += -I$(FREE_RTOS_PATH)/ - BSPFLAGS += -I$(FREE_RTOS_PATH)/include -endif - -ifeq ($(BOARD), BOARD_MESHBEAN) -modules = \ - leds \ - pwrCtrl \ - bspTaskManager \ - buttons \ - lm73 \ - tsl2550 \ - battery \ - sliders \ - sensors \ - fakeBSP -else ifeq ($(BOARD), BOARD_RAVEN) -modules = \ - lcd \ - bspTaskManager \ - joystik \ - sipc \ - sensors \ - fakeBSP -else ifeq ($(BOARD), BOARD_STK500) -modules = \ - leds \ - pwrCtrl \ - bspTaskManager \ - buttons \ - battery \ - sliders \ - sensors \ - fakeBSP -else ifeq ($(BOARD), BOARD_STK600) -modules = \ - leds \ - buttons \ - bspTaskManager \ - fakeBSP -else ifeq ($(BOARD), BOARD_USB_DONGLE) -modules = \ - leds \ - bspTaskManager \ - fakeBSP -else ifeq ($(BOARD), BOARD_MESHBEAN_LAN) -modules = \ - leds \ - buttons \ - bspTaskManager \ - fakeBSP -else ifeq ($(BOARD), BOARD_MESHBEAN_TURBO) -modules = \ - leds \ - buttons \ - sliders \ - bspTaskManager \ - fakeBSP -else ifeq ($(BOARD), BOARD_SAM7X_EK) -modules = \ - leds \ - joystick \ - bspTaskManager \ - fakeBSP -else ifeq ($(BOARD), BOARD_SAM3S_EK) -modules = \ - leds \ - bspTaskManager \ - fakeBSP -else ifeq ($(BOARD), BOARD_RF231USBRD) -modules = \ - leds \ - bspTaskManager \ - fakeBSP -else ifeq ($(BOARD), BOARD_CUSTOM_1) -modules = \ - leds \ - buttons \ - hexSwitch \ - bspTaskManager \ - rs485Controller \ - fakeBSP -else ifeq ($(BOARD), BOARD_CUSTOM_2) -modules = \ - leds \ - buttons \ - hexSwitch \ - bspTaskManager \ - rs485Controller \ - usbController \ - fakeBSP -else ifeq ($(BOARD), BOARD_CUSTOM_3) -modules = \ - leds \ - bspTaskManager \ - fakeBSP -else ifeq ($(BOARD), BOARD_RCB) -modules = \ - leds \ - bspTaskManager \ - buttons \ - fakeBSP -else ifeq ($(BOARD), BOARD_AVR32_EVK1105) -modules = \ - leds \ - bspTaskManager \ - buttons \ - fakeBSP -else ifeq ($(BOARD), BOARD_XPLAIN) -modules = \ - leds \ - bspTaskManager \ - buttons \ - fakeBSP -else ifeq ($(BOARD), BOARD_REB_CBB) -modules = \ - leds \ - bspTaskManager \ - buttons \ - fakeBSP -else ifeq ($(BOARD), BOARD_SIMULATOR) -modules = \ - leds \ - bspTaskManager \ - fakeBSP -endif - - -objects = $(addsuffix .o,$(addprefix $(BUILDDIR)/objs/,$(modules))) -sources = $(addsuffix .c,$(addprefix $(BUILDDIR)/src/,$(modules))) - -###### TARGETS ################ -all: component_label LIB_BSP -component_label: - @echo - @echo ---------------------------------------------------- - @echo Board Support library creation. - @echo ---------------------------------------------------- - -################ -$(BUILDDIR)/objs/%.o: $(BUILDDIR)/src/%.c - $(CC) $(BSPFLAGS) $^ -o $@ - -################ -LIB_BSP : $(objects) - $(AR) $(AR_KEYS) $(LIBDIR)/lib$(BSP_LIB).a $(objects) - $(SIZE) -td $(LIBDIR)/lib$(BSP_LIB).a -################ -clean: - @echo - @echo ---------------------------------------------------- - @echo Board Support component cleaning. - @echo ---------------------------------------------------- - rm -f $(objects) $(LIBS) $(LISTDIR)/*.* diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/include/bspLeds.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/include/bspLeds.h deleted file mode 100644 index 8bfb459f..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/include/bspLeds.h +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************//** -\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: - 26.08.09 A. Taradov - Created -*******************************************************************************/ - -#ifndef _BSPLEDS_H -#define _BSPLEDS_H - -/****************************************************************************** - Includes section -******************************************************************************/ -// \cond -#include -#include -// \endcond - -/****************************************************************************** - Define(s) section -******************************************************************************/ - -#define halInitFirstLed() GPIO_E2_make_out() -#define halUnInitFirstLed() GPIO_E2_make_in() -#define halOnFirstLed() GPIO_E2_clr() -#define halOffFirstLed() GPIO_E2_set() -#define halReadFirstLed() GPIO_E2_read() -#define halToggleFirstLed() GPIO_E2_toggle() - -#define halInitSecondLed() GPIO_E3_make_out() -#define halUnInitSecondLed() GPIO_E3_make_in() -#define halOnSecondLed() GPIO_E3_clr() -#define halOffSecondLed() GPIO_E3_set() -#define halReadSecondLed() GPIO_E3_read() -#define halToggleSecondLed() GPIO_E3_toggle() - -#if (APP_USART_CHANNEL == USART_CHANNEL_USBFIFO) && defined(ATMEGA128RFA1) - -#define halInitThirdLed() -#define halUnInitThirdLed() -#define halOnThirdLed() -#define halOffThirdLed() -#define halReadThirdLed() -#define halToggleThirdLed() - -#else - -#define halInitThirdLed() GPIO_E4_make_out() -#define halUnInitThirdLed() GPIO_E4_make_in() -#define halOnThirdLed() GPIO_E4_clr() -#define halOffThirdLed() GPIO_E4_set() -#define halReadThirdLed() GPIO_E4_read() -#define halToggleThirdLed() GPIO_E4_toggle() - -#endif // APP_USART_CHANNEL == USART_CHANNEL_USBFIFO - -#endif /*_BSPLEDS_H*/ -// eof bspLeds.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/include/bspTaskManager.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/include/bspTaskManager.h deleted file mode 100644 index 2bd88abb..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/include/bspTaskManager.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************//** -\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: - 26.08.09 A. Taradov - 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/RCB/src/bspTaskManager.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/bspTaskManager.c deleted file mode 100644 index 65c80e55..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/bspTaskManager.c +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************//** -\file bspTaskManager.c - -\brief Implemenattion 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: - 26.08.09 A. Taradov - Created -******************************************************************************/ - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include - -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief BSP button handler. -******************************************************************************/ -void bspButtonsHandler(void); - -/**************************************************************************//** -\brief BSP temperature sensor handler. -******************************************************************************/ -void bspTemperatureSensorHandler(void); - -/**************************************************************************//** -\brief BSP light sensor handler. -******************************************************************************/ -void bspLightSensorHandler(void); - -/**************************************************************************//** -\brief BSP battery handler. -******************************************************************************/ -void bspEmptyBatteryHandler(void); - -/****************************************************************************** - Global variables section -******************************************************************************/ -volatile uint8_t bspTaskFlags = 0; - -/****************************************************************************** - Implementations section -******************************************************************************/ -/**************************************************************************//** -\brief BSP task handler. -******************************************************************************/ -void BSP_TaskHandler(void) -{ -#if APP_DISABLE_BSP != 1 - if (bspTaskFlags & BSP_BUTTONS) - { - bspTaskFlags &= ~BSP_BUTTONS; - bspButtonsHandler(); - } -#endif //APP_DISABLE_BSP != 1 - if (bspTaskFlags & BSP_TEMPERATURE) - { - bspTaskFlags &= (~BSP_TEMPERATURE); - bspTemperatureSensorHandler(); - } - if (bspTaskFlags & BSP_LIGHT) - { - bspTaskFlags &= (~BSP_LIGHT); - bspLightSensorHandler(); - } - if (bspTaskFlags & BSP_BATTERY) - { - bspTaskFlags &= (~BSP_BATTERY); - bspEmptyBatteryHandler(); - } - if (bspTaskFlags) - SYS_PostTask(BSP_TASK_ID); -} - -// eof bspTaskManager.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/buttons.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/buttons.c deleted file mode 100644 index 8139394a..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/buttons.c +++ /dev/null @@ -1,187 +0,0 @@ -/**************************************************************************//** -\file buttons.c - -\brief Implementation of buttons 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: - 21.08.09 A. Taradov - Created -*******************************************************************************/ -#if APP_DISABLE_BSP != 1 - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include -#include -#include -#include - -/****************************************************************************** - Define(s) section -******************************************************************************/ -#define BSP_readKEY0() GPIO_E5_read() -#define PRESSED 1 -#define RELEASED 0 -#define BSP_BUTTONS_IDLE 0 -#define BSP_BUTTONS_BUSY 1 - -/****************************************************************************** - Types section -******************************************************************************/ -typedef struct -{ - uint8_t currentState0 : 1; - uint8_t wasPressed0 : 1; - uint8_t waitReleased0 : 1; -} BSP_buttonsAction_t; - -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief HAL's event handlers about KEY 0 has changed state. -******************************************************************************/ -void bspKey0InterruptHandler(void); - -/****************************************************************************** - Global variables section -******************************************************************************/ -static uint8_t state = BSP_BUTTONS_IDLE; -static volatile BSP_buttonsAction_t buttonsAction; -static BSP_ButtonsEventFunc_t bspButtonPressHandle; // callback -static BSP_ButtonsEventFunc_t bspButtonReleaseHandle; // callback - -/****************************************************************************** - Implementations section -******************************************************************************/ -/**************************************************************************//** -\brief Initializes buttons module. -******************************************************************************/ -static void bspInitButtons(void) -{ - GPIO_E5_make_in(); - GPIO_E5_make_pullup(); - - HAL_RegisterIrq(IRQ_5, IRQ_LOW_LEVEL, bspKey0InterruptHandler); - - if (BSP_readKEY0()) - buttonsAction.currentState0 = RELEASED; - else - buttonsAction.currentState0 = PRESSED; - - HAL_EnableIrq(IRQ_5); -} - -/**************************************************************************//** -\brief Registers handlers for button events. - -\param[in] - pressed - the handler to process pressing the button -\param[in] - released - the handler to process releasing the button -\param[in] - bn - button number. -\return - BC_FAIL - buttons module is busy, \n - BC_SUCCESS in other case. -******************************************************************************/ -result_t BSP_OpenButtons(void (*pressed)(uint8_t bn), void (*released)(uint8_t bn)) -{ - if (state != BSP_BUTTONS_IDLE) - return BC_FAIL; - state = BSP_BUTTONS_BUSY; - bspButtonPressHandle = pressed; - bspButtonReleaseHandle = released; - bspInitButtons(); - return BC_SUCCESS; -}; - -/**************************************************************************//** -\brief Cancel buttons handlers. -\return - BC_FAIL - buttons module was not opened, \n - BC_SUCCESS in other case. -******************************************************************************/ -result_t BSP_CloseButtons(void) -{ - if (state != BSP_BUTTONS_BUSY) - return BC_FAIL; - HAL_UnregisterIrq(IRQ_5); - bspButtonPressHandle = NULL; - bspButtonReleaseHandle = NULL; - state = BSP_BUTTONS_IDLE; - return BC_SUCCESS; -}; - -/**************************************************************************//** -\brief Reads state of buttons. - -\return - Current buttons state in a binary way. \n - Bit 0 defines state of the button 1, \n - bit 1 defines state of the button 2. -******************************************************************************/ -uint8_t BSP_ReadButtonsState(void) -{ - uint8_t state = 0; - - if (buttonsAction.currentState0) - state = 0x01; - - return state; -} - -/**************************************************************************//** -\brief HAL's event about KEY has changed state. -******************************************************************************/ -void bspKey0InterruptHandler(void) -{ - HAL_DisableIrq(IRQ_5); - buttonsAction.currentState0 = PRESSED; - buttonsAction.wasPressed0 = 1; - bspPostTask(BSP_BUTTONS); -} - -/**************************************************************************//** -\brief BSP's event about KEY has changed state. -******************************************************************************/ -void bspButtonsHandler(void) -{ - if (buttonsAction.wasPressed0) - { - buttonsAction.wasPressed0 = 0; - buttonsAction.waitReleased0 = 1; - if (NULL != bspButtonPressHandle) - bspButtonPressHandle(BSP_KEY0); - } - - if (buttonsAction.waitReleased0) - { - if (BSP_readKEY0()) - { - buttonsAction.waitReleased0 = 0; - buttonsAction.currentState0 = RELEASED; - if (NULL != bspButtonReleaseHandle) - bspButtonReleaseHandle(BSP_KEY0); - HAL_EnableIrq(IRQ_5); - } - else - { - bspPostTask(BSP_BUTTONS); - } - } -} - -#endif // APP_DISABLE_BSP != 1 - -// end of buttons.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/fakeBSP.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/fakeBSP.c deleted file mode 100644 index b7454d82..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/fakeBSP.c +++ /dev/null @@ -1,356 +0,0 @@ -/***************************************************************************//** -\file fakeBSP.c - -\brief Implementation of fake board-specific periphery. - -\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: - 05/05/11 A. Malkin - Created -*******************************************************************************/ - -/****************************************************************************** - Includes section -******************************************************************************/ -#include -#include -#include - -/****************************************************************************** - Global variables section -******************************************************************************/ -void(* readTemperatureDataCallback)(bool error, int16_t data); -void(* readLightDataCallback)(bool error, int16_t data); -void(* readBatteryDataCallback)(int16_t data); - -#if APP_DISABLE_BSP == 1 - -/****************************************************************************** - Implementations section -******************************************************************************/ -/****************************************************************************** - Leds -******************************************************************************/ -/**************************************************************************//** -\brief Opens leds module to use. - -\return - operation state -******************************************************************************/ -result_t BSP_OpenLeds(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Closes leds module. - -\return - operation state -******************************************************************************/ -result_t BSP_CloseLeds(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Turns on the LED. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_OnLed(uint8_t id) -{ - (void)id; -} - -/**************************************************************************//** -\brief Turns off the LED. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_OffLed(uint8_t id) -{ - (void)id; -} - -/**************************************************************************//** -\brief Changes the LED state to opposite. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_ToggleLed(uint8_t id) -{ - (void)id; -} - -/****************************************************************************** - Buttons -******************************************************************************/ -/**************************************************************************//** -\brief Registers handlers for button events. - -\param[in] - pressed - the handler to process pressing the button -\param[in] - released - the handler to process releasing the button -\param[in] - bn - button number. - -\return - BC_SUCCESS - always. -******************************************************************************/ -result_t BSP_OpenButtons(void (*pressed)(uint8_t bn), void (*released)(uint8_t bn)) -{ - (void)pressed; - (void)released; - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Cancel buttons handlers. - -\return - BC_SUCCESS - always. -******************************************************************************/ -result_t BSP_CloseButtons(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Reads state of buttons. - -\return - Current buttons state in a binary way. \n - Bit 0 defines state of the button 1, \n - bit 1 defines state of the button 2. -******************************************************************************/ -uint8_t BSP_ReadButtonsState(void) -{ - return 0; -} - -#endif // APP_DISABLE_BSP == 1 - -/****************************************************************************** - Sensors -******************************************************************************/ -/***************************************************************************//** -\brief Opens temperature sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_OpenTemperatureSensor(void) -{ - return BC_SUCCESS; -} - -/***************************************************************************//** -\brief Closes the temperature sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_CloseTemperatureSensor(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Reads data from the temperature 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_SUCCESS - always. -******************************************************************************/ -result_t BSP_ReadTemperatureData(void (*f)(bool result, int16_t data)) -{ - readTemperatureDataCallback = f; - - bspPostTask(BSP_TEMPERATURE); - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP task handler for temperature sensor. -******************************************************************************/ -void bspTemperatureSensorHandler(void) -{ - readTemperatureDataCallback(true, 0); -} - -/***************************************************************************//** -\brief Opens the light sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_OpenLightSensor(void) -{ - return BC_SUCCESS; -} - -/***************************************************************************//** -\brief Closes the light sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_CloseLightSensor(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Reads data from the light 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_SUCCESS - always. -******************************************************************************/ -result_t BSP_ReadLightData(void (*f)(bool result, int16_t data)) -{ - readLightDataCallback = f; - - bspPostTask(BSP_LIGHT); - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP task handler for light sensor. -******************************************************************************/ -void bspLightSensorHandler(void) -{ - readLightDataCallback(true, 0); -} - -/***************************************************************************//** -\brief Opens the battery sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_OpenBatterySensor(void) -{ - return BC_SUCCESS; -} - -/***************************************************************************//** -\brief Closes the battery sensor. - -\return - BC_SUCCESS - always. -*******************************************************************************/ -result_t BSP_CloseBatterySensor(void) -{ - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Reads data from battery sensor. - -\param[in] - data - sensor data. - -\return - BC_SUCCESS - always. -******************************************************************************/ -result_t BSP_ReadBatteryData(void (*f)(int16_t data)) -{ - readBatteryDataCallback = f; - - bspPostTask(BSP_BATTERY); - - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief BSP task handler for battery sensor. -******************************************************************************/ -void bspEmptyBatteryHandler(void) -{ - readBatteryDataCallback(0); -} - -/****************************************************************************** - Sliders -******************************************************************************/ -/**************************************************************************//** -\brief Reads the sliders. - -\return - state of 3 on-board DIP-switches.User can uses SLIDER0, SLIDER1, SLIDER2 - defines to test state. Value 1 indicates that slider is on. -******************************************************************************/ -uint8_t BSP_ReadSliders(void) -{ - return 0; -} - -/****************************************************************************** - Joystick -******************************************************************************/ -/****************************************************************************** -\brief Registers handler for joystick events. - -\param[in] - state - joystick state. - -\return - BC_FAIL - joystick module is busy, - BC_SUCCESS in other cases. -******************************************************************************/ -result_t BSP_OpenJoystick(void (*generalHandler)(BSP_JoystickState_t state)) -{ - (void)generalHandler; - - return BC_SUCCESS; -} - -/****************************************************************************** -\brief Cancel joystick handlers. - -\return - BC_FAIL - joystick module was not opened, - BC_SUCCESS in other cases. -******************************************************************************/ -result_t BSP_CloseJoystick(void) -{ - return BC_SUCCESS; -} - -/****************************************************************************** -\brief Reads state of joystick. - -\return - Current joystick state. -******************************************************************************/ -BSP_JoystickState_t BSP_ReadJoystickState(void) -{ - return 0; -} - -// eof fakeBSP.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/leds.c b/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/leds.c deleted file mode 100644 index 48a26fd3..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/RCB/src/leds.c +++ /dev/null @@ -1,124 +0,0 @@ -/***************************************************************************//** -\file leds.c - -\brief The module to access to the leds. - -\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: - 05.08.09 A. Taradov - Created -*******************************************************************************/ -#if APP_DISABLE_BSP != 1 - -/****************************************************************************** - Includes section -******************************************************************************/ -#include - -/****************************************************************************** - Implementations section -******************************************************************************/ - -/**************************************************************************//** -\brief Opens leds module to use. - -\return - operation state -******************************************************************************/ -result_t BSP_OpenLeds(void) -{ - halInitFirstLed(); - halInitSecondLed(); - halInitThirdLed(); - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Closes leds module. - -\return - operation state -******************************************************************************/ -result_t BSP_CloseLeds(void) -{ - halUnInitFirstLed(); - halUnInitSecondLed(); - halUnInitThirdLed(); - return BC_SUCCESS; -} - -/**************************************************************************//** -\brief Turns the LED on. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_OnLed(uint8_t id) -{ - switch (id) - { - case LED_FIRST: - halOnFirstLed(); - break; - case LED_SECOND: - halOnSecondLed(); - break; - case LED_THIRD: - halOnThirdLed(); - break; - } -} - -/**************************************************************************//** -\brief Turns the LED off. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_OffLed(uint8_t id) -{ - switch (id) - { - case LED_FIRST: - halOffFirstLed(); - break; - case LED_SECOND: - halOffSecondLed(); - break; - case LED_THIRD: - halOffThirdLed(); - break; - } -} - -/**************************************************************************//** -\brief Toggles LED state. - -\param[in] - id - number of led -******************************************************************************/ -void BSP_ToggleLed(uint8_t id) -{ - switch (id) - { - case LED_FIRST: - halToggleFirstLed(); - break; - case LED_SECOND: - halToggleSecondLed(); - break; - case LED_THIRD: - halToggleThirdLed(); - break; - } -} - -#endif // APP_DISABLE_BSP != 1 - -// eof leds.c diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/buttons.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/buttons.h deleted file mode 100644 index 316c80d9..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/buttons.h +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************//** - \file buttons.h - - \brief The header file describes the buttons 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 _BSPBUTTONS_H -#define _BSPBUTTONS_H - -/****************************************************************************** - Includes section -******************************************************************************/ -// \cond -#include -// \endcond - -/****************************************************************************** - Define(s) section -******************************************************************************/ -// \cond -#define BSP_KEY0 ((uint8_t)1 << 0) -#define BSP_KEY1 ((uint8_t)1 << 1) -#define BSP_KEY2 ((uint8_t)1 << 2) -#define BSP_KEY3 ((uint8_t)1 << 3) -#define BSP_KEY4 ((uint8_t)1 << 4) -#define BSP_KEY5 ((uint8_t)1 << 5) -#define BSP_KEY6 ((uint8_t)1 << 6) -#define BSP_KEY7 ((uint8_t)1 << 7) -// for avr32_evk1105 -#define BSP_UP 0 -#define BSP_DOWN 1 -#define BSP_RIGHT 2 -#define BSP_LEFT 3 -#define BSP_ENTER 4 -// \endcond - -/****************************************************************************** - Types section -******************************************************************************/ - -// \cond -typedef void (*BSP_ButtonsEventFunc_t)(uint8_t); -// \endcond - -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief Registers handlers for button events. -\param[in] - pressed - the handler to process pressing of the button \n - bn - button number. -\param[in] - released - the handler to process releasing of the button \n - bn - button number. -\return - BC_FAIL - buttons module is busy, \n - BC_SUCCESS - otherwise. -******************************************************************************/ -result_t BSP_OpenButtons(void (*pressed)(uint8_t bn), void (*released)(uint8_t bn)); - -/**************************************************************************//** -\brief Cancel buttons handlers. -\return - BC_FAIL - buttons module was not opened, \n - BC_SUCCESS - otherwise. -******************************************************************************/ -result_t BSP_CloseButtons(void); - -/**************************************************************************//** -\brief Reads state of the buttons. -\return - Current buttons state in a binary way. \n - Bit 0 defines the state of button 1, \n - bit 1 defines the state of button 2 (for meshbean). \n - Bit 0 defines the state of up, \n - bit 1 defines the state of down, \n - bit 2 defines the state of right, \n - bit 3 defines the state of left, \n - bit 4 defines the state of enter(for avr32_evk1105). -******************************************************************************/ -uint8_t BSP_ReadButtonsState(void); - -#endif /* _BSPBUTTONS_H */ -//eof buttons.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/hexSwitch.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/hexSwitch.h deleted file mode 100644 index f052fa83..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/hexSwitch.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************//** - \file hexSwitch.h - - \brief Interface of hex switch. - - \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: - 7/10/08 A. Khromykh - Created -******************************************************************************/ -#ifndef _HEXSWITCH_H -#define _HEXSWITCH_H - -/****************************************************************************** - Includes section -******************************************************************************/ -#include - -/****************************************************************************** - Define(s) section -******************************************************************************/ -#define HEX_SWITCH_FIRST 0 -#define HEX_SWITCH_SECOND 1 - -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief Read the hex switch. - -\param[in] - nmSwitch - hex switch number - -\return - hex code. -******************************************************************************/ -uint8_t BSP_ReadHexSwitch(uint8_t nmSwitch); - -#endif /* _HEXSWITCH_H */ diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/joystick.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/joystick.h deleted file mode 100644 index d2c8581e..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/joystick.h +++ /dev/null @@ -1,74 +0,0 @@ -/***************************************************************************//** - \file joystick.h - - \brief The header file describes the joystick 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: - 10/09/07 A. Khromykh - Created -*******************************************************************************/ - -#ifndef _BSPJOYSTICK_H -#define _BSPJOYSTICK_H - -/****************************************************************************** - Includes section -******************************************************************************/ -// \cond -#include -// \endcond - -/****************************************************************************** - Types section -******************************************************************************/ -/*! \brief joystick states */ -typedef enum -{ - JOYSTICK_LEFT, - JOYSTICK_RIGHT, - JOYSTICK_UP, - JOYSTICK_DOWN, - JOYSTICK_PUSH -} BSP_JoystickState_t; - -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief Opens component and registers handler for joystick events. -\param[in] - generalHandler - the joystick handler -\param[in] - state - joystick state  -\return - BC_FAIL - joystick module is busy, \n - BC_SUCCESS - joystick module is free. -******************************************************************************/ -result_t BSP_OpenJoystick(void (*generalHandler)(BSP_JoystickState_t state)); - -/**************************************************************************//** -\brief closes joystick component. - -\return - BC_FAIL - joystick module was not opened, \n - BC_SUCCESS - joystick module was closed. -******************************************************************************/ -result_t BSP_CloseJoystick(void); - -/**************************************************************************//** -\brief Reads state of joystick. - -\return -   Joystick state. -******************************************************************************/ -BSP_JoystickState_t BSP_ReadJoystickState(void); - -#endif /* _BSPJOYSTICK_H */ -//eof joystick.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/lcd.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/lcd.h deleted file mode 100644 index 82650936..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/lcd.h +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************//** - \file lcd.h - - \brief The header file describes enums and functions of BSP LCD controller. - - \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: - 17/12/08 E. ALuzhetsky - Created -*******************************************************************************/ - -#ifndef _LCD_H -#define _LCD_H - -/****************************************************************************** - Includes section -******************************************************************************/ -// \cond -#include -#include -// \endcond - -/****************************************************************************** - Define(s) section -******************************************************************************/ -typedef enum -{ - // Symbols - LCD_CMD_SYMB_RAVEN_ON = 0x00, - LCD_CMD_SYMB_RAVEN_OFF = 0x01, - - LCD_CMD_SYMB_BELL_ON = 0x02, - LCD_CMD_SYMB_BELL_OFF = 0x03, - - LCD_CMD_SYMB_TONE_ON = 0x04, - LCD_CMD_SYMB_TONE_OFF = 0x05, - - LCD_CMD_SYMB_MIC_ON = 0x06, - LCD_CMD_SYMB_MIC_OFF = 0x07, - - LCD_CMD_SYMB_SPEAKER_ON = 0x08, - LCD_CMD_SYMB_SPEAKER_OFF = 0x09, - - LCD_CMD_SYMB_KEY_ON = 0x0a, - LCD_CMD_SYMB_KEY_OFF = 0x0b, - - LCD_CMD_SYMB_ATT_ON = 0x0c, - LCD_CMD_SYMB_ATT_OFF = 0x0d, - - LCD_CMD_SYMB_SPACE_SUN = 0x0e, - LCD_CMD_SYMB_SPACE_MOON = 0x0f, - LCD_CMD_SYMB_SPACE_OFF = 0x10, - - LCD_CMD_SYMB_CLOCK_AM = 0x11, - LCD_CMD_SYMB_CLOCK_PM = 0x12, - LCD_CMD_SYMB_CLOCK_OFF = 0x13, - - LCD_CMD_SYMB_TRX_RX = 0x14, - LCD_CMD_SYMB_TRX_TX = 0x15, - LCD_CMD_SYMB_TRX_OFF = 0x16, - - LCD_CMD_SYMB_IP_ON = 0x17, - LCD_CMD_SYMB_IP_OFF = 0x18, - - LCD_CMD_SYMB_PAN_ON = 0x19, - LCD_CMD_SYMB_PAN_OFF = 0x1a, - - LCD_CMD_SYMB_ZLINK_ON = 0x1b, - LCD_CMD_SYMB_ZLINK_OFF = 0x1c, - - LCD_CMD_SYMB_ZIGBEE_ON = 0x1d, - LCD_CMD_SYMB_ZIGBEE_OFF = 0x1e, - - LCD_CMD_SYMB_ANTENNA_LEVEL_0 = 0x1f, - LCD_CMD_SYMB_ANTENNA_LEVEL_1 = 0x20, - LCD_CMD_SYMB_ANTENNA_LEVEL_2 = 0x21, - LCD_CMD_SYMB_ANTENNA_OFF = 0x22, - - //LCD_CMD_SYMB_BAT // bettery symbol is controlled by ATMega3290... - - LCD_CMD_SYMB_ENV_OPEN = 0x23, - LCD_CMD_SYMB_ENV_CLOSE = 0x24, - LCD_CMD_SYMB_ENV_OFF = 0x25, - - LCD_CMD_SYMB_TEMP_CELSIUS = 0x26, - LCD_CMD_SYMB_TEMP_FAHRENHEIT = 0x27, - LCD_CMD_SYMB_TEMP_OFF = 0x28, - - LCD_CMD_SYMB_MINUS_ON = 0x29, - LCD_CMD_SYMB_MINUS_OFF = 0x2a, - - LCD_CMD_SYMB_DOT_ON = 0x2b, - LCD_CMD_SYMB_DOT_OFF = 0x2c, - - LCD_CMD_SYMB_COL_ON = 0x2d, - LCD_CMD_SYMB_COL_OFF = 0x2e, - - // Led - LCD_CMD_LED_ON = 0x2f, - LCD_CMD_LED_TOGGLE = 0x30, - LCD_CMD_LED_OFF = 0x31, -} BspLcdCmd_t ; - -/****************************************************************************** - External variables section -******************************************************************************/ -/****************************************************************************** - Function prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief Initializes UART to control LCD. -******************************************************************************/ -extern void BSP_OpenLcd(void); - -/**************************************************************************//** -\brief Sends the command to the LCD. -******************************************************************************/ -extern void BSP_SendLcdCmd(BspLcdCmd_t cmdId); - -/**************************************************************************//** -\brief Sends the message to the LCD. -******************************************************************************/ -extern void BSP_SendLcdMsg(const char *str); - -/**************************************************************************//** -\brief Checks whether the LCD command transmission is finished or not. - -\param void -\return 1 in case if empty, 0 otherwise -******************************************************************************/ -extern int BSP_IsLcdOperationCompleted(void); - -#endif /* _LCD_H */ -// eof lcd.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/leds.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/leds.h deleted file mode 100644 index a75bb28c..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/leds.h +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************//** - \file leds.h - - \brief The header file describes the leds 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 _LEDS_H -#define _LEDS_H - -/**************************************************************** - Includes section -*****************************************************************/ -// \cond -#include -// \endcond - -/**************************************************************** - Define(s) section -*****************************************************************/ -#define LED_FIRST 0 -#define LED_SECOND 1 -#define LED_THIRD 2 -#define LED_FOURTH 3 -#define LED_FIFTH 4 -#define LED_SIXTH 5 -#define LED_SEVENTH 6 -#define LED_EIGHTH 7 -#define LED_RED LED_FIRST -#define LED_YELLOW LED_SECOND -#define LED_GREEN LED_THIRD -#define LED_BLUE LED_FOURTH - -/**************************************************************** - Prototypes section -*****************************************************************/ -/************************************************************//** -\brief Opens leds module to use. -\return - BC_SUCCESS - always. -****************************************************************/ -result_t BSP_OpenLeds(void); - -/************************************************************//** -\brief Closes leds module. -\return - BC_SUCCESS - always. -****************************************************************/ -result_t BSP_CloseLeds(void); - -/************************************************************//** -\brief Turns on a led. -\param[in] - id - number of the led to proceed. Must be chosen from defines. -****************************************************************/ -void BSP_OnLed(uint8_t id); - -/************************************************************//** -\brief Turns off a led. -\param[in] - id - number of the led to proceed. Must be chosen from defines. -****************************************************************/ -void BSP_OffLed(uint8_t id); - -/************************************************************//** -\brief Switches the led state to the opposite. -\param[in] - id - number of the led to proceed. Must be chosen from defines. -****************************************************************/ -void BSP_ToggleLed(uint8_t id); - -#endif /* _LEDS_H */ -// eof leds.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/rs232Controller.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/rs232Controller.h deleted file mode 100644 index b3cf887e..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/rs232Controller.h +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************//** - \file rs232Controller.h - - \brief Functions for RS232 level converter 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: - 28.09.09 A. Taradov - Created -*****************************************************************/ -#ifndef _RS232CONTROLLER_H -#define _RS232CONTROLLER_H - -/***************************************************************** - Includes section -*****************************************************************/ -#include - -/************************************************************//** -\brief Enable RS232 level converter. -****************************************************************/ -static inline void BSP_EnableRs232(void) -{ -#if BSP_ENABLE_RS232_CONTROL == 1 - #if defined(RCB_ATMEGA128RFA1) - // ~EN - GPIO_D4_make_out(); - GPIO_D4_clr(); - - // FORCEON - GPIO_D6_make_out(); - GPIO_D6_set(); - - // ~FORCEOFF - GPIO_D7_make_out(); - GPIO_D7_set(); - #elif defined(RCB230_V31) || defined(RCB230_V32) || defined(RCB230_V331) || defined(RCB231_V402) || \ - defined(RCB231_V411) || defined(RCB212_V532) - // ~EN - GPIO_13_make_out(); - GPIO_13_clr(); - - // FORCEON - GPIO_15_make_out(); - GPIO_15_set(); - - // ~FORCEOFF - GPIO_16_make_out(); - GPIO_16_set(); - #elif defined(BOARD_SAM3S_EK) - // ~EN - GPIO_PA23_make_out(); - GPIO_PA23_clr(); - #else - #error 'Unsupported board.' - #endif -#endif -}; - -/************************************************************//** -\brief Disable RS232 level converter. -****************************************************************/ -static inline void BSP_DisableRs232(void) -{ -#if BSP_ENABLE_RS232_CONTROL == 1 - #if defined(RCB_ATMEGA128RFA1) - GPIO_D4_make_in(); - GPIO_D6_make_in(); - GPIO_D7_make_in(); - #elif defined(RCB230_V31) || defined(RCB230_V32) || defined(RCB230_V331) || defined(RCB231_V402) || \ - defined(RCB231_V411) || defined(RCB212_V532) - GPIO_13_make_in(); - GPIO_15_make_in(); - GPIO_16_make_in(); - #elif defined(BOARD_SAM3S_EK) - GPIO_PA23_make_in(); - #else - #error 'Unsupported board.' - #endif -#endif -}; - -#endif /* _RS232CONTROLLER_H */ diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/rs485Controller.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/rs485Controller.h deleted file mode 100644 index 7323b032..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/rs485Controller.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************//** - \file rs485Controller.h - - \brief The header file describes functions for enabling\disabling rs485 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: - 12/11/08 A. Khromykh - Created -*****************************************************************/ -#ifndef _RS485CONTROLLER_H -#define _RS485CONTROLLER_H - -/**************************************************************** - Prototypes section -*****************************************************************/ -/************************************************************//** -\brief Enable RTS driving for RS485 driver. -****************************************************************/ -void BSP_EnableRs485(void); - -/************************************************************//** -\brief Disable RTS driving for RS485 driver. -****************************************************************/ -void BSP_DisableRs485(void); - -#endif /* _RS485CONTROLLER_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 deleted file mode 100644 index 740c6a05..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/sensors.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************//** - \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 - diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/sliders.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/sliders.h deleted file mode 100644 index 67c19e93..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/sliders.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************//** - \file sliders.h - - \brief The header file describes the sliders 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 _SLIDERS_H -#define _SLIDERS_H - -/****************************************************************************** - Define(s) section -******************************************************************************/ -#define SLIDER0 (1 << 0) -#define SLIDER1 (1 << 1) -#define SLIDER2 (1 << 2) -#define SLIDER3 (1 << 3) - -/****************************************************************************** - Prototypes section -******************************************************************************/ -/**************************************************************************//** -\brief Reads the sliders. -\return - State of onboard DIP switches. Use the ::SLIDER0, ::SLIDER1, ::SLIDER2, - ::SLIDER3 constants to check state. Bit value 1 indicates that the - corresponding slider is on.\n - Note that the ::SLIDER3 is available on MeshBean LAN and Turbo board only. -******************************************************************************/ -uint8_t BSP_ReadSliders(void); - -#endif /* _SLIDERS_H */ -// eof sliders.h diff --git a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/usbController.h b/digital/beacon/src/Bitcloud_stack/Components/BSP/include/usbController.h deleted file mode 100644 index 518efe42..00000000 --- a/digital/beacon/src/Bitcloud_stack/Components/BSP/include/usbController.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************//** - \file usbController.h - - \brief The header file describes functions for driving usb line. - - \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: - 12/11/08 A. Khromykh - Created -*****************************************************************/ -#ifndef _USBCONTROLLER_H -#define _USBCONTROLLER_H - -/**************************************************************** - Prototypes section -*****************************************************************/ -/************************************************************//** -\brief Turn on pull-up on D+. -****************************************************************/ -void BSP_EnableUsb(void); - -/************************************************************//** -\brief Turn off pull-up on D+. -****************************************************************/ -void BSP_DisableUsb(void); - -/************************************************************//** -\brief Read VBUS line for detection of usb cable connection. - -\return - 0 - cable is not connected. - 1 - cable is not connected. -****************************************************************/ -uint8_t BSP_ReadVBUS(void); - -#endif /* _USBCONTROLLER_H */ -- cgit v1.2.3