#include "config.h"
#include "lib_mcu/spi/spi_lib.h"
Include dependency graph for spi_lib.c:
Go to the source code of this file.
Functions | ||||
bit | spi_test_hit (void) | |||
This function checks if a bytes has been received on the SPI. | ||||
bit | spi_init (spi_cf_t config) | |||
This function configures the SPI controller:
| ||||
char | spi_putchar (char ch) | |||
This function sends a byte 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. | ||||
char | spi_rw (char tx) | |||
|
Definition in file spi_lib.c.
bit spi_test_hit | ( | void | ) |
This function checks if a bytes has been received on the SPI.
Definition at line 53 of file spi_lib.c.
References Spi_rx_ready.
00054 { 00055 return Spi_rx_ready(); 00056 }
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 59 of file spi_lib.c.
References SPI_CONFIG, Spi_enable, Spi_hw_init, Spi_init_bus, SPI_MASTER, Spi_select_master_mode, Spi_select_slave_mode, Spi_set_doublespeed, and TRUE.
Referenced by cdc_rf_task_init().
00060 { 00061 Spi_init_bus(); 00062 if(config == SPI_MASTER){Spi_select_master_mode();} 00063 else {Spi_select_slave_mode();} 00064 00065 Spi_hw_init(SPI_CONFIG); 00066 Spi_set_doublespeed();/*to delete if wished*/ 00067 Spi_enable(); 00068 return TRUE; 00069 }
Here is the caller graph for this function:
char spi_putchar | ( | char | uc_wr_byte | ) |
This function sends a byte on the SPI.
character | to send on the SPI. |
Definition at line 72 of file spi_lib.c.
References Spi_send_byte, and Spi_tx_ready.
00073 { 00074 Spi_send_byte(ch); 00075 while(!Spi_tx_ready()); 00076 return ch; 00077 }
char spi_getchar | ( | void | ) |
This function reads a byte on the SPI.
Definition at line 81 of file spi_lib.c.
References Spi_get_byte, and Spi_rx_ready.
00082 { 00083 00084 register char c; 00085 00086 while(!Spi_rx_ready()); 00087 c = Spi_get_byte(); 00088 return c; 00089 }
void SPI_Transmit_Master | ( | char | cData | ) |
SPI Make the transmission possible.
(char | cData) |
Definition at line 91 of file spi_lib.c.
References Spi_send_byte, and Spi_wait_eot.
00092 { 00093 /* Wait for transmission complete */ 00094 Spi_wait_eot(); 00095 /* Start new transmission */ 00096 Spi_send_byte(cData); 00097 00098 }
char spi_rw | ( | char | tx | ) |
(char | tx), the data byte to send |
Definition at line 100 of file spi_lib.c.
References Spi_read_data, and Spi_send_byte.
Referenced by NRF_Read(), NRF_read_buf(), NRF_RW_Reg(), and NRF_write_buf().
00101 { 00102 Spi_send_byte(tx); 00103 return Spi_read_data(); 00104 }
Here is the caller graph for this function: