spi.h File Reference

This is the SPI header
. More...

Go to the source code of this file.

Defines

#define DD_SPI_SS   PB0
#define DD_SPI_SCK   PB1
#define DD_SPI_MOSI   PB2
#define DD_SPI_MISO   PB3
#define DDR_SPI   DDRB
#define SPI_PORT   PORTB
#define PROPER_SPICON1   (0<<SPIE)|(1<<SPE)|(0<<DORD)|(1<<MSTR)|(0<<CPOL)|(0<<CPHA)|(0<<SPR1)|(1<<SPR0)

Functions

void SPI_MasterInit (void)
 SPI_MasterInit This function is used to Initialize the Chip's SPI as the Master.
void SPI_CS_high (int ChipSelect)
 SPI_SlaveInit This function is used to Initialize the Chip's SPI as a Slave.
void SPI_CS_low (int ChipSelect)
 SPI_CS_low This function is used to set a specific Chipselect to LOW.
char SPI_MasterTransmit (int ChipSelect, char cData)
 SPI_MasterTransmit This function is used to Transmit Data via SPI (This is only working as Master, receiving is implemented as pseudo-reading)
.


Detailed Description

This is the SPI header
.

It is used to specify SPI pins


Define Documentation

#define DD_SPI_MISO   PB3

Referenced by SPI_MasterInit().

#define DD_SPI_MOSI   PB2

Referenced by SPI_MasterInit().

#define DD_SPI_SCK   PB1

Referenced by SPI_MasterInit().

#define DD_SPI_SS   PB0

Referenced by SPI_MasterInit().

#define DDR_SPI   DDRB

Referenced by SPI_MasterInit().

#define PROPER_SPICON1   (0<<SPIE)|(1<<SPE)|(0<<DORD)|(1<<MSTR)|(0<<CPOL)|(0<<CPHA)|(0<<SPR1)|(1<<SPR0)

Referenced by SPI_MasterInit().

#define SPI_PORT   PORTB


Function Documentation

void SPI_CS_high ( int  ChipSelect  ) 

SPI_SlaveInit This function is used to Initialize the Chip's SPI as a Slave.

Parameters:
void 
Returns:
void SPI_CS_high This function is used to set a specific Chipselect to HIGH
Parameters:
ChipSelect The ChipSelect PIN we want to drive to High
Returns:
void

References SPI_PORT.

Referenced by init().

void SPI_CS_low ( int  ChipSelect  ) 

SPI_CS_low This function is used to set a specific Chipselect to LOW.

Parameters:
ChipSelect The ChipSelect PIN we want to drive to Low
Returns:
void

References SPI_PORT.

void SPI_MasterInit ( void   ) 

SPI_MasterInit This function is used to Initialize the Chip's SPI as the Master.

Parameters:
void 
Returns:
void

References DD_SPI_MISO, DD_SPI_MOSI, DD_SPI_SCK, DD_SPI_SS, DDR_SPI, PROPER_SPICON1, and SPI_PORT.

Referenced by main().

char SPI_MasterTransmit ( int  ChipSelect,
char  cData 
)

SPI_MasterTransmit This function is used to Transmit Data via SPI (This is only working as Master, receiving is implemented as pseudo-reading)
.

Parameters:
ChipSelect The ChipSelect PIN we need to drive to LOW to select the other Slave-Chip We drive it to HIGH again after the communication is finished.
cData The Byte we want to send via SPI
Returns:
char The Byte we got via pseudo-reading (SPI is a shifiting Register - so readable Data should be here)

References my_delay(), and SPI_PORT.

Referenced by get_temperature(), init_lcd(), lcd_clear(), lcd_send_bitmask(), lcd_send_char(), and lcd_set_start().


Generated on Mon Jan 12 21:12:08 2009 for BlueTemp by  doxygen 1.5.8