#include <avr/io.h>
#include "spi2.h"
Functions | |
void | init_spi (uint8_t rate) |
Initialise the rate for the SPI bus. | |
void | xmit_spi (uint8_t dat) |
Transmit an 8 bit value to the SPI bus. | |
uint8_t | recv_spi (void) |
Receive an 8 bit value from the SPI bus. |
void init_spi | ( | uint8_t | rate | ) | [inline] |
Initialise the rate for the SPI bus.
rate | Value whose bottom 2 bits are used to set the SPI bus rate. |
Requires I/O to have been set correctly independently See Atmel datasheet for the correct value to use in this function to get the SPI rate required. rate is masked so only the bottom 2 bits are valid. rate 0 0 fosc/4 0 1 fosc/16 1 0 fosc/64 1 1 fosc/128
uint8_t recv_spi | ( | void | ) | [inline] |
Receive an 8 bit value from the SPI bus.
Requires spi_init() to have been run, and I/O set correctly
void xmit_spi | ( | uint8_t | data | ) | [inline] |
Transmit an 8 bit value to the SPI bus.
data | Value to send via SPI bus. |
Requires spi_init() to have been run, and I/O set correctly