#include "lib_mcu/spi/spi_drv.h"
Include dependency graph for spi_lib.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Enumerations | |
enum | spi_cf_t { SPI_MASTER, SPI_SLAVE } |
This enumeration allows to define a MASTER or SLAVE configuration. More... | |
Functions | |
bit | spi_init (spi_cf_t config) |
This function configures the SPI controller:
| |
char | spi_putchar (char uc_wr_byte) |
This function sends a byte on the SPI. | |
bit | spi_test_hit (void) |
This function checks if a bytes has been received on the SPI. | |
char | spi_getchar (void) |
This function reads a byte on the SPI. | |
void | SPI_Transmit_Master (char cData) |
SPI Make the transmission possible. |
Copyright (c) 2004 Atmel.
Please read file license.txt for copyright notice.
Definition in file spi_lib.h.
enum spi_cf_t |
This enumeration allows to define a MASTER or SLAVE configuration.
Definition at line 35 of file spi_lib.h.
00035 {SPI_MASTER, SPI_SLAVE} spi_cf_t;
bit spi_init | ( | spi_cf_t | config | ) |
This function configures the SPI controller:
configuration | of the node (MASTER or SLAVE). | |
configuration | of mode (SPI_MASTER_MODE_0...SPI_MASTER_MODE_3 or SPI_SLAVE_MODE_0...SPI_SLAVE_MODE_3). |
Definition at line 34 of file spi_lib.c.
References Spi_enable, Spi_hw_init, Spi_init_bus, SPI_MASTER, Spi_select_master_mode, Spi_select_slave_mode, Spi_set_doublespeed, and TRUE.
00035 { 00036 Spi_init_bus(); 00037 if(config == SPI_MASTER){Spi_select_master_mode();} 00038 else {Spi_select_slave_mode();} 00039 00040 Spi_hw_init(SPI_CONFIG); 00041 Spi_set_doublespeed();/*to delete if wished*/ 00042 Spi_enable(); 00043 00044 00045 return TRUE; 00046 }
char spi_putchar | ( | char | uc_wr_byte | ) |
This function sends a byte on the SPI.
character | to send on the SPI. |
Definition at line 49 of file spi_lib.c.
References Spi_send_byte, and Spi_tx_ready.
00050 { 00051 Spi_send_byte(ch); 00052 while(!Spi_tx_ready()); 00053 return ch; 00054 }
bit spi_test_hit | ( | void | ) |
This function checks if a bytes has been received on the SPI.
Definition at line 28 of file spi_lib.c.
References Spi_rx_ready.
00029 { 00030 return Spi_rx_ready(); 00031 }
char spi_getchar | ( | void | ) |
This function reads a byte on the SPI.
Definition at line 58 of file spi_lib.c.
References Spi_get_byte, and Spi_rx_ready.
00059 { 00060 00061 register char c; 00062 00063 while(!Spi_rx_ready()); 00064 c = Spi_get_byte(); 00065 return c; 00066 }
void SPI_Transmit_Master | ( | char | cData | ) |
SPI Make the transmission possible.
(char | cData) |
Definition at line 68 of file spi_lib.c.
References Spi_send_byte, and Spi_wait_eot.
00069 { 00070 /* Wait for transmission complete */ 00071 Spi_wait_eot(); 00072 /* Start new transmission */ 00073 Spi_send_byte(cData); 00074 00075 }