cleaned unused examples - 3

This commit is contained in:
2019-01-16 10:35:37 +08:00
parent 93e117c79f
commit 1d6a7d84cc
518 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
/**************************************************************************************************
Filename: hal_adc.h
Revised: $Date: 2013-03-06 13:50:31 -0800 (Wed, 06 Mar 2013) $
Revision: $Revision: 33395 $
Description: This file contains the interface to the ADC Service.
Copyright 2005-2010 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_ADC_H
#define HAL_ADC_H
#ifdef __cplusplus
extern "C"
{
#endif
/**************************************************************************************************
* INCLUDES
**************************************************************************************************/
#include "hal_types.h"
#include "hal_board.h"
/**************************************************************************************************
* CONSTANTS
**************************************************************************************************/
/* Resolution */
#define HAL_ADC_RESOLUTION_8 0x01
#define HAL_ADC_RESOLUTION_10 0x02
#define HAL_ADC_RESOLUTION_12 0x03
#define HAL_ADC_RESOLUTION_14 0x04
/* Channels */
#define HAL_ADC_CHANNEL_0 0x00
#define HAL_ADC_CHANNEL_1 0x01
#define HAL_ADC_CHANNEL_2 0x02
#define HAL_ADC_CHANNEL_3 0x03
#define HAL_ADC_CHANNEL_4 0x04
#define HAL_ADC_CHANNEL_5 0x05
#define HAL_ADC_CHANNEL_6 0x06
#define HAL_ADC_CHANNEL_7 0x07
#define HAL_ADC_CHN_AIN0 0x00 /* AIN0 */
#define HAL_ADC_CHN_AIN1 0x01 /* AIN1 */
#define HAL_ADC_CHN_AIN2 0x02 /* AIN2 */
#define HAL_ADC_CHN_AIN3 0x03 /* AIN3 */
#define HAL_ADC_CHN_AIN4 0x04 /* AIN4 */
#define HAL_ADC_CHN_AIN5 0x05 /* AIN5 */
#define HAL_ADC_CHN_AIN6 0x06 /* AIN6 */
#define HAL_ADC_CHN_AIN7 0x07 /* AIN7 */
#define HAL_ADC_CHN_A0A1 0x08 /* AIN0,AIN1 */
#define HAL_ADC_CHN_A2A3 0x09 /* AIN2,AIN3 */
#define HAL_ADC_CHN_A4A5 0x0a /* AIN4,AIN5 */
#define HAL_ADC_CHN_A6A7 0x0b /* AIN6,AIN7 */
#define HAL_ADC_CHN_GND 0x0c /* GND */
#define HAL_ADC_CHN_VREF 0x0d /* Positive voltage reference */
#define HAL_ADC_CHN_TEMP 0x0e /* Temperature sensor */
#define HAL_ADC_CHN_VDD3 0x0f /* VDD/3 */
#define HAL_ADC_CHN_BITS 0x0f /* Bits [3:0] */
#define HAL_ADC_CHANNEL_TEMP HAL_ADC_CHN_TEMP
#define HAL_ADC_CHANNEL_VDD HAL_ADC_CHN_VDD3 /* channel VDD divided by 3 */
/* Vdd Limits */
#define HAL_ADC_VDD_LIMIT_0 0x00
#define HAL_ADC_VDD_LIMIT_1 0x01
#define HAL_ADC_VDD_LIMIT_2 0x02
#define HAL_ADC_VDD_LIMIT_3 0x03
#define HAL_ADC_VDD_LIMIT_4 0x04
#define HAL_ADC_VDD_LIMIT_5 0x05
#define HAL_ADC_VDD_LIMIT_6 0x06
#define HAL_ADC_VDD_LIMIT_7 0x07
/* Reference Voltages */
#define HAL_ADC_REF_125V 0x00 /* Internal Reference (1.25V-CC2430)(1.15V-CC2530) */
#define HAL_ADC_REF_AIN7 0x40 /* AIN7 Reference */
#define HAL_ADC_REF_AVDD 0x80 /* AVDD_SOC Pin Reference */
#define HAL_ADC_REF_DIFF 0xc0 /* AIN7,AIN6 Differential Reference */
#define HAL_ADC_REF_BITS 0xc0 /* Bits [7:6] */
/**************************************************************************************************
* FUNCTIONS - API
**************************************************************************************************/
/*
* Initialize ADC Service with reference set to default value
*/
extern void HalAdcInit ( void );
/*
* Read value from a specified ADC Channel at the given resolution
*/
extern uint16 HalAdcRead ( uint8 channel, uint8 resolution );
/*
* Set the reference voltage for the ADC
*/
extern void HalAdcSetReference ( uint8 reference );
/*
* Check for minimum Vdd specified.
*/
extern bool HalAdcCheckVdd(uint8 vdd);
/**************************************************************************************************
**************************************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,110 @@
/**************************************************************************************************
Filename: hal_assert.h
Revised: $Date: 2009-02-16 18:03:22 -0800 (Mon, 16 Feb 2009) $
Revision: $Revision: 19172 $
Description: Describe the purpose and contents of the file.
Copyright 2006-2007 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_ASSERT_H
#define HAL_ASSERT_H
/* ------------------------------------------------------------------------------------------------
* Macros
* ------------------------------------------------------------------------------------------------
*/
/*
* HAL_ASSERT( expression ) - The given expression must evaluate as "true" or else the assert
* handler is called. From here, the call stack feature of the debugger can pinpoint where
* the problem occurred.
*
* HAL_ASSERT_FORCED( ) - If asserts are in use, immediately calls the assert handler.
*
* HAL_ASSERT_STATEMENT( statement ) - Inserts the given C statement but only when asserts
* are in use. This macros allows debug code that is not part of an expression.
*
* HAL_ASSERT_DECLARATION( declaration ) - Inserts the given C declaration but only when asserts
* are in use. This macros allows debug code that is not part of an expression.
*
* Asserts can be disabled for optimum performance and minimum code size (ideal for
* finalized, debugged production code). To disable, define the preprocessor
* symbol HALNODEBUG at the project level.
*/
#ifdef HALNODEBUG
#define HAL_ASSERT(expr)
#define HAL_ASSERT_FORCED()
#define HAL_ASSERT_STATEMENT(statement)
#define HAL_ASSERT_DECLARATION(declaration)
#else
#define HAL_ASSERT(expr) st( if (!( expr )) halAssertHandler(); )
#define HAL_ASSERT_FORCED() halAssertHandler()
#define HAL_ASSERT_STATEMENT(statement) st( statement )
#define HAL_ASSERT_DECLARATION(declaration) declaration
#endif
/*
* This macro compares the size of the first parameter to the integer value
* of the second parameter. If they do not match, a compile time error for
* negative array size occurs (even gnu chokes on negative array size).
*
* This compare is done by creating a typedef for an array. No variables are
* created and no memory is consumed with this check. The created type is
* used for checking only and is not for use by any other code. The value
* of 10 in this macro is arbitrary, it just needs to be a value larger
* than one to result in a positive number for the array size.
*/
#define HAL_ASSERT_SIZE(x,y) typedef char x ## _assert_size_t[-1+10*(sizeof(x) == (y))]
/* ------------------------------------------------------------------------------------------------
* Prototypes
* ------------------------------------------------------------------------------------------------
*/
void halAssertHandler(void);
/**************************************************************************************************
*/
/**************************************************************************************************
* FUNCTIONS - API
**************************************************************************************************/
extern void halAssertHazardLights(void);
#endif

