⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hal_board.c

📁 msp430与cc2500无线收发器通讯的底层硬件配置
💻 C
字号:
/***********************************************************************************
    Filename: hal_board.c

    Copyright 2007 Texas Instruments, Inc.
***********************************************************************************/

#include "hal_types.h"
#include "hal_defs.h"
#include "hal_digio.h"
#include "hal_int.h"
#include "hal_mcu.h"
#include "hal_board.h"
//#include "hal_lcd.h"
#include "hal_spi.h"
#include "hal_uart.h"

//------------------------------------------------------------------------------
//  Global variables
//------------------------------------------------------------------------------

// The constants below define some of the I/O signals used by the board
// Port, pin number, pin bitmask, direction and initial value should be
// set in order to match the target hardware. Once defined, the pins are
// configured in halBoardInit() by calling halDigioConfig()
const digioConfig pinLed0   = {1, 0, BIT0, HAL_DIGIO_OUTPUT, 0};
const digioConfig pinLed1   = {1, 1, BIT1, HAL_DIGIO_OUTPUT, 0};
const digioConfig pinLed2   = {1, 2, BIT2, HAL_DIGIO_OUTPUT, 0};
const digioConfig pinLed3   = {1, 3, BIT2, HAL_DIGIO_OUTPUT, 0};
const digioConfig pinLed4   = {1, 4, BIT1, HAL_DIGIO_OUTPUT, 0};
const digioConfig pinLed5   = {1, 5, BIT2, HAL_DIGIO_OUTPUT, 0};
const digioConfig pinLed6   = {1, 6, BIT2, HAL_DIGIO_OUTPUT, 0};
const digioConfig pinLed7   = {1, 7, BIT1, HAL_DIGIO_OUTPUT, 0};
const digioConfig pinS1     = {2, 0, BIT0, HAL_DIGIO_INPUT,  0};
const digioConfig pinS2     = {2, 1, BIT1, HAL_DIGIO_INPUT,  0};
const digioConfig pinGDO0   = {5, 4, BIT4, HAL_DIGIO_INPUT, 0};
const digioConfig pinGDO2   = {5, 5, BIT5, HAL_DIGIO_INPUT, 0};


//------------------------------------------------------------------------------
//  void halBoardInit(void)
//
//  DESCRIPTION:
//    Set up board. Initialize MCU, configure I/O pins and user interfaces
//------------------------------------------------------------------------------
void halBoardInit(void)
{
    // Configure MCU (set up clock system etc.)
    halMcuInit();
    // Configure digital I/O pins
    halDigioConfig(&pinLed0);
    halDigioConfig(&pinLed1);
    halDigioConfig(&pinLed2);
    halDigioConfig(&pinLed3);
    halDigioConfig(&pinLed4);
    halDigioConfig(&pinLed5);
    halDigioConfig(&pinLed6);
    halDigioConfig(&pinLed7);
    halDigioConfig(&pinLed4);
    halDigioConfig(&pinS1);
    halDigioConfig(&pinS2);   
    halDigioConfig(&pinGDO0);
    halDigioConfig(&pinGDO2);

    // Optionally, you can configure I/O pins using these macros
//    MCU_IO_OUTPUT(1, 0, 0); // LED 1 (port 1, pin 0, initial state off)
//    MCU_IO_OUTPUT(1, 1, 0); // LED 2 (port 1, pin 1, initial state off)

    // Initialize SPI interface
    halSpiInit(0);
    
    // Add other initialization functions here
    halIntOn();
}

⌨️ 快捷键说明

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