Defines | Typedefs | Enumerations | Functions

spi_if.h File Reference

this file contains the SPI fuctions More...

#include "TI_USCI_SPI_Regs.h"

Go to the source code of this file.

Defines

#define SPI_BAUDRATE   1000000
#define SPI_BAUDRATE_REG   (unsigned short)(MCLK_FREQ/SPI_BAUDRATE)
#define NUMBER_OF_SPI_REGS   BQ_SPI_REG_MAX
#define READ_ACCESS   (1<<0)
#define WRITE_ACCESS   (1<<1)

Typedefs

typedef enum SPI_REGS spi_regs_t
 System typdefs .

Enumerations

enum  SPI_REGS { SPI_DEV_ID, SPI_REV, SPI_STATUS }
 

System typdefs .


Functions

short spi_read_reg (unsigned char dev_addr, unsigned char reg_addr, short elem_num, unsigned char discard_crc, unsigned char *pData)
 External functions declaration .
short spi_write_reg (unsigned char dev_addr, unsigned char reg_addr, unsigned char data)
 Function Name: spi_write_reg .
void init_spi (void)
 Global functions .

Detailed Description

this file contains the SPI fuctions

Author:
Texas Instruments, Inc
Date:
November 2010
Version:
1.0 Initial version
Note:
Built with IAR for MSP430 Version: 5.10

Definition in file spi_if.h.


Function Documentation

void init_spi ( void   ) 

Global functions .

Function Name: init_spi . Description : Initializes the SPI module and the SPI pins .

Parameters:
parameters : none
Returns:
Value : none

Definition at line 134 of file spi_if.c.

short spi_read_reg ( unsigned char  dev_addr,
unsigned char  reg_addr,
short  elem_num,
unsigned char  discard_crc,
unsigned char *  pData 
)

External functions declaration .

External functions declaration .

Description : Read elem_num bytes from SPI reg of the attached device, read data is returned in pData, returns number of received bytes (including CRC as last pData byte if required) .

Parameters:
parameters : device address, register address, num of bytes, CRC enable/disable, receiver buffer .
Returns:
Value : number of bytes received

Definition at line 224 of file spi_if.c.

short spi_write_reg ( unsigned char  dev_addr,
unsigned char  reg_addr,
unsigned char  data 
)

Function Name: spi_write_reg .

Description : Writes just 1 byte into the specified bq pack register.

Parameters:
parameters : device address, register address, data
Returns:
Value : return the number of bytes sent

Definition at line 163 of file spi_if.c.