View File

@@ -0,0 +1 @@
#include "hal_board_cfg.h"

View File

@@ -0,0 +1,130 @@
/**************************************************************************************************
Filename: hal_defs.h
Revised: $Date: 2012-08-17 16:28:43 -0700 (Fri, 17 Aug 2012) $
Revision: $Revision: 31295 $
Description: This file contains useful macros and data types
Copyright 2005-2012 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_DEFS_H
#define HAL_DEFS_H
/* ------------------------------------------------------------------------------------------------
* Macros
* ------------------------------------------------------------------------------------------------
*/
#ifndef BV
#define BV(n) (1 << (n))
#endif
#ifndef BF
#define BF(x,b,s) (((x) & (b)) >> (s))
#endif
#ifndef MIN
#define MIN(n,m) (((n) < (m)) ? (n) : (m))
#endif
#ifndef MAX
#define MAX(n,m) (((n) < (m)) ? (m) : (n))
#endif
#ifndef ABS
#define ABS(n) (((n) < 0) ? -(n) : (n))
#endif
/* takes a byte out of a uint32 : var - uint32, ByteNum - byte to take out (0 - 3) */
#define BREAK_UINT32( var, ByteNum ) \
(uint8)((uint32)(((var) >>((ByteNum) * 8)) & 0x00FF))
#define BUILD_UINT32(Byte0, Byte1, Byte2, Byte3) \
((uint32)((uint32)((Byte0) & 0x00FF) \
+ ((uint32)((Byte1) & 0x00FF) << 8) \
+ ((uint32)((Byte2) & 0x00FF) << 16) \
+ ((uint32)((Byte3) & 0x00FF) << 24)))
#define BUILD_UINT16(loByte, hiByte) \
((uint16)(((loByte) & 0x00FF) + (((hiByte) & 0x00FF) << 8)))
#define HI_UINT16(a) (((a) >> 8) & 0xFF)
#define LO_UINT16(a) ((a) & 0xFF)
#define BUILD_UINT8(hiByte, loByte) \
((uint8)(((loByte) & 0x0F) + (((hiByte) & 0x0F) << 4)))
#define HI_UINT8(a) (((a) >> 4) & 0x0F)
#define LO_UINT8(a) ((a) & 0x0F)
#ifndef GET_BIT
#define GET_BIT(DISCS, IDX) (((DISCS)[((IDX) / 8)] & BV((IDX) % 8)) ? TRUE : FALSE)
#endif
#ifndef SET_BIT
#define SET_BIT(DISCS, IDX) (((DISCS)[((IDX) / 8)] |= BV((IDX) % 8)))
#endif
#ifndef CLR_BIT
#define CLR_BIT(DISCS, IDX) (((DISCS)[((IDX) / 8)] &= (BV((IDX) % 8) ^ 0xFF)))
#endif
/*
* This macro is for use by other macros to form a fully valid C statement.
* Without this, the if/else conditionals could show unexpected behavior.
*
* For example, use...
* #define SET_REGS() st( ioreg1 = 0; ioreg2 = 0; )
* instead of ...
* #define SET_REGS() { ioreg1 = 0; ioreg2 = 0; }
* or
* #define SET_REGS() ioreg1 = 0; ioreg2 = 0;
* The last macro would not behave as expected in the if/else construct.
* The second to last macro will cause a compiler error in certain uses
* of if/else construct
*
* It is not necessary, or recommended, to use this macro where there is
* already a valid C statement. For example, the following is redundant...
* #define CALL_FUNC() st( func(); )
* This should simply be...
* #define CALL_FUNC() func()
*
* (The while condition below evaluates false without generating a
* constant-controlling-loop type of warning on most compilers.)
*/
#define st(x) do { x } while (__LINE__ == -1)
/**************************************************************************************************
*/
#endif

