#include <avr/io.h>
#include "..\device\device.h"
Go to the source code of this file.
Define Documentation
Doxygen has a problem with the if statements when the required define is in another file, so we will add a special section just for Doxygen. Remove the comment '//' to define DOXYGEN before running Doxygen. Make sure the '//' is back in place before compiling the code.
#define MISO_HARDWARE_DDR DDxx |
Defines the MISI Data Direction Register
#define MISO_HARDWARE_PIN PORTxx |
Defines the MISI port and pin number
#define MOSI_HARDWARE_DDR DDBx |
Defines the MOSI Data Direction Register
#define MOSI_HARDWARE_PIN PORTxx |
- Note:
- Set up SPI hardware pins. The actual port and pin numbers, shown here with x are selected by device specific definitions.
Defines the MOSI port and pin number
#define SCLK_HARDWARE_DDR DDxx |
Defines the SCLK Data Direction Register
#define SCLK_HARDWARE_PIN PORTxx |
Defines the SCLK port and pin number
#define spi_hard_clear_ss |
( |
|
) |
(SS_HARDWARE_PORT &= ~(1<<SS_HARDWARE_PIN)) |
Defines a macro to clear the hardware slave select pin
#define spi_hard_set_ss |
( |
|
) |
(SS_HARDWARE_PORT |= (1<<SS_HARDWARE_PIN)) |
Defines a macro to set the hardware slave select pin
#define SS_HARDWARE_DDR DDB4 |
Defines the SS Data Direction Register
#define SS_HARDWARE_PIN PORTB4 |
Defines the SCLK port and pin number
#define SS_HARDWARE_PORT PORTB |
Function Documentation
void spi0_hard_init_master |
( |
void |
|
) |
|
Initializes the AVR hardware SPI for spi0.
- Author:
- Joe Pardue
- Date:
- October 29, 2010
- Version:
- 1.00
uint16_t spi0_hard_master_rw16 |
( |
uint16_t |
to_slave |
) |
|
Writes and reads a 16-bit word via hardware SPI for spi0.
- Note:
- Blocks waiting for send to complete
- Returns:
- 16-bit word from the slave device.
- Parameters:
-
| to_slave | - 16-bit word to send to the slave device. |
- Author:
- Joe Pardue
- Date:
- October 29, 2010
- Version:
- 1.00
uint8_t spi0_hard_master_rw8 |
( |
uint8_t |
to_slave |
) |
|
Writes and reads an 8-bit byte via hardware SPI for spi0.
- Note:
- Blocks waiting for send to complete
- Returns:
- 8-bit byte from the slave device.
- Parameters:
-
| to_slave | - 8-bit byte to send to the slave device. |
- Author:
- Joe Pardue
- Date:
- October 29, 2010
- Version:
- 1.00
void spi0_init_master |
( |
void |
|
) |
|
Initializes spi0 as master.
- Note:
- Selects hardware or software SPI based on constant defintion SPI0_SOFT.
- Author:
- Joe Pardue
- Date:
- October 29, 2010
- Version:
- 1.00
uint16_t spi0_master_rw16 |
( |
uint16_t |
to_slave |
) |
|
Writes and reads a 16-bit word via SPI.
- Note:
- Selects hardware or software SPI based on constant defintion SPI0_SOFT.
- Author:
- Joe Pardue
- Date:
- October 29, 2010
- Version:
- 1.00
uint8_t spi0_master_rw8 |
( |
uint8_t |
to_slave |
) |
|
Writes and reads an 8-bit byte via SPI.
- Note:
- Selects hardware or software SPI based on constant defintion SPI0_SOFT.
- Author:
- Joe Pardue
- Date:
- October 29, 2010
- Version:
- 1.00