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

SPI Communication Driver Functions. More...

#include <stdio.h>
#include <string.h>
#include "cascoda-bm/cascoda_evbme.h"
#include "cascoda-bm/cascoda_interface.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:

Macros

#define SPI_RX_FIFO_SIZE   7
#define SPI_RX_FIFO_RESV   4

Functions

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

Variables

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

Detailed Description

SPI Communication Driver Functions.

Macro Definition Documentation

◆ SPI_RX_FIFO_RESV

#define SPI_RX_FIFO_RESV   4

◆ SPI_RX_FIFO_SIZE

#define SPI_RX_FIFO_SIZE   7

Function Documentation

◆ CallSpiExternalCompleteCallback()

void CallSpiExternalCompleteCallback ( )

◆ GetSpiExternallyInUse()

bool GetSpiExternallyInUse ( )

◆ IsExchangeInProgress()

bool IsExchangeInProgress ( )

◆ IsFinalExchange()

bool IsFinalExchange ( )

◆ SetExchangeInProgress()

void SetExchangeInProgress ( bool val)

◆ SetFinalExchange()

void SetFinalExchange ( bool val)

◆ SetSpiExternalCompleteCallback()

void SetSpiExternalCompleteCallback ( void(* new_cb )(void))

◆ SetSpiExternallyInUse()

void SetSpiExternallyInUse ( bool in_use)

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.