aversive_10-03-12/modules/comm/spi/spi.h File Reference

#include <stdint.h>

Go to the source code of this file.

Defines

#define SPI_MSB_FIRST   0
#define SPI_LSB_FIRST   1

Enumerations

enum  spi_mode_t { SPI_MODE_UNINIT, SPI_MODE_MASTER }
enum  spi_format_t { SPI_FORMAT_0 = 0x00, SPI_FORMAT_1 = _BV(CPHA), SPI_FORMAT_2 = _BV(CPOL), SPI_FORMAT_3 = _BV(CPHA) | _BV(CPOL) }
enum  spi_clk_rate_t {
  SPI_CLK_RATE_2 = 0x10, SPI_CLK_RATE_4 = 0x00, SPI_CLK_RATE_8 = 0x11, SPI_CLK_RATE_16 = 0x01,
  SPI_CLK_RATE_32 = 0x12, SPI_CLK_RATE_64 = 0x02, SPI_CLK_RATE_128 = 0x03
}

Functions

void spi_set_data_order (uint8_t order)
void spi_init (spi_mode_t mode, spi_format_t format, spi_clk_rate_t clk_rate)
spi_mode_t spi_get_mode (void)
int8_t spi_register_ss_line (volatile uint8_t *port, uint8_t bitnum)
uint8_t spi_send_and_receive_byte (uint8_t byte)
void spi_send_byte (uint8_t byte)
uint8_t spi_receive_byte (void)
uint8_t spi_slave_select (uint8_t slave)
void spi_slave_deselect (uint8_t slave)
void spi_display_ss_lines (void)


Define Documentation

#define SPI_LSB_FIRST   1

Definition at line 105 of file spi.h.

Referenced by spi_get_data_order(), and spi_set_data_order().

#define SPI_MSB_FIRST   0

Definition at line 104 of file spi.h.

Referenced by spi_get_data_order().


Enumeration Type Documentation

Enumerator:
SPI_CLK_RATE_2 
SPI_CLK_RATE_4 
SPI_CLK_RATE_8 
SPI_CLK_RATE_16 
SPI_CLK_RATE_32 
SPI_CLK_RATE_64 
SPI_CLK_RATE_128 

Definition at line 88 of file spi.h.

Enumerator:
SPI_FORMAT_0 
SPI_FORMAT_1 
SPI_FORMAT_2 
SPI_FORMAT_3 

Definition at line 76 of file spi.h.

enum spi_mode_t

Enumerator:
SPI_MODE_UNINIT 
SPI_MODE_MASTER 

Definition at line 62 of file spi.h.


Function Documentation

void spi_display_ss_lines ( void   ) 

Definition at line 213 of file spi.c.

References DEBUG, E_SPI, and i.

Referenced by main().

spi_mode_t spi_get_mode ( void   )  [inline]

Definition at line 147 of file spi.c.

Referenced by cc2420_init().

void spi_init ( spi_mode_t  mode,
spi_format_t  format,
spi_clk_rate_t  clk_rate 
)

uint8_t spi_receive_byte ( void   ) 

int8_t spi_register_ss_line ( volatile uint8_t *  port,
uint8_t  bitnum 
)

Definition at line 55 of file spi.c.

References DEBUG, E_SPI, and NOTICE.

Referenced by cc2420_init(), and encoders_spi_init().

uint8_t spi_send_and_receive_byte ( uint8_t  byte  ) 

void spi_send_byte ( uint8_t  byte  )  [inline]

void spi_set_data_order ( uint8_t  order  )  [inline]

Definition at line 77 of file spi.c.

References SPI_LSB_FIRST.

Referenced by encoders_spi_init().

void spi_slave_deselect ( uint8_t  slave  ) 

Definition at line 204 of file spi.c.

References FALSE.

Referenced by encoders_spi_manage().

uint8_t spi_slave_select ( uint8_t  slave  ) 

Definition at line 189 of file spi.c.

References E_SPI, EBUSY, ERROR, ESUCCESS, and TRUE.

Referenced by encoders_spi_manage().


Generated on Fri Mar 12 06:32:05 2010 for AVR by  doxygen 1.5.6