hal_board_cfg.h

来自「Zigbee2007.rar」· C头文件 代码 · 共 355 行 · 第 1/2 页

H
355
字号
/**************************************************************************************************
  Filename:       hal_board_cfg.h
  Revised:        $Date: 2007-11-05 09:59:43 -0800 (Mon, 05 Nov 2007) $
  Revision:       $Revision: 15861 $

  Description:    Describe the purpose and contents of the file.


  Copyright 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 揂S 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_BOARD_CFG_H
#define HAL_BOARD_CFG_H

/*
 *     =============================================================
 *     |        Chipcon SmartRF05EB Evaluation Board, plus         |
 *     |        Chipcon CCMSP-EM430F2618 Evaluation Module         |
 *     | --------------------------------------------------------- |
 *     |  mcu   : Texas Instruments MSP430F2618                    |
 *     |  clock : 6 MHz                                            |
 *     =============================================================
 */


/* ------------------------------------------------------------------------------------------------
 *                                           Includes
 * ------------------------------------------------------------------------------------------------
 */
#include "hal_mcu.h"
#include "hal_defs.h"
#include "hal_types.h"
#include "hal_assert.h"
#include "DCO_calibrate.h"

/* ------------------------------------------------------------------------------------------------
 *                                       Board Indentifier
 * ------------------------------------------------------------------------------------------------
 */

#define HAL_BOARD_F2618

/* ------------------------------------------------------------------------------------------------
 *                                          Clock Speed
 * ------------------------------------------------------------------------------------------------
 */
#define HAL_CPU_CLOCK_MHZ     6.0000

/* ------------------------------------------------------------------------------------------------
 *                                          Clock Type
 * ------------------------------------------------------------------------------------------------
 */
#define HAL_CLOCK_TYPE_DCO         0
#define HAL_CLOCK_TYPE_CRYSTAL     1

#if defined (HAL_CLOCK_CRYSTAL)
#define HAL_CLOCK_TYPE             HAL_CLOCK_TYPE_CRYSTAL
#else
#define HAL_CLOCK_TYPE             HAL_CLOCK_TYPE_DCO
#endif


/* ------------------------------------------------------------------------------------------------
 *                                       LED Configuration
 * ------------------------------------------------------------------------------------------------
 */
#define HAL_NUM_LEDS            4
#define HAL_LED_BLINK_DELAY()   st( { volatile uint32 i; for (i=0; i<0x34000; i++) { }; } )

/* LED1 - GREEN */
#define LED1_BV           BV(0)
#define LED1_PORT         P4OUT
#define LED1_DDR          P4DIR

/* LED2 - RED */
#define LED2_BV           BV(1)
#define LED2_PORT         P4OUT
#define LED2_DDR          P4DIR

/* LED3 - YELLOW */
#define LED3_BV           BV(2)
#define LED3_PORT         P4OUT
#define LED3_DDR          P4DIR

/* LEDD4 - not working for now */
#define LED4_BV           BV(3)
#define LED4_PORT         P4OUT
#define LED4_DDR          P4DIR


/* ------------------------------------------------------------------------------------------------
 *                                    Push Button Configuration
 * ------------------------------------------------------------------------------------------------
 */
#define ACTIVE_LOW        !!
#define ACTIVE_HIGH       !    /* double negation forces result to be '1' */

/* UP */
#define PUSH1_BV          BV(5)
#define PUSH1_PORT        P4IN
#define PUSH1_POLARITY    ACTIVE_HIGH

/* RIGHT */
#define PUSH2_BV          BV(7)
#define PUSH2_PORT        P4IN
#define PUSH2_POLARITY    ACTIVE_HIGH

/* DOWN */
#define PUSH3_BV          BV(4)
#define PUSH3_PORT        P4IN
#define PUSH3_POLARITY    ACTIVE_HIGH

/* LEFT */
#define PUSH4_BV          BV(6)
#define PUSH4_PORT        P4IN
#define PUSH4_POLARITY    ACTIVE_HIGH

/* PUSH */
#define PUSH5_BV          BV(7)
#define PUSH5_PORT        P6IN
#define PUSH5_POLARITY    ACTIVE_HIGH

/* BUTTON 1 */
#define PUSH6_BV          BV(4)
#define PUSH6_PORT        P2IN
#define PUSH6_POLARITY    ACTIVE_HIGH
/* BUTTON 2 */
#define PUSH7_BV          BV(5)
#define PUSH7_PORT        P2IN
#define PUSH7_POLARITY    ACTIVE_HIGH

/* ------------------------------------------------------------------------------------------------
 *                                            Macros
 * ------------------------------------------------------------------------------------------------
 */

#define HAL_CLOCK_INIT(x)                            \
{                                                    \
  /* The DCO library does not handle the stack */    \
  /* frame well. As a result, this macro must */     \
  /* be the first thing that runs after main. */     \
  /* Disable watchdog timer */                       \
  WDTCTL = WDTPW | WDTHOLD;                          \
                                                     \
  if (x == HAL_CLOCK_TYPE_CRYSTAL)                   \
  {                                                  \
    /* Configure external crystal */                 \
    /* Turn on XT2 */                                \
    BCSCTL1 &= ~(XT2OFF);                            \
                                                     \

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?