brazos-trapezoidal
Classes | Enumerations | Functions
SerialBuffer.h File Reference

Header file of SerialBuffer. More...

#include "SerialBuffer_prm.h"
#include "mc_types.h"
Include dependency graph for SerialBuffer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BUFFER_TYPE
 

Enumerations

enum  SERIALBUFFER_TX_STATE_TYPE { SERIALBUFFER_TX_STATE_IDLE , SERIALBUFFER_TX_STATE_LISTEN , SERIALBUFFER_TX_STATE_SENDING , SERIALBUFFER_TX_STATE_ERROR }
 
enum  SERIALBUFFER_RX_STATE_TYPE { SERIALBUFFER_RX_STATE_IDLE , SERIALBUFFER_RX_STATE_RECEIVE_HEADER , SERIALBUFFER_RX_STATE_RECEIVE_DATA , SERIALBUFFER_RX_STATE_ERROR }
 
enum  BUFFER_POS_TYPE { BUFFER_POS_EMPTY , BUFFER_POS_LOADING , BUFFER_POS_FULL , BUFFER_POS_TRANSMITTING }
 

Functions

void SerialBuffer__Initialize (void)
 It Initializes the module and its variables. More...
 
BOOL_TYPE SerialBuffer__U8LoadDatatoBuffer (unsigned char data)
 Method to load data to the Serial TX Buffer. More...
 
void SerialBuffer__HandlerTX (void)
 Serial Buffer TX Handler. More...
 
void SerialBuffer__HandlerRX (void)
 Serial Buffer RX Handler. More...
 
void SerialBuffer__ReadFromBuffer (unsigned char *data, unsigned char num_bytes)
 Returns the data from the Buffer. More...
 
BUFFER_POS_TYPE SerialBuffer__GetTXBufferStatus (unsigned char buffer_pos)
 Returns the status of the Tx Buffer. More...
 
bool SerialBuffer__GetTXBufferIsEmpty (void)
 Returns if the TX buffer is Empty. More...
 
BUFFER_POS_TYPE SerialBuffer__GetRXBufferStatus (unsigned char buffer_pos)
 Returns the status of the Buffer. More...
 
unsigned char SerialBuffer__ReadByteFromBuffer (unsigned char buf_pos, unsigned char index)
 Sends the SPI data. More...
 
unsigned char SerialBuffer__GetTXBufferIndex (void)
 Returns the Serial Buffer TX index. More...
 
unsigned char SerialBuffer__GetRXBufferIndex (void)
 Returns the Serial Buffer RX index. More...
 
void SerialBuffer__Send (void)
 Method to change the status of a buffer position to full so the handler will send it. More...
 
BOOL_TYPE SerialBuffer__NewDataAvailable (void)
 Returns TRUE_T if there is any new message in the buffer. More...
 
void SerialBuffer__NewMessageReceived (void)
 Method to be called when a new message is received. More...
 
void SerialBuffer__DropFrameReceived (void)
 Method to drop frame receiver per error. More...
 
void SerialBuffer__ResetSerialErrorFlags (void)
 Method to reset the error flags from the serial. More...
 

Detailed Description

Header file of SerialBuffer.

Version
S00_00_01 Aug 20, 2020

Definition in file SerialBuffer.h.

Enumeration Type Documentation

◆ BUFFER_POS_TYPE

enum BUFFER_POS_TYPE

Definition at line 39 of file SerialBuffer.h.

◆ SERIALBUFFER_RX_STATE_TYPE

Enumerator
SERIALBUFFER_RX_STATE_RECEIVE_HEADER 

Will check for buffer position not empty.

SERIALBUFFER_RX_STATE_RECEIVE_DATA 

In this state Node will check if line is free to start transmission.

SERIALBUFFER_RX_STATE_ERROR 

Is waiting for all bytes of the position to be transmitted.

Error state

Definition at line 31 of file SerialBuffer.h.

◆ SERIALBUFFER_TX_STATE_TYPE


-----------------------------— Theta Power Systems - CONFIDENTIAL --------------------------------------------—

Enumerator
SERIALBUFFER_TX_STATE_LISTEN 

Will check for buffer position not empty.

SERIALBUFFER_TX_STATE_SENDING 

In this state Node will check if line is free to start transmission.

SERIALBUFFER_TX_STATE_ERROR 

Is waiting for all bytes of the position to be transmitted.

Error state

Definition at line 23 of file SerialBuffer.h.

Function Documentation

◆ SerialBuffer__DropFrameReceived()