View File

@@ -0,0 +1,105 @@
/**************************************************************************************************
Filename: hal_drivers.h
Revised: $Date: 2012-07-09 13:23:30 -0700 (Mon, 09 Jul 2012) $
Revision: $Revision: 30873 $
Description: This file contains the interface to the Drivers service.
Copyright 2005-2012 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_DRIVER_H
#define HAL_DRIVER_H
#ifdef __cplusplus
extern "C"
{
#endif
/**************************************************************************************************
* INCLUDES
**************************************************************************************************/
#include "hal_types.h"
/**************************************************************************************************
* CONSTANTS
**************************************************************************************************/
#define HAL_BUZZER_EVENT 0x0080
#define PERIOD_RSSI_RESET_EVT 0x0040
#define HAL_LED_BLINK_EVENT 0x0020
#define HAL_KEY_EVENT 0x0010
#if defined POWER_SAVING
#define HAL_SLEEP_TIMER_EVENT 0x0004
#define HAL_PWRMGR_HOLD_EVENT 0x0002
#define HAL_PWRMGR_CONSERVE_EVENT 0x0001
#endif
#define HAL_PWRMGR_CONSERVE_DELAY 10
#define PERIOD_RSSI_RESET_TIMEOUT 10
/**************************************************************************************************
* GLOBAL VARIABLES
**************************************************************************************************/
extern uint8 Hal_TaskID;
/**************************************************************************************************
* FUNCTIONS - API
**************************************************************************************************/
extern void Hal_Init ( uint8 task_id );
/*
* Process Serial Buffer
*/
extern uint16 Hal_ProcessEvent ( uint8 task_id, uint16 events );
/*
* Process Polls
*/
extern void Hal_ProcessPoll (void);
/*
* Initialize HW
*/
extern void HalDriverInit (void);
#ifdef __cplusplus
}
#endif
#endif
/**************************************************************************************************
**************************************************************************************************/

View File

@@ -0,0 +1,122 @@
/**************************************************************************************************
Filename: hal_flash.h
Revised: $Date:$
Revision: $Revision:$
Description: This file contains the interface to the Flash Service.
Copyright 2005-2010 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_FLASH_H
#define HAL_FLASH_H
#ifdef __cplusplus
extern "C"
{
#endif
/* ------------------------------------------------------------------------------------------------
* Includes
* ------------------------------------------------------------------------------------------------
*/
#include "hal_board.h"
#include "hal_types.h"
/**************************************************************************************************
* @fn HalFlashRead
*
* @brief This function reads 'cnt' bytes from the internal flash.
*
* input parameters
*
* @param pg - Valid HAL flash page number (ie < 128).
* @param offset - Valid offset into the page (so < HAL_NV_PAGE_SIZE and byte-aligned is ok).
* @param buf - Valid buffer space at least as big as the 'cnt' parameter.
* @param cnt - Valid number of bytes to read: a read cannot cross into the next 32KB bank.
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
void HalFlashRead(uint8 pg, uint16 offset, uint8 *buf, uint16 cnt);
/**************************************************************************************************
* @fn HalFlashWrite
*
* @brief This function reads 'cnt' bytes from the internal flash.
*
* input parameters
*
* @param addr - Valid HAL flash write address: actual addr / 4 and quad-aligned.
* @param buf - Valid buffer space at least as big as the 'cnt' parameter.
* @param cnt - Valid number of bytes to write: a write cannot cross into the next 32KB bank.
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
void HalFlashWrite(uint16 addr, uint8 *buf, uint16 cnt);
/**************************************************************************************************
* @fn HalFlashErase
*
* @brief This function erases 'cnt' pages of the internal flash.
*
* input parameters
*
* @param pg - Valid HAL flash page number (ie < 128) to erase.
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
void HalFlashErase(uint8 pg);
#ifdef __cplusplus
};
#endif
#endif
/**************************************************************************************************
*/

View File

