SPI communication. More...
Files | |
file | spi.c |
SPI implementation. | |
file | spi.h |
SPI interface. | |
Macros | |
#define | SPI_BUFSIZE 128 |
Size of the SPI buffer. | |
Functions | |
void | spi_init () |
SPI initialization. More... | |
UInt16 | spi_proccess () |
SPI proccess. More... | |
UInt8 | spi_reqBegin (UInt8 len, UInt8 cmd0, UInt8 cmd1) |
Request begin. More... | |
UInt8 | spi_reqData (UInt8 len, void *pBuf) |
Request data. More... | |
void | spi_reqEnd (UInt8 forwardToSerial) |
Request end. More... | |
UInt8 | spi_busy () |
SPI busy. More... | |
void | SPI_SRDYISR () |
ISR SRDY. More... | |
void | SPI_USCIB0RX_ISR () |
USCIB0 RX. More... | |
Variables | |
char | spi_buf [SPI_BUFSIZE] |
SPI buffer, used to send and receive data. | |
SPI communication.
UInt8 spi_busy | ( | ) |
SPI busy.
This function checks if SPI is idle or busy on another state.
Definition at line 444 of file spi.c.
References spi_currentState.
void spi_init | ( | ) |
SPI initialization.
This function initializes the SPI variables.
Definition at line 287 of file spi.c.
References spi_bytesLeft, spi_currentFreeBytes, spi_currentState, SPI_MRDYBIT, spi_receiveOverFlow, SPI_SETMRDY, SPI_SETSRDYDETECTDOWN, SPI_SRDYBIT, and SPI_SSBIT.
Referenced by ccai_proccess(), main(), and uart_proccessCmd().
UInt16 spi_proccess | ( | ) |
SPI proccess.
This function processes the tasks of the spi.
Definition at line 325 of file spi.c.
References ccai_resetFull(), and spi_currentState.
Referenced by main().
UInt8 spi_reqBegin | ( | UInt8 | len, |
UInt8 | cmd0, | ||
UInt8 | cmd1 | ||
) |
Request begin.
This function starts data feed to a synchronous request to the SPI.
[in] | len | Size of the data field of the packet |
[in] | cmd0 | First byte of the command |
[in] | cmd1 | Second byte of the command |
Definition at line 352 of file spi.c.
References im_disable_interrupt(), im_enable_interrupt(), spi_buf, SPI_BUFSIZE, spi_currentFreeBytes, spi_currentState, SPI_FRAMEHDRSIZE, spi_pBuf, and SPI_SETSRDYDETECTDOWN.
Referenced by ccai_a_sys_reset_req(), ccai_a_sys_test_rf(), ccai_s_sys_adc_read(), ccai_s_sys_gpio(), ccai_s_sys_osal_nv_read(), ccai_s_sys_osal_nv_write(), ccai_s_sys_osal_start_timer(), ccai_s_sys_osal_stop_timer(), ccai_s_sys_random(), ccai_s_sys_test_loopback(), ccai_s_sys_version(), ccai_s_zb_allow_bind(), ccai_s_zb_app_register_request(), ccai_s_zb_bind_device(), ccai_s_zb_find_device_request(), ccai_s_zb_get_device_info(), ccai_s_zb_permit_joining_request(), ccai_s_zb_read_configuration(), ccai_s_zb_send_data_request(), ccai_s_zb_send_data_request_begin(), ccai_s_zb_start_request(), and ccai_s_zb_write_configuration().
UInt8 spi_reqData | ( | UInt8 | len, |
void * | pBuf | ||
) |
Request data.
This function writes data to the SPI buffer.
[in] | len | Size of the data to write |
[in] | pBuf | Pointer to the data buffer to copy on the SPI buffer. |
Definition at line 382 of file spi.c.
References spi_currentFreeBytes, and spi_pBuf.
Referenced by ccai_a_sys_reset_req(), ccai_a_sys_test_rf(), ccai_s_sys_adc_read(), ccai_s_sys_gpio(), ccai_s_sys_osal_nv_read(), ccai_s_sys_osal_nv_write(), ccai_s_sys_osal_start_timer(), ccai_s_sys_osal_stop_timer(), ccai_s_sys_test_loopback(), ccai_s_zb_allow_bind(), ccai_s_zb_app_register_request(), ccai_s_zb_bind_device(), ccai_s_zb_find_device_request(), ccai_s_zb_get_device_info(), ccai_s_zb_permit_joining_request(), ccai_s_zb_read_configuration(), ccai_s_zb_send_data_request(), ccai_s_zb_send_data_request_begin(), ccai_s_zb_send_data_request_payload(), and ccai_s_zb_write_configuration().
void spi_reqEnd | ( | UInt8 | forwardToSerial | ) |
Request end.
This function terminate receiving data to a request to the SPI and sends the request.
[in] | forwardToSerial | 1 to forward the packet to serial port, 0 to not |
Definition at line 411 of file spi.c.
References im_enable_interrupt(), spi_buf, SPI_BUFSIZE, spi_bytesLeft, SPI_CLRMRDY, spi_currentState, SPI_FRAMEHDRSIZE, spi_pBuf, and uart_forwardCmd().
Referenced by ccai_a_sys_reset_req(), ccai_a_sys_test_rf(), ccai_s_sys_adc_read(), ccai_s_sys_gpio(), ccai_s_sys_osal_nv_read(), ccai_s_sys_osal_nv_write(), ccai_s_sys_osal_start_timer(), ccai_s_sys_osal_stop_timer(), ccai_s_sys_random(), ccai_s_sys_test_loopback(), ccai_s_sys_version(), ccai_s_zb_allow_bind(), ccai_s_zb_app_register_request(), ccai_s_zb_bind_device(), ccai_s_zb_find_device_request(), ccai_s_zb_get_device_info(), ccai_s_zb_permit_joining_request(), ccai_s_zb_read_configuration(), ccai_s_zb_send_data_request(), ccai_s_zb_send_data_request_end(), ccai_s_zb_start_request(), and ccai_s_zb_write_configuration().
void SPI_SRDYISR | ( | ) |
ISR SRDY.
Interrupt service request for SRDY line.
Definition at line 569 of file spi.c.
References SPI_CLRMRDY, spi_currentState, SPI_SETMRDY, spi_setPollCmd(), SPI_SETSRDYDETECTDOWN, SPI_SETSRDYDETECTUP, spi_snd(), and SPI_SRDYBIT.
void SPI_USCIB0RX_ISR | ( | ) |
USCIB0 RX.
Interrupt service request for USCIB0 RX.
Definition at line 625 of file spi.c.
References spi_currentState, spi_pBuf, and spi_snd().