brazos-trapezoidal
Classes | Typedefs | Functions
Tsp.h File Reference

Header file of Tsp. More...

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

Go to the source code of this file.

Classes

struct  TSP_TYPE
 
struct  TSP_PARSER_TYPE
 

Typedefs

typedef void(*const TSP_PARSER_RECEIVE_FUNCTION_TYPE) (TSP_TYPE *)
 

Functions

void Tsp__Initialize (void)
 It Initializes the module Tsp and its variables. More...
 
void Tsp__FastHandler (void)
 
void Tsp__SlowHandler (void)
 
BOOL_TYPE Tsp__Send (BOOL_TYPE is_retry)
 Method to send Tsp message. More...
 
void Tsp__LoadData (unsigned char adress, unsigned char num_of_bytes, unsigned char api, unsigned char *data)
 

Detailed Description

Header file of Tsp.

Version
S00_00_01 Aug 20, 2020

Definition in file Tsp.h.

Typedef Documentation

◆ TSP_PARSER_RECEIVE_FUNCTION_TYPE

typedef void(*const TSP_PARSER_RECEIVE_FUNCTION_TYPE) (TSP_TYPE *)

Definition at line 32 of file Tsp.h.

Function Documentation

◆ Tsp__FastHandler()

void Tsp__FastHandler ( void  )
@brief      Fast Handler for the module
@details    Must be called at a fast rate (1ms)

Checks if there is a new message in the Serial buffer.

Check pass_phrase in the package (last 2 bytes before the CRC)

Checks if the message is for this node or if it is a broadcast

If message was not for this node ignore it

Check CRC, if bad crc cleans the message

If is a discovery package

If the control pass phrase is wrong, send a bad ACK

If the version pass phrase is wrong, send a bad ACK

If the message was for this node and the crc is ok, Send AcK Also runs the APIs parsed functions

Runs the APIs receive functions defined in the prv file

Load ACK data to RX

If the message is an ack

Definition at line 132 of file Tsp.c.

◆ Tsp__Initialize()

void Tsp__Initialize ( void  )

It Initializes the module Tsp and its variables.

Definition at line 73 of file Tsp.c.

◆ Tsp__LoadData()

void Tsp__LoadData ( unsigned char  adress,
unsigned char  num_of_bytes,
unsigned char  api,
unsigned char *  data 
)

Definition at line 370 of file Tsp.c.

◆ Tsp__Send()

BOOL_TYPE Tsp__Send ( BOOL_TYPE  wait_ack)

Method to send Tsp message.

This method will send the data previously loaded to TX_Tsp_Data, it will check first if there is free space in the Ack Buffer before sending the message. Also it is necessary to define if this is a retry message, so it will not create another Ack.

Parameters
_Boolwait_ack: TRUE_T for wait to receiving an Ack, FALSE_T if this is not to wait for an ack retry message.
Returns
BOOL_TYPE ack_buffer_free: TRUE_T is message was accepted, FALSE_T if Ack buffer is full.

Find free buffer space

If there Ack Buffer is Full the new message will not be loaded.

If not sending Ack and there is space in the Ack Buffer, wait for Ack

Definition at line 294 of file Tsp.c.

◆ Tsp__SlowHandler()

void Tsp__SlowHandler ( void  )
@brief      Slow Handler for the module
@details    Can be called at a slower rate (around 5ms or 25ms)

Verify if there is any waiting Ack message

Definition at line 250 of file Tsp.c.