@@ -0,0 +1,152 @@
/**************************************************************************************************
Filename: hal_key.h
Revised: $Date: 2007-07-06 10:42:24 -0700 (Fri, 06 Jul 2007) $
Revision: $Revision: 13579 $
Description: This file contains the interface to the KEY Service.
Copyright 2005-2012 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_KEY_H
#define HAL_KEY_H
#ifdef __cplusplus
extern "C"
{
#endif
/**************************************************************************************************
* INCLUDES
**************************************************************************************************/
#include "hal_board.h"
/**************************************************************************************************
* MACROS
**************************************************************************************************/
/**************************************************************************************************
* CONSTANTS
**************************************************************************************************/
/* Interrupt option - Enable or disable */
#define HAL_KEY_INTERRUPT_DISABLE 0x00
#define HAL_KEY_INTERRUPT_ENABLE 0x01
/* Key state - shift or nornal */
#define HAL_KEY_STATE_NORMAL 0x00
#define HAL_KEY_STATE_SHIFT 0x01
#define HAL_KEY_SW_1 0x01 // Joystick up
#define HAL_KEY_SW_2 0x02 // Joystick right
#define HAL_KEY_SW_5 0x04 // Joystick center
#define HAL_KEY_SW_4 0x08 // Joystick left
#define HAL_KEY_SW_3 0x10 // Joystick down
#define HAL_KEY_SW_6 0x20 // Button S1 if available
#define HAL_KEY_SW_7 0x40 // Button S2 if available
/* Joystick */
#define HAL_KEY_UP 0x01 // Joystick up
#define HAL_KEY_RIGHT 0x02 // Joystick right
#define HAL_KEY_CENTER 0x04 // Joystick center
#define HAL_KEY_LEFT 0x08 // Joystick left
#define HAL_KEY_DOWN 0x10 // Joystick down
/* Buttons */
#define HAL_PUSH_BUTTON_RIGHT 0x01 // Button right
#define HAL_PUSH_BUTTON_LEFT 0x02 // Button left
#define HAL_PUSH_BUTTON_SELECT 0x04 // Button select
#define HAL_KEY_BUTTON_UP 0x40 // Button up
#define HAL_KEY_BUTTON_DOWN 0x80 // Button down
/**************************************************************************************************
* TYPEDEFS
**************************************************************************************************/
typedef void (*halKeyCBack_t) (uint8 keys, uint8 state);
/**************************************************************************************************
* GLOBAL VARIABLES
**************************************************************************************************/
extern bool Hal_KeyIntEnable;
/**************************************************************************************************
* FUNCTIONS - API
**************************************************************************************************/
/*
* Initialize the Key Service
*/
extern void HalKeyInit( void );
/*
* Configure the Key Service
*/
extern void HalKeyConfig( bool interruptEnable, const halKeyCBack_t cback);
/*
* Read the Key status
*/
extern uint8 HalKeyRead( void);
/*
* Enter sleep mode, store important values
*/
extern void HalKeyEnterSleep ( void );
/*
* Exit sleep mode, retore values
*/
extern uint8 HalKeyExitSleep ( void );
/*
* This is for internal used by hal_driver
*/
extern void HalKeyPoll ( void );
/*
* This is for internal used by hal_sleep
*/
extern bool HalKeyPressed( void );
extern uint8 hal_key_keys(void);
extern uint8 hal_key_int_keys(void);
/**************************************************************************************************
**************************************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,135 @@
/**************************************************************************************************
Filename: hal_lcd.h
Revised: $Date: 2007-07-06 10:42:24 -0700 (Fri, 06 Jul 2007) $
Revision: $Revision: 13579 $
Description: This file contains the interface to the LCD Service.
Copyright 2005-2007 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_LCD_H
#define HAL_LCD_H
#ifdef __cplusplus
extern "C"
{
#endif
/**************************************************************************************************
* INCLUDES
**************************************************************************************************/
#include "hal_board.h"
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
#endif
/**************************************************************************************************
* CONSTANTS
**************************************************************************************************/
/* These are used to specify which line the text will be printed */
#define HAL_LCD_LINE_1 0x01
#define HAL_LCD_LINE_2 0x02
/*
This to support LCD with extended number of lines (more than 2).
Don't use these if LCD doesn't support more than 2 lines
*/
#define HAL_LCD_LINE_3 0x03
#define HAL_LCD_LINE_4 0x04
#define HAL_LCD_LINE_5 0x05
#define HAL_LCD_LINE_6 0x06
#define HAL_LCD_LINE_7 0x07
#define HAL_LCD_LINE_8 0x08
/**************************************************************************************************
* MACROS
**************************************************************************************************/
/**************************************************************************************************
* TYPEDEFS
**************************************************************************************************/
/**************************************************************************************************
* GLOBAL VARIABLES
**************************************************************************************************/
/**************************************************************************************************
* FUNCTIONS - API
**************************************************************************************************/
/*
* Initialize LCD Service
*/
extern void HalLcdInit(void);
/*
* Write a string to the LCD
*/
extern void HalLcdWriteString ( char *str, uint8 option);
/*
* Write a value to the LCD
*/
extern void HalLcdWriteValue ( uint32 value, const uint8 radix, uint8 option);
/*
* Write a value to the LCD
*/
extern void HalLcdWriteScreen( char *line1, char *line2 );
/*
* Write a string followed by a value to the LCD
*/
extern void HalLcdWriteStringValue( char *title, uint16 value, uint8 format, uint8 line );
/*
* Write a string followed by 2 values to the LCD
*/
extern void HalLcdWriteStringValueValue( char *title, uint16 value1, uint8 format1, uint16 value2, uint8 format2, uint8 line );
/*
* Write a percentage bar to the LCD
*/
extern void HalLcdDisplayPercentBar( char *title, uint8 value );
/**************************************************************************************************
**************************************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,127 @@
/**************************************************************************************************
Filename: hal_led.h
Revised: $Date: 2007-07-06 10:42:24 -0700 (Fri, 06 Jul 2007) $
Revision: $Revision: 13579 $
Description: This file contains the interface to the LED Service.
Copyright 2005-2007 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_LED_H
#define HAL_LED_H
#ifdef __cplusplus
extern "C"
{
#endif
/*********************************************************************
* INCLUDES
*/
#include "hal_board.h"
/*********************************************************************
* MACROS
*/
/*********************************************************************
* CONSTANTS
*/
/* LEDS - The LED number is the same as the bit position */
#define HAL_LED_1 0x01
#define HAL_LED_2 0x02
#define HAL_LED_3 0x04
#define HAL_LED_4 0x08
#define HAL_LED_ALL (HAL_LED_1 | HAL_LED_2 | HAL_LED_3 | HAL_LED_4)
/* Modes */
#define HAL_LED_MODE_OFF 0x00
#define HAL_LED_MODE_ON 0x01
#define HAL_LED_MODE_BLINK 0x02
#define HAL_LED_MODE_FLASH 0x04
#define HAL_LED_MODE_TOGGLE 0x08
/* Defaults */
#define HAL_LED_DEFAULT_MAX_LEDS 4
#define HAL_LED_DEFAULT_DUTY_CYCLE 5
#define HAL_LED_DEFAULT_FLASH_COUNT 50
#define HAL_LED_DEFAULT_FLASH_TIME 1000
/*********************************************************************
* TYPEDEFS
*/
/*********************************************************************
* GLOBAL VARIABLES
*/
/*
* Initialize LED Service.
*/
extern void HalLedInit( void );
/*
* Set the LED ON/OFF/TOGGLE.
*/
extern uint8 HalLedSet( uint8 led, uint8 mode );
/*
* Blink the LED.
*/
extern void HalLedBlink( uint8 leds, uint8 cnt, uint8 duty, uint16 time );
/*
* Put LEDs in sleep state - store current values
*/
extern void HalLedEnterSleep( void );
/*
* Retore LEDs from sleep state
*/
extern void HalLedExitSleep( void );
/*
* Return LED state
*/
extern uint8 HalLedGetState ( void );
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,136 @@
/**************************************************************************************************
Filename: hal_rpc.h
Revised: $Date: 2007-07-06 10:42:24 -0700 (Fri, 06 Jul 2007) $
Revision: $Revision: 13579 $
Description: This file contains information required by services that
use the Remote Procedure Call (RPC) standard.
Copyright 2008 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_RPC_H
#define HAL_RPC_H
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------------------------------------------------------------------------------
* Includes
* ------------------------------------------------------------------------------------------------
*/
/* ------------------------------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------------------------------
*/
///////////////////////////////////////////////////////////////////////////////////////////////////
// Common
///////////////////////////////////////////////////////////////////////////////////////////////////
// RPC Command Field Type
#define RPC_CMD_POLL 0x00
#define RPC_CMD_SREQ 0x20
#define RPC_CMD_AREQ 0x40
#define RPC_CMD_SRSP 0x60
#define RPC_CMD_RES4 0x80
#define RPC_CMD_RES5 0xA0
#define RPC_CMD_RES6 0xC0
#define RPC_CMD_RES7 0xE0
// RPC Command Field Subsystem
#define RPC_SYS_RES0 0
#define RPC_SYS_SYS 1
#define RPC_SYS_MAC 2
#define RPC_SYS_NWK 3
#define RPC_SYS_AF 4
#define RPC_SYS_ZDO 5
#define RPC_SYS_SAPI 6 // Simple API
#define RPC_SYS_UTIL 7
#define RPC_SYS_DBG 8
#define RPC_SYS_APP 9
#define RPC_SYS_RCAF 10 // Remote Control Application Framework
#define RPC_SYS_RCN 11 // Remote Control Network Layer
#define RPC_SYS_RCN_CLIENT 12 // Remote Control Network Layer Client
#define RPC_SYS_BOOT 13 // Serial Bootloader
#define RPC_SYS_MAX 14 // Maximum value, must be last
/* 1st byte is the length of the data field, 2nd/3rd bytes are command field. */
#define RPC_FRAME_HDR_SZ 3
/* The 3 MSB's of the 1st command field byte are for command type. */
#define RPC_CMD_TYPE_MASK 0xE0
/* The 5 LSB's of the 1st command field byte are for the subsystem. */
#define RPC_SUBSYSTEM_MASK 0x1F
/* position of fields in the general format frame */
#define RPC_POS_LEN 0
#define RPC_POS_CMD0 1
#define RPC_POS_CMD1 2
#define RPC_POS_DAT0 3
/* Error codes */
#define RPC_SUCCESS 0 /* success */
#define RPC_ERR_SUBSYSTEM 1 /* invalid subsystem */
#define RPC_ERR_COMMAND_ID 2 /* invalid command ID */
#define RPC_ERR_PARAMETER 3 /* invalid parameter */
#define RPC_ERR_LENGTH 4 /* invalid length */
///////////////////////////////////////////////////////////////////////////////////////////////////
// UART Specific
///////////////////////////////////////////////////////////////////////////////////////////////////
#define RPC_UART_FRAME_OVHD 2
// Start of frame character value
#define RPC_UART_SOF 0xFE
///////////////////////////////////////////////////////////////////////////////////////////////////
// SPI Specific
///////////////////////////////////////////////////////////////////////////////////////////////////
/* ------------------------------------------------------------------------------------------------
* Typedefs
* ------------------------------------------------------------------------------------------------
*/
/**************************************************************************************************
*/
#ifdef __cplusplus
};
#endif
#endif /* HAL_RPC_H */

