LT_SPI

Embed: (wiki syntax)

« Back to documentation index

LT_SPI.cpp File Reference

LT_SPI.cpp File Reference

Go to the source code of this file.

Functions

void spi_transfer_byte (uint8_t cs_pin, uint8_t tx, uint8_t *rx)
 Reads and sends a byte.
void spi_transfer_word (uint8_t cs_pin, uint16_t tx, uint16_t *rx)
 Reads and sends a word.
void spi_transfer_block (uint8_t cs_pin, uint8_t *tx, uint8_t *rx, uint8_t length)
 Reads and sends a byte array.
void spi_enable (void)
 Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C.

Detailed Description

Library for LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.

Definition in file LT_SPI.cpp.


Function Documentation

void spi_enable ( void   )

Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C.

Configure the SPI port for 4Mhz SCK. This function or spi_enable() must be called before using the other SPI routines. Setup the processor for hardware SPI communication. Must be called before using the other SPI routines. Alternatively, call quikeval_SPI_connect(), which automatically calls this function. Configures SCK frequency. Use constant defined in header file.

Definition at line 176 of file LT_SPI.cpp.

void spi_transfer_block ( uint8_t  cs_pin,
uint8_t *  tx,
uint8_t *  rx,
uint8_t  length 
)

Reads and sends a byte array.

Returns:
void

1) Pull CS low

2) Read and send byte array

3) Pull CS high

Parameters:
cs_pinChip select pin
txByte array to be transmitted
rxByte array to be received
lengthLength of array

Definition at line 142 of file LT_SPI.cpp.

void spi_transfer_byte ( uint8_t  cs_pin,
uint8_t  tx,
uint8_t *  rx 
)

Reads and sends a byte.

Returns:
void

1) Pull CS low

2) Read byte and send byte

3) Pull CS high

Parameters:
cs_pinChip select pin
txByte to be transmitted
rxByte to be received

Definition at line 104 of file LT_SPI.cpp.

void spi_transfer_word ( uint8_t  cs_pin,
uint16_t  tx,
uint16_t *  rx 
)

Reads and sends a word.

Returns:
void

1) Pull CS low

2) Read MSB and send MSB

3) Read LSB and send LSB

4) Pull CS high

Parameters:
cs_pinChip select pin
txByte to be transmitted
rxByte to be received

Definition at line 115 of file LT_SPI.cpp.