Go to the source code of this file.
Functions | |
int | HAL_OpenSpi (HAL_SpiMode_t *spiMode, void(*callback)()) |
Opens USART in MSPI mode(for avr) or opens SPI1(for arm). fields of HAL_SpiMode_t structure: . | |
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. |
Copyright (c) 2008 , Atmel Corporation. All rights reserved. Licensed under Atmel's Limited License Agreement (BitCloudTM).
Definition in file spi.h.
int HAL_OpenSpi | ( | HAL_SpiMode_t * | spiMode, | |
void(*)() | callback | |||
) |
Opens USART in MSPI mode(for avr) or opens SPI1(for arm).
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
parameters valid only for avr:
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 valid only for arm:
uint8_t csName - select CS signal (set by user). Must be set:
CS2
uint32_t pack_parameterCs - list of time parameter.
Must be use macros HAL_SPI_PACK_PARAMETER(freq_value, valid_delay_value, cons_delay_value).
Where is:
freq_value - spi frequency (Hz)
valid_delay_value - delay between setting CS and clock start (sec)
cons_delay_value - delay between consecutive transfers (sec)
[in] | spiMode | - SPI parametrs (see above). |
[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 (only for avr). |
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.
[in] | buffer | - pointer to the application data buffer |
[in] | length | - number of bytes to transfer |