spi.h File Reference

Declaration of USART SPI mode, hardware-independent module. More...

#include <halSpi.h>

Go to the source code of this file.

Functions

int HAL_OpenSpi (HAL_SpiMode_t *spiMode, void(*callback)())
 Opens USART in MSPI mode.
fields of HAL_SpiMode_t structure
SpiClockMode_t clockMode - spi clock mode (set by user). Must be chosen from:
SPI_CLOCK_MODE0
SPI_CLOCK_MODE1
SPI_CLOCK_MODE2
SPI_CLOCK_MODE3
SpiDataOrder_t dataOrder - spi data order (set by user). Must be chosen from:
SPI_DATA_MSB_FIRST
SPI_DATA_LSB_FIRST
SpiBaudRate_t baudRate - spi clock rate (set by user). Must be chosen from:
SPI_CLOCK_RATE_62
SPI_CLOCK_RATE_125
SPI_CLOCK_RATE_250
SPI_CLOCK_RATE_500
.
int HAL_CloseSpi (void)
 Releases the channel and pins.
int HAL_WriteSpi (uint8_t *buffer, uint8_t length)
 Writes a number of bytes to the SPI.
Callback function will be used to notify when the transmission is finished.
The data read are placed to the buffer.


Detailed Description

Declaration of USART SPI mode, hardware-independent module.

Definition in file spi.h.


Function Documentation

int HAL_CloseSpi ( void   ) 

Releases the channel and pins.

Returns:
Returns 0 on success or -1 if channel was not opened.

int HAL_OpenSpi ( HAL_SpiMode_t *  spiMode,
void(*)()  callback 
)

Opens USART in MSPI mode.
fields of HAL_SpiMode_t structure
SpiClockMode_t clockMode - spi clock mode (set by user). Must be chosen from:
SPI_CLOCK_MODE0
SPI_CLOCK_MODE1
SPI_CLOCK_MODE2
SPI_CLOCK_MODE3
SpiDataOrder_t dataOrder - spi data order (set by user). Must be chosen from:
SPI_DATA_MSB_FIRST
SPI_DATA_LSB_FIRST
SpiBaudRate_t baudRate - spi clock rate (set by user). Must be chosen from:
SPI_CLOCK_RATE_62
SPI_CLOCK_RATE_125
SPI_CLOCK_RATE_250
SPI_CLOCK_RATE_500
.

Parameters:
[in] spiMode - SPI parametrs (baud rate and frame format).
[in] callback - address of the function to notify the application when a transmission was completed. When the synchronous method is used, callback must be NULL.
Returns:
-1 - there are no free resources.
0 - SPI channel is ready.

int HAL_WriteSpi ( uint8_t *  buffer,
uint8_t  length 
)

Writes a number of bytes to the SPI.
Callback function will be used to notify when the transmission is finished.
The data read are placed to the buffer.

Parameters:
[in] buffer - pointer to the application data buffer
[in] length - number of bytes to transfer
Returns:
-1 - spi module was not opened, or there is unsent data, or the pointer to data or the length are NULL;
0 - success;
Number of written bytes - success (synchronous mode).


Generated on Wed Apr 2 19:06:16 2008 for ZigBeeNet Stack Documentation by  doxygen 1.5.1-p1