Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
cascoda_spi.c File Reference

SPI Communication Driver Functions. More...

#include <stdio.h>
#include <string.h>
#include "cascoda-bm/cascoda_interface_core.h"
#include "cascoda-bm/cascoda_spi.h"
#include "cascoda-bm/cascoda_types.h"
#include "cascoda-bm/cascoda_wait.h"
#include "cascoda-util/cascoda_time.h"
#include "ca821x_api.h"
#include "mac_messages.h"
Include dependency graph for cascoda_spi.c:

Functions

bool SPI_IsFifoFull ()
 Query whether the SPI message FIFO is full or not. More...
 
bool SPI_IsFifoEmpty ()
 Query whether the SPI message FIFO is empty or not. More...
 
bool SPI_IsFifoAlmostFull ()
 Query whether the SPI message FIFO is almost full or not. More...
 
bool SPI_IsExchangeWithCA821xInProgress ()
 Query whether an SPI exchange operation with the CA821x is currently in progress. More...
 
bool SPI_IsSyncChainInFlight ()
 Query whether the SPI driver is currently locked in a Sync chain. More...
 
void SPI_StartSyncChain (struct ca821x_dev *pDeviceRef)
 Start a 'Sync Chain' For more efficient and safer chains of sync message communication with the CA821x. More...
 
void SPI_StopSyncChain (struct ca821x_dev *pDeviceRef)
 Stop the sync chain after starting with SPI_StartSyncChain. More...
 
struct MAC_MessageSPI_PeekFullBuf ()
 Get a MAC_Message buffer containing a received SPI Message. More...
 
void SPI_DequeueFullBuf ()
 Remove a processed Full Buffer from the SPI Queue. More...
 
ca_error SPI_Exchange (const struct MAC_Message *pTxBuffer, struct ca821x_dev *pDeviceRef)
 Exchange Messages across SPI. More...
 
ca_error SPI_Send (const uint8_t *buf, u8_t *response, struct ca821x_dev *pDeviceRef)
 Send Request over SPI. More...
 
void SPI_ExchangeComplete ()
 Function to be called from the BSP when an exchange operation has been completed. More...
 
void SPI_Initialise (void)
 Initialise SPI buffers and call BSP SPI init. More...
 
bool SPI_GetExternallyInUseStatus (void)
 Checks if the SPI is being used by something other than the RF chip. More...
 

Variables

struct MAC_Message SPI_Receive_Buffer [SPI_RX_FIFO_SIZE]
 Cyclic SPI receive message FIFO. More...
 

Detailed Description

SPI Communication Driver Functions.

Variable Documentation

◆ SPI_Receive_Buffer

struct MAC_Message SPI_Receive_Buffer[SPI_RX_FIFO_SIZE]

Cyclic SPI receive message FIFO.

Messages are read from the SPI and put into the next available index.