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

Internal Function definitions for communicating with a host using UART/USB. More...

#include <stdbool.h>
#include "cascoda-bm/cascoda_types.h"
#include "ca821x_api.h"
Include dependency graph for cascoda_serial.h:

Go to the source code of this file.

Classes

struct  SerialBuffer
 Structure of serial transfers. More...
 

Macros

#define SERIAL_MAC_RX_LEN   (254)
 Maximum serial transfer payload length. More...
 

Functions

u8_t SerialGetCommand (void)
 Load next command into SerialRxBuffer if possible Note: Not applicable to UART, as read into buffer via interrupt. More...
 
u8_t Serial_ReadInterface (void)
 Read in next Command from Serial hardware. More...
 
void MAC_Message_USB (u8_t CommandId, u8_t Count, const u8_t *pBuffer)
 Send MCPS or MLME confirm or indication Upstream. More...
 
void MAC_Message_UART (u8_t CommandId, u8_t Count, const u8_t *pBuffer)
 Send MCPS or MLME confirm or indication Upstream. More...
 
void EVBME_Message_USB (char *pBuffer, size_t Count)
 Send EVBME_MESSAGE_Indication Upstream. More...
 
void EVBME_Message_UART (char *pBuffer, size_t Count)
 Send EVBME_MESSAGE_Indication Upstream. More...
 

Variables

struct SerialBuffer SerialRxBuffer
 
volatile bool SerialRxPending
 
int(* cascoda_serial_dispatch )(u8_t *buf, size_t len, struct ca821x_dev *pDeviceRef)
 Function pointer called when a serial message is received. More...
 

Detailed Description

Internal Function definitions for communicating with a host using UART/USB.

Macro Definition Documentation

◆ SERIAL_MAC_RX_LEN

#define SERIAL_MAC_RX_LEN   (254)

Maximum serial transfer payload length.

Function Documentation

◆ EVBME_Message_UART()

void EVBME_Message_UART ( char *  pBuffer,
size_t  Count 
)

Send EVBME_MESSAGE_Indication Upstream.

Parameters
pBuffer- Pointer to Character Buffer
Count- Number of Characters

◆ EVBME_Message_USB()

void EVBME_Message_USB ( char *  pBuffer,
size_t  Count 
)

Send EVBME_MESSAGE_Indication Upstream.

Parameters
pBuffer- Pointer to Character Buffer
Count- Number of Characters

◆ MAC_Message_UART()

void MAC_Message_UART ( u8_t  CommandId,
u8_t  Count,
const u8_t pBuffer 
)

Send MCPS or MLME confirm or indication Upstream.

Parameters
CommandId- command id of confirm or indication
Count- Number of Characters
pBuffer- Pointer to Character Buffer

◆ MAC_Message_USB()

void MAC_Message_USB ( u8_t  CommandId,
u8_t  Count,
const u8_t pBuffer 
)

Send MCPS or MLME confirm or indication Upstream.

Parameters
CommandId- command id of confirm or indication
Count- Number of Characters
pBuffer- Pointer to Character Buffer

◆ Serial_ReadInterface()

u8_t Serial_ReadInterface ( void  )

Read in next Command from Serial hardware.

Returns
1 if Command ready, 0 if not

◆ SerialGetCommand()

u8_t SerialGetCommand ( void  )

Load next command into SerialRxBuffer if possible Note: Not applicable to UART, as read into buffer via interrupt.

Returns
1 if Command ready, 0 if not

Variable Documentation

◆ cascoda_serial_dispatch

int(* cascoda_serial_dispatch) (u8_t *buf, size_t len, struct ca821x_dev *pDeviceRef) ( u8_t buf,
size_t  len,
struct ca821x_dev pDeviceRef 
)
extern

Function pointer called when a serial message is received.

Should be populated by applications wishing to use the serial interface

◆ SerialRxBuffer

struct SerialBuffer SerialRxBuffer
extern

◆ SerialRxPending

volatile bool SerialRxPending
extern