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 . | |
this file contains the SPI fuctions
Definition in file spi_if.h.
| void init_spi | ( | void | ) |
| 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 | : device address, register address, num of bytes, CRC enable/disable, receiver buffer . |
| short spi_write_reg | ( | unsigned char | dev_addr, | |
| unsigned char | reg_addr, | |||
| unsigned char | data | |||
| ) |
1.7.1