void SerialBuffer__DropFrameReceived ( void  )

Method to drop frame receiver per error.

Definition at line 426 of file SerialBuffer.c.

Here is the caller graph for this function:

◆ SerialBuffer__GetRXBufferIndex()

unsigned char SerialBuffer__GetRXBufferIndex ( void  )

Returns the Serial Buffer RX index.

Returns
unsigned char Serial_RX_Buffer_Index

Definition at line 326 of file SerialBuffer.c.

◆ SerialBuffer__GetRXBufferStatus()

BUFFER_POS_TYPE SerialBuffer__GetRXBufferStatus ( unsigned char  buffer_pos)

Returns the status of the Buffer.

Parameters
unsignedchar buffer_pos - buffer index
Returns
BUFFER_POS_TYPE RX_Buffer[buffer_pos].Pos_Status

Definition at line 284 of file SerialBuffer.c.

◆ SerialBuffer__GetTXBufferIndex()

unsigned char SerialBuffer__GetTXBufferIndex ( void  )

Returns the Serial Buffer TX index.

Returns
unsigned char Serial_TX_Buffer_Index

Definition at line 316 of file SerialBuffer.c.

◆ SerialBuffer__GetTXBufferIsEmpty()

bool SerialBuffer__GetTXBufferIsEmpty ( void  )

Returns if the TX buffer is Empty.

Returns
bool

Definition at line 263 of file SerialBuffer.c.

◆ SerialBuffer__GetTXBufferStatus()

BUFFER_POS_TYPE SerialBuffer__GetTXBufferStatus ( unsigned char  buffer_pos)

Returns the status of the Tx Buffer.

Parameters
unsignedchar buffer_pos - buffer index
Returns
BUFFER_POS_TYPE TX_Buffer[buffer_pos].Pos_Status

Definition at line 249 of file SerialBuffer.c.

◆ SerialBuffer__HandlerRX()

void SerialBuffer__HandlerRX ( void  )

Serial Buffer RX Handler.

Definition at line 185 of file SerialBuffer.c.

◆ SerialBuffer__HandlerTX()

void SerialBuffer__HandlerTX ( void  )

Serial Buffer TX Handler.

Definition at line 135 of file SerialBuffer.c.

◆ SerialBuffer__Initialize()

void SerialBuffer__Initialize ( void  )

It Initializes the module and its variables.

Definition at line 76 of file SerialBuffer.c.

◆ SerialBuffer__NewDataAvailable()

BOOL_TYPE SerialBuffer__NewDataAvailable ( void  )

Returns TRUE_T if there is any new message in the buffer.

Returns
BOOL_TYPE RX_Buffer_Full - TRUE_T if any buffer position is FULL

Definition at line 336 of file SerialBuffer.c.

◆ SerialBuffer__NewMessageReceived()

void SerialBuffer__NewMessageReceived ( void  )

Method to be called when a new message is received.

It will set the estate of the Buffer position as FULL and will increment the Buffer position counter

Definition at line 358 of file SerialBuffer.c.

Here is the caller graph for this function:

◆ SerialBuffer__ReadByteFromBuffer()

unsigned char SerialBuffer__ReadByteFromBuffer ( unsigned char  buf_pos,
unsigned char  index 
)

Sends the SPI data.

Parameters
unsignedchar num_of_bytes

Definition at line 298 of file SerialBuffer.c.

◆ SerialBuffer__ReadFromBuffer()

void SerialBuffer__ReadFromBuffer ( unsigned char *  data,
unsigned char  buffer_pos 
)

Returns the data from the Buffer.

Parameters
unsignedchar *data - position to copy the data
unsignedchar buffer_pos - buffer index

Definition at line 233 of file SerialBuffer.c.

◆ SerialBuffer__ResetSerialErrorFlags()

void SerialBuffer__ResetSerialErrorFlags ( void  )

Method to reset the error flags from the serial.

Definition at line 417 of file SerialBuffer.c.

◆ SerialBuffer__Send()

void SerialBuffer__Send ( void  )

Method to change the status of a buffer position to full so the handler will send it.

This is a way to indicate that all data for that position was loaded.

Definition at line 123 of file SerialBuffer.c.

◆ SerialBuffer__U8LoadDatatoBuffer()

BOOL_TYPE SerialBuffer__U8LoadDatatoBuffer ( unsigned char  data)

Method to load data to the Serial TX Buffer.

Parameters
unsignedchar data
Returns
BOOL_TYPE: FALSE_T if Buffer Full

Definition at line 100 of file SerialBuffer.c.