View File

@@ -0,0 +1,84 @@
/**************************************************************************************************
Filename: hal_sleep.h
Revised: $Date: 2013-02-27 11:32:02 -0800 (Wed, 27 Feb 2013) $
Revision: $Revision: 33315 $
Description: This file contains the interface to the power management service.
Copyright 2006-2012 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_SLEEP_H
#define HAL_SLEEP_H
#ifdef __cplusplus
extern "C"
{
#endif
/*********************************************************************
* FUNCTIONS
*/
/*
* Execute power management procedure
*/
extern void halSleep( uint32 osal_timer );
/*
* Used in mac_mcu
*/
extern void halSleepWait(uint16 duration);
/*
* Used in hal_drivers, AN044 - DELAY EXTERNAL INTERRUPTS
*/
extern void halRestoreSleepLevel( void );
/*
* Used by the interrupt routines to exit from sleep.
*/
extern void halSleepExit(void);
/*
* Set the max sleep loop time lesser than the T2 rollover period.
*/
extern void halSetMaxSleepLoopTime(uint32 rolloverTime);
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,240 @@
/**************************************************************************************************
Filename: hal_timer.h
Revised: $Date: 2007-07-06 10:42:24 -0700 (Fri, 06 Jul 2007) $
Revision: $Revision: 13579 $
Description: This file contains the interface to the Timer Service.
Copyright 2005-2007 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_TIMER_H
#define HAL_TIMER_H
#ifdef __cplusplus
extern "C"
{
#endif
/***************************************************************************************************
* INCLUDES
***************************************************************************************************/
#include "hal_board.h"
/***************************************************************************************************
* MACROS
***************************************************************************************************/
/***************************************************************************************************
* CONSTANTS
***************************************************************************************************/
/* Timer ID definitions */
#define HAL_TIMER_0 0x00 // 8bit timer
#define HAL_TIMER_1 0x01 // 16bit Mac timer
#define HAL_TIMER_2 0x02 // 8bit timer
#define HAL_TIMER_3 0x03 // 16bit timer
#define HAL_TIMER_MAX 4 // Max number of timer
/* Operation Modes for timer */
#define HAL_TIMER_MODE_NORMAL 0x01 // Normal Mode
#define HAL_TIMER_MODE_CTC 0x02 // Clear Timer On Compare
#define HAL_TIMER_MODE_MASK (HAL_TIMER_MODE_NORMAL | HAL_TIMER_MODE_CTC)
/* Timer1 channels */
#define HAL_T1_CH0 0
#define HAL_T1_CH1 1
#define HAL_T1_CH2 2
#define HAL_T1_CH3 3
#define HAL_T1_CH4 4
/* Channel definitions */
#define HAL_TIMER_CHANNEL_SINGLE 0x01 // Single Channel - default
#define HAL_TIMER_CHANNEL_A 0x02 // Channel A
#define HAL_TIMER_CHANNEL_B 0x04 // Channel B
#define HAL_TIMER_CHANNEL_C 0x08 // Channel C
#define HAL_TIMER_CHANNEL_D 0x10 // Channel D
#define HAL_TIMER_CHANNEL_E 0x20 // Channel E
#define HAL_TIMER_CHANNEL_MASK (HAL_TIMER_CHANNEL_SINGLE | \
HAL_TIMER_CHANNEL_A | \
HAL_TIMER_CHANNEL_B | \
HAL_TIMER_CHANNEL_C | \
HAL_TIMER_CHANNEL_D | \
HAL_TIMER_CHANNEL_E)
#define HAL_TIMER_CH_MAX 0x06
/* Timer 1 Channel 0 Channel compare mode definitions */
#define HAL_TIMER1_CH0_CMP_MODE_SET_ON_COMP 0x00 // 000: Set output on compare
#define HAL_TIMER1_CH0_CMP_MODE_CLR_ON_COMP 0x01 // 001: Clear output on compare
#define HAL_TIMER1_CH0_CMP_MODE_TOG_ON_COMP 0x02 // 010: Toggle output on compare
#define HAL_TIMER1_CH0_CMP_MODE_SET_ON_COMP_CLR_ON_0 0x03 // 011: Set output on compare-up, clear on 0
#define HAL_TIMER1_CH0_CMP_MODE_CLR_ON_COMP_SET_ON_0 0x04 // 100: Clear output on compare-up, set on 0
#define HAL_TIMER1_CH0_CMP_MODE_INIT 0x07 // 111: Initialize output pin. CMP[2:0] is not changed
/* Timer 1 Channel 1-5 channel compare mode definitions */
#define HAL_TIMER1_CHn_CMP_MODE_SET_ON_COMP 0x00 // 000: Set output on compare
#define HAL_TIMER1_CHn_CMP_MODE_CLR_ON_COMP 0x01 // 001: Clear output on compare
#define HAL_TIMER1_CHn_CMP_MODE_TOG_ON_COMP 0x02 // 010: Toggle output on compare
#define HAL_TIMER1_CHn_CMP_MODE_SET_ON_COMP_CLR_ON_0 0x03 // 011: Set output on compare-up, clear on compare down in up-down mode. Otherwise set output on
// compare, clear on 0.
#define HAL_TIMER1_CHn_CMP_MODE_CLR_ON_COMP_SET_ON_0 0x04 // 100: Clear output on compare-up, set on compare down in up-down mode. Otherwise clear output
// on compare, set on 0
#define HAL_TIMER1_CHn_CMP_MODE_CLR_ON_CH0_SET_ON_CHn 0x05 // 101: Clear when equal T1CC0, set when equal T1CC2
#define HAL_TIMER1_CHn_CMP_MODE_SET_ON_CH0_CLR_ON_CHn 0x06 // 110: Set when equal T1CC0, clear when equal T1CC2
#define HAL_TIMER1_CHn_CMP_MODE_INIT 0x07 // 111: Initialize output pin. CMP[2:0] is not changed.
#define HAL_TIMER1_CH_CMP_MODE_BITS 0x38 // bits 5:3
/* Timer 1 Capture mode */
#define HAL_TIMER1_CH_CAP_MODE_NO 0x00 // 00: No capture
#define HAL_TIMER1_CH_CAP_MODE_RISING 0x01 // 01: Capture on rising edge
#define HAL_TIMER1_CH_CAP_MODE_FALLING 0x02 // 10: Capture on falling edge
#define HAL_TIMER1_CH_CAP_MODE_ALL 0x03 // 11: Capture on all edges
#define HAL_TIMER1_CH_CAP_BITS 0x03 // bits 1:0
/* Channel mode definitions */
#define HAL_TIMER_CH_MODE_INPUT_CAPTURE 0x01 // Channel Mode Input-Capture
#define HAL_TIMER_CH_MODE_OUTPUT_COMPARE 0x02 // Channel Mode Output_Compare
#define HAL_TIMER_CH_MODE_OVERFLOW 0x04 // Channel Mode Overflow
#define HAL_TIMER_CH_MODE_MASK (HAL_TIMER_CH_MODE_INPUT_CAPTURE | \
HAL_TIMER_CH_MODE_OUTPUT_COMPARE | \
HAL_TIMER_CH_MODE_OVERFLOW)
/* Error Code */
#define HAL_TIMER_OK 0x00
#define HAL_TIMER_NOT_OK 0x01
#define HAL_TIMER_PARAMS_ERROR 0x02
#define HAL_TIMER_NOT_CONFIGURED 0x03
#define HAL_TIMER_INVALID_ID 0x04
#define HAL_TIMER_INVALID_CH_MODE 0x05
#define HAL_TIMER_INVALID_OP_MODE 0x06
/* Timer clock pre-scaler definitions for 16bit timer1 and timer3 */
#define HAL_TIMER3_16_TC_STOP 0x00 // No clock, timer stopped
#define HAL_TIMER3_16_TC_DIV1 0x01 // No clock pre-scaling
#define HAL_TIMER3_16_TC_DIV8 0x02 // Clock pre-scaled by 8
#define HAL_TIMER3_16_TC_DIV64 0x03 // Clock pre-scaled by 64
#define HAL_TIMER3_16_TC_DIV256 0x04 // Clock pre-scaled by 256
#define HAL_TIMER3_16_TC_DIV1024 0x05 // Clock pre-scaled by 1024
#define HAL_TIMER3_16_TC_EXTFE 0x06 // External clock (T2), falling edge
#define HAL_TIMER3_16_TC_EXTRE 0x07 // External clock (T2), rising edge
/* Timer clock pre-scaler definitions for 8bit timer0 and timer2 */
#define HAL_TIMER0_8_TC_STOP 0x00 // No clock, timer stopped
#define HAL_TIMER0_8_TC_DIV1 0x01 // No clock pre-scaling
#define HAL_TIMER0_8_TC_DIV8 0x02 // Clock pre-scaled by 8
#define HAL_TIMER0_8_TC_DIV32 0x03 // Clock pre-scaled by 32
#define HAL_TIMER0_8_TC_DIV64 0x04 // Clock pre-scaled by 64
#define HAL_TIMER0_8_TC_DIV128 0x05 // Clock pre-scaled by 128
#define HAL_TIMER0_8_TC_DIV256 0x06 // Clock pre-scaled by 256
#define HAL_TIMER0_8_TC_DIV1024 0x07 // Clock pre-scaled by 1024
/* Timer clock pre-scaler definitions for 8bit timer2 */
#define HAL_TIMER2_8_TC_STOP 0x00 // No clock, timer stopped
#define HAL_TIMER2_8_TC_DIV1 0x01 // No clock pre-scaling
#define HAL_TIMER2_8_TC_DIV8 0x02 // Clock pre-scaled by 8
#define HAL_TIMER2_8_TC_DIV64 0x03 // Clock pre-scaled by 32
#define HAL_TIMER2_8_TC_DIV256 0x04 // Clock pre-scaled by 64
#define HAL_TIMER2_8_TC_DIV1024 0x05 // Clock pre-scaled by 128
#define HAL_TIMER2_8_TC_EXTFE 0x06 // External clock (T2), falling edge
#define HAL_TIMER2_8_TC_EXTRE 0x07 // External clock (T2), rising edge
/***************************************************************************************************
* TYPEDEFS
***************************************************************************************************/
typedef void (*halTimerCBack_t) (uint8 timerId, uint8 channel, uint8 channelMode);
/***************************************************************************************************
* GLOBAL VARIABLES
***************************************************************************************************/
/***************************************************************************************************
* FUNCTIONS - API
***************************************************************************************************/
/*
* Initialize Timer Service
*/
extern void HalTimerInit ( void );
/*
* Configure channel in different modes
*/
extern uint8 HalTimerConfig ( uint8 timerId,
uint8 opMode,
uint8 channel,
uint8 channelMode,
bool intEnable,
halTimerCBack_t cback );
/*
* Start a Timer
*/
extern uint8 HalTimerStart ( uint8 timerId, uint32 timePerTick );
/*
* Stop a Timer
*/
extern uint8 HalTimerStop ( uint8 timerId );
/*
* This is used for polling, provide the tick increment
*/
extern void HalTimerTick ( void );
/*
* Enable and disable particular timer
*/
extern uint8 HalTimerInterruptEnable (uint8 timerId, uint8 channelMode, bool enable);
/*
* Configures timer 1 to control 4 PWM outputs
*/
void HalTimer1Init (halTimerCBack_t cBack);
/*
* Set dutycycle on timer 1 PWM output channel
*/
void halTimer1SetChannelDuty (uint8 channel, uint16 promill);
/***************************************************************************************************
***************************************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,238 @@
/**************************************************************************************************
Filename: hal_uart.h
Revised: $Date: 2012-10-17 09:45:25 -0700 (Wed, 17 Oct 2012) $
Revision: $Revision: 31844 $
Description: This file contains the interface to the UART Service.
Copyright 2005-2012 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef HAL_UART_H
#define HAL_UART_H
#ifdef __cplusplus
extern "C"
{
#endif
/***************************************************************************************************
* INCLUDES
***************************************************************************************************/
#include "hal_board.h"
/***************************************************************************************************
* MACROS
***************************************************************************************************/
/***************************************************************************************************
* CONSTANTS
***************************************************************************************************/
/* UART Ports */
/*
Serial Port Baudrate Settings
Have to match with baudrate table
*/
#define HAL_UART_BR_9600 0x00
#define HAL_UART_BR_19200 0x01
#define HAL_UART_BR_38400 0x02
#define HAL_UART_BR_57600 0x03
#define HAL_UART_BR_115200 0x04
/* Frame Format constant */
/* Stop Bits */
#define HAL_UART_ONE_STOP_BIT 0x00
#define HAL_UART_TWO_STOP_BITS 0x01
/* Parity settings */
#define HAL_UART_NO_PARITY 0x00
#define HAL_UART_EVEN_PARITY 0x01
#define HAL_UART_ODD_PARITY 0x02
/* Character Size */
#define HAL_UART_8_BITS_PER_CHAR 0x00
#define HAL_UART_9_BITS_PER_CHAR 0x01
/* Flow control */
#define HAL_UART_FLOW_OFF 0x00
#define HAL_UART_FLOW_ON 0x01
/* Ports */
#define HAL_UART_PORT_0 0x00
#define HAL_UART_PORT_1 0x01
#define HAL_UART_PORT_MAX 0x02
/* UART Status */
#define HAL_UART_SUCCESS 0x00
#define HAL_UART_UNCONFIGURED 0x01
#define HAL_UART_NOT_SUPPORTED 0x02
#define HAL_UART_MEM_FAIL 0x03
#define HAL_UART_BAUDRATE_ERROR 0x04
/* UART Events */
#define HAL_UART_RX_FULL 0x01
#define HAL_UART_RX_ABOUT_FULL 0x02
#define HAL_UART_RX_TIMEOUT 0x04
#define HAL_UART_TX_FULL 0x08
#define HAL_UART_TX_EMPTY 0x10
/***************************************************************************************************
* TYPEDEFS
***************************************************************************************************/
typedef void (*halUARTCBack_t) (uint8 port, uint8 event);
typedef struct
{
// The head or tail is updated by the Tx or Rx ISR respectively, when not polled.
volatile uint16 bufferHead;
volatile uint16 bufferTail;
uint16 maxBufSize;
uint8 *pBuffer;
} halUARTBufControl_t;
typedef struct
{
bool configured;
uint8 baudRate;
uint8 parity;
uint8 stopbit;
bool flowControl;
uint16 flowControlThreshold;
uint8 idleTimeout;
halUARTBufControl_t rx;
halUARTBufControl_t tx;
bool intEnable;
uint32 rxChRvdTime;
halUARTCBack_t callBackFunc;
}halUARTCfg_t;
typedef union
{
bool paramCTS;
bool paramRTS;
bool paramDSR;
bool paramDTR;
bool paramCD;
bool paramRI;
uint16 baudRate;
bool flowControl;
bool flushControl;
}halUARTIoctl_t;
/***************************************************************************************************
* GLOBAL VARIABLES
***************************************************************************************************/
/***************************************************************************************************
* FUNCTIONS - API
***************************************************************************************************/
/*
* Initialize UART at the startup
*/
extern void HalUARTInit ( void );
/*
* Open a port based on the configuration
*/
extern uint8 HalUARTOpen ( uint8 port, halUARTCfg_t *config );
/*
* Close a port
*/
extern void HalUARTClose ( uint8 port );
/*
* Read a buffer from the UART
*/
extern uint16 HalUARTRead ( uint8 port, uint8 *pBuffer, uint16 length );
/*
* Write a buff to the uart *
*/
extern uint16 HalUARTWrite ( uint8 port, uint8 *pBuffer, uint16 length );
/*
* Write a buffer to the UART
*/
extern uint8 HalUARTIoctl ( uint8 port, uint8 cmd, halUARTIoctl_t *pIoctl );
/*
* This to support polling
*/
extern void HalUARTPoll( void );
/*
* Return the number of bytes in the Rx buffer
*/
extern uint16 Hal_UART_RxBufLen ( uint8 port );
/*
* Return the number of bytes in the Tx buffer
*/
extern uint16 Hal_UART_TxBufLen ( uint8 port );
/*
* This enable/disable flow control
*/
extern void Hal_UART_FlowControlSet ( uint8 port, bool status );
/*
* Initialize hardware for UART
*/
extern uint8 HalUART_HW_Init(uint8 port);
/*
* Abort UART when entering sleep mode
*/
extern void HalUARTSuspend(void);
/*
* Resume UART after wakeup from sleep
*/
extern void HalUARTResume(void);
/***************************************************************************************************
***************************************************************************************************/
#ifdef __cplusplus
}
#endif
#endif