Programmable Clock with RTOS 0.0.1
Implementaiton of a programmable clock using RTOS with STM32GO microcontroller.
Loading...
Searching...
No Matches
can_tp.h File Reference

Board Support Package. More...

#include "bsp.h"

Go to the source code of this file.

Data Structures

struct  _CAN_MsgTypeDef
 struct store the element saved the messages of the module FDCAN for CAN Message Elements. More...
 
struct  _CAN_TP_Header
 struct store the element saved the messages of the module FDCAN for CAN_TP Header information. More...
 

Macros

#define MAX_ARRAY_SIZE   25
 

Typedefs

typedef struct _CAN_MsgTypeDef CAN_MsgTypeDef
 struct store the element saved the messages of the module FDCAN for CAN Message Elements.
 
typedef struct _CAN_TP_Header CAN_TP_Header
 struct store the element saved the messages of the module FDCAN for CAN_TP Header information.
 

Functions

void CAN_TP_Init (CAN_TP_Header *header)
 Initializes the CAN_TP configuration for the CAN_TP_Periodic_Task.
 
void CAN_TP_Periodic_Task (CAN_TP_Header *header)
 Task process for CAN_TP.
 
void CAN_TP_Tick (void)
 Timing function for CAN_TP.
 
void CAN_TP_RxMessageBufferSet (CAN_TP_Header *header, uint8_t *buffer, uint32_t bufferSize)
 Sets the received message buffer and its size.
 
void CAN_TP_RxSeparationTimeSet (CAN_TP_Header *header, uint8_t separationTime)
 Sets the separation time between received messages.
 
void CAN_TP_RxBlockSizeSet (CAN_TP_Header *header, uint8_t blockSize)
 Sets the block size for received messages.
 
void CAN_TP_TransmitMessage (CAN_TP_Header *header, const uint8_t *data, uint32_t length)
 Initiates the transmission of a CAN_TP_Transmited message.
 
uint8_t CAN_TP_IsMessageReady (const CAN_TP_Header *header)
 Checks if the message is ready to be processed.
 
void CAN_TP_MessageGet (CAN_TP_Header *header, uint8_t *data, uint8_t data_length)
 Gets the processed message.
 
void CAN_TP_NewMessage (CAN_TP_Header *header, void *buffer)
 Handles a new message received by CAN_TP.
 
void CAN_TP_TransmitInterruptMessage (CAN_TP_Header *header)
 Message transmission with interruption.
 

Detailed Description

Board Support Package.

File provides the neccesary drivers, libraries, and configurations for the CAN BUS.

Macro Definition Documentation

◆ MAX_ARRAY_SIZE

#define MAX_ARRAY_SIZE   25

Maximum allowed size for the array

Function Documentation

◆ CAN_TP_Init()

void CAN_TP_Init ( CAN_TP_Header * header)

Initializes the CAN_TP configuration for the CAN_TP_Periodic_Task.

Function necessary for work with normality

Parameters
headerCAN_TP header data structure.

< The flag indicates when CAN TP is not ready to transmit a message

< The flag indicates when CAN TP is not ready to transmit a message

◆ CAN_TP_IsMessageReady()

uint8_t CAN_TP_IsMessageReady ( const CAN_TP_Header * header)

Checks if the message is ready to be processed.

Function that tells us if we can read the complete message received through CAN_TP

Parameters
headerCAN_TP header data structure.
Returns
1 if the message is ready, 0 otherwise.

◆ CAN_TP_MessageGet()

void CAN_TP_MessageGet ( CAN_TP_Header * header,
uint8_t * data,
uint8_t data_length )

Gets the processed message.

Function to extract all the message received by CAN TP into a variable and then delete all the message received in the Rx buffer.

Parameters
headerCAN_TP header data structure.
dataPointer to the message data.
data_lengthLength of the data to retrieve.

◆ CAN_TP_NewMessage()

void CAN_TP_NewMessage ( CAN_TP_Header * header,
void * data )

Handles a new message received by CAN_TP.

Function to implement in HAL_FDCAN_RxFifo0Callback. This function tells us when to enter CAN_TP_RxReceive_Period_Task

Parameters
headerCAN_TP header data structure.
dataPointer to the received message data.

◆ CAN_TP_Periodic_Task()

void CAN_TP_Periodic_Task ( CAN_TP_Header * header)

Task process for CAN_TP.

Function switches the CAN TP periodically if it transmits or receives.

Parameters
headerCAN_TP header data structure.

< The flag indicates when CAN TP is ready to transmit a message

< The flag indicates when CAN TP is not ready to transmit a message

◆ CAN_TP_RxBlockSizeSet()

void CAN_TP_RxBlockSizeSet ( CAN_TP_Header * header,
uint8_t blockSize )

Sets the block size for received messages.

Function to indicate the blocks that will be received in the transmission of messages. If kept at 0, message limits will not be taken into account for transmission.

Parameters
headerCAN_TP header data structure.
blockSizeBlock size.

◆ CAN_TP_RxMessageBufferSet()

void CAN_TP_RxMessageBufferSet ( CAN_TP_Header * header,
uint8_t * buffer,
uint32_t bufferSize )

Sets the received message buffer and its size.

Function to indicate the size and memory space of the Rx buffer where the messages received from the data transmission will be saved.

Parameters
headerCAN_TP header data structure.
bufferReceived message buffer.
bufferSizeSize of the message buffer.

◆ CAN_TP_RxSeparationTimeSet()

void CAN_TP_RxSeparationTimeSet ( CAN_TP_Header * header,
uint8_t separationTime )

Sets the separation time between received messages.

Function to indicate the separation time of message transmission for the Rx buffer. If kept at 0, no waiting limits will apply between received messages.

Parameters
headerCAN_TP header data structure.
separationTimeSeparation time between messages.

◆ CAN_TP_Tick()

void CAN_TP_Tick ( void )

Timing function for CAN_TP.

Function that counts CAN TP ticks to ensure separation time and sending of a wait, overflow/abort.

◆ CAN_TP_TransmitInterruptMessage()

void CAN_TP_TransmitInterruptMessage ( CAN_TP_Header * header)

Message transmission with interruption.

Function that calls CAN_TP_TxTransmit_Period_Task when the flag_interruption is activated, this happens when a flowcontrol typeframe CTS is received.

Parameters
headerCAN_TP header data structure.

< The flag indicates when CAN TP is ready to transmit a message

◆ CAN_TP_TransmitMessage()

void CAN_TP_TransmitMessage ( CAN_TP_Header * header,
const uint8_t * data,
uint32_t length )

Initiates the transmission of a CAN_TP_Transmited message.

The function analyzes whether to send a single frame or multiple consecutive frames depending on the length of the data. In the case of multiple consecutive frames, the number of consecutive frames that will be sent is calculated.

Parameters
headerCAN_TP header data structure.
dataPointer to the message data.
lengthLength of the message.

< The flag indicates when CAN TP is ready to transmit a message

< Offset data of the first frame because it transmitted 6 bytes of data

< Offset data of the first frame because it transmitted 6 bytes of data

< Offset data of the first frame because it transmitted 6 bytes of data

< Offset data of the first frame because it transmitted 6 bytes of data

< Offset data of the first frame because it transmitted 6 bytes of data

< The flag indicates when CAN TP is ready to transmit a message