Subversion Repositories Code-Repo

Rev

Rev 251 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

//----------------------------------------------------------------------------
//  This include file contains definitions specific to the hardware board.
//----------------------------------------------------------------------------
// ********************************************************

#include <msp430.h>

//----------------------------------------------------------------------------
// SPI/UART port selections.  Select which port will be used for the interface
//----------------------------------------------------------------------------

// Define the SPI hardware module
#define SPI_SER_INTF      SER_INTF_USCIB0

// SPI port definitions                         // Adjust this according to the
#define SPI_PxSEL         P1SEL         // MSP430 device being used.
#define SPI_PxSEL2        P1SEL2        // Adjust the values for the chosen
#define SPI_PxDIR         P1DIR         // interfaces, according to the pin
#define SPI_PxIN          P1IN          // assignments indicated in the
#define SPI_PxOUT         P1OUT         // chosen MSP430 device datasheet.
#define SPI_SIMO          BIT7
#define SPI_SOMI          BIT6
#define SPI_UCLK          BIT5

//----------------------------------------------------------------------------
// MMC/SD port selections.  Select which port will be used for the interface
//----------------------------------------------------------------------------

// MMC port definitions                  // Adjust the values for the chosen
#define MMC_PxSEL         SPI_PxSEL      // interfaces, according to the pin
#define MMC_PxDIR         SPI_PxDIR      // assignments indicated in the
#define MMC_PxIN          SPI_PxIN       // chosen MSP430 device datasheet.
#define MMC_PxOUT         SPI_PxOUT      
#define MMC_SIMO          SPI_SIMO
#define MMC_SOMI          SPI_SOMI
#define MMC_UCLK          SPI_UCLK

// Chip Select
#define MMC_CS_PxOUT      P2OUT
#define MMC_CS_PxDIR      P2DIR
#define MMC_CS            BIT0

// Card Detect
#define MMC_CD_PxIN       P2IN
#define MMC_CD_PxDIR      P2DIR
#define MMC_CD            BIT2

// CS Control
#define MMC_CS_LOW()    MMC_CS_PxOUT &= ~MMC_CS               // Card Select
#define MMC_CS_HIGH()   while(!halSPITXDONE); MMC_CS_PxOUT |= MMC_CS  // Card Deselect

//----------------------------------------------------------------------------
// VS10XX port selections.  Select which port will be used for the interface
//----------------------------------------------------------------------------

//  VS10xx port definitions
#define VS10XX_PxSEL            SPI_PxSEL
#define VS10XX_PxDIR            SPI_PxDIR
#define VS10XX_PxIN                     SPI_PxIN
#define VS10XX_PxOUT            SPI_PxOUT
#define VS10XX_SIMO                     SPI_SIMO
#define VS10XX_SOMI                     SPI_SOMI
#define VS10XX_UCLK                     SPI_UCLK

// Chip Command Select
#define VS10XX_CS_PxOUT         P2OUT
#define VS10XX_CS_PxDIR         P2DIR
#define VS10XX_CS                       BIT5

// Chip Data Select
#define VS10XX_DC_PxOUT         P2OUT
#define VS10XX_DC_PxDIR         P2DIR
#define VS10XX_DC                       BIT1

// DREQ Line
#define VS10XX_DREQ_PxIN        P2IN
#define VS10XX_DREQ_PxDIR       P2DIR
#define VS10XX_DREQ                     BIT4

// CS Control
#define VS10XX_CS_LOW()         VS10XX_CS_PxOUT &= ~VS10XX_CS
#define VS10XX_CS_HIGH()        while(!halSPITXDONE); VS10XX_CS_PxOUT |= VS10XX_CS

// DS Control
#define VS10XX_DS_LOW()         VS10XX_DC_PxOUT &= ~VS10XX_DC
#define VS10XX_DS_HIGH()        while(!halSPITXDONE); VS10XX_DC_PxOUT |= VS10XX_DC

// DREQ Control
#define VS10XX_DREQ_STAT()      VS10XX_DREQ_PxIN & VS10XX_DREQ

//----------------------------------------------------------------------------
// Accelerometer port selections.  Select which port will be used for the interface
//----------------------------------------------------------------------------

// Accelerometer Chip Select
#define ADXL_CS_PxOUT           P1OUT
#define ADXL_CS_PxDIR           P1DIR
#define ADXL_CS                         BIT4

// Interrupt 1
#define ADXL_INT1_PxIN          P1IN
#define ADXL_INT1_PxDIR         P1DIR
#define ADXL_INT1_PxIFG         P1IFG
#define ADXL_INT1_PxIES         P1IES
#define ADXL_INT1_PxIE          P1IE
#define ADXL_INT1                       BIT3

// Interrupt 2
#define ADXL_INT2_PxIN          P1IN
#define ADXL_INT2_PxDIR         P1DIR
#define ADXL_INT2_PxIFG         P1IFG
#define ADXL_INT2_PxIES         P1IES
#define ADXL_INT2_PxIE          P1IE
#define ADXL_INT2                       BIT2

// CS Control
#define ADXL_CS_LOW()           ADXL_CS_PxOUT &= ~ADXL_CS
#define ADXL_CS_HIGH()          while(!halSPITXDONE); ADXL_CS_PxOUT |= ADXL_CS

#define ADXL_INT1_STAT()        ADXL_INT1_PxIN & ADXL_INT1
#define ADXL_INT2_STAT()        ADXL_INT2_PxIN & ADXL_INT2

//----------------------------------------------------------------------------
// Misc port selections.  Select which port will be used for the interface
//----------------------------------------------------------------------------

// Reset Line
#define LED_RED_PxOUT           P1OUT
#define LED_RED_PxDIR           P1DIR
#define LED_RED                         BIT1

// Reset Line
#define LED_GREEN_PxOUT         P1OUT
#define LED_GREEN_PxDIR         P1DIR
#define LED_GREEN                       BIT0

// Reset Line
#define CHIP_RESET_PxOUT        P2OUT
#define CHIP_RESET_PxDIR        P2DIR
#define CHIP_RESET                      BIT3

// Reset Control
#define CHIP_RESET_LOW()        CHIP_RESET_PxOUT &= ~CHIP_RESET
#define CHIP_RESET_HIGH()       CHIP_RESET_PxOUT |= CHIP_RESET

// Red LED
#define LED_RED_LOW()           LED_RED_PxOUT &= ~LED_RED
#define LED_RED_HIGH()          LED_RED_PxOUT |= LED_RED

// Green LED
#define LED_GREEN_LOW()         LED_GREEN_PxOUT &= ~LED_GREEN
#define LED_GREEN_HIGH()        LED_GREEN_PxOUT |= LED_GREEN