this file contains the SPI functions and the CRC calculation More...
#include "msp430.h"#include "main.h"#include "spi_if.h"Go to the source code of this file.
Functions | |
| unsigned char | calculate_crc (unsigned char *buffer, unsigned char buffer_lenght) |
| Local functions . | |
| void | init_spi (void) |
| Global functions . | |
| short | spi_write_reg (unsigned char dev_addr, unsigned char reg_addr, unsigned char data) |
| Function Name: spi_write_reg . | |
| short | spi_read_reg (unsigned char dev_addr, unsigned char reg_addr, short elem_num, unsigned char discard_crc, unsigned char *pData) |
| Function Name: spi_read_reg. | |
Variables | |
| const unsigned char | spi_regs_rw_mask [] |
| constants . | |
| const unsigned char | CrcTable [] |
this file contains the SPI functions and the CRC calculation
Definition in file spi_if.c.
| unsigned char calculate_crc | ( | unsigned char * | buffer, | |
| unsigned char | buffer_lenght | |||
| ) |
| 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 | |||
| ) |
Function Name: spi_read_reg.
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 | |||
| ) |
| const unsigned char spi_regs_rw_mask[] |
{
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x3,0x3,0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x3,0x3,0x3,0x3,0x3,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x2,0x3,0x0,0x3,
0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0
}
constants .
1